Basic Multiplayer

BlitzPlus Forums/BlitzPlus Tutorials/Basic Multiplayer

Imperium(Posted 2013) [#1]
After playing with Blitz for awhile I decided I'd like to tackle building a simple multiplayer game. I need to learn how to do this so I can tackle my larger game project later down the road.

I have a few tutorials for a pong game but I'm looking for something more in depth. Any ideas?

Linus(Posted 2013) [#2]

misth(Posted 2013) [#3]
What about a Tick-Tack-Toe online game, with lobby room where the game rooms and players are, where you can invite other players to play with you? Then, you could concentrate more on the netcode and less on the game itself - at least if the game is restricted to 3x3 grids only... :D

EDIT: Oh wait... It's the same thing, even if it's bigger than 3x3... o_O But the checking I had in mind doesn't work with 4x4 grid for example. But it works with 3x3, then add 2, so it's 5x5, and 7x7, and so on (there must be the center block there).

EDIT2: Alternatively, you could make a Pong online game and add those lobbies and such in it. After all, you only want to learn to do good netcode, right?

Imperium(Posted 2013) [#4]
Gee thanks Linus...

Yes Misth I'm looking more of an exercise in net code than a game. But I'm doubtful if the same logic applied to a simple pong game would scale up very well.

I found a good post here:

This is for Blitz3d but this is eventually what I'm aiming for.

misth(Posted 2013) [#5]
Oh nice. RakNet sure looks promising and powerful. But idk, me myself am gonna stick with the basic UDPStream thingy that's built-in with B+... :P It does the basics that I'm used to in another language.

But hey, let us know if you come it with something testable. I'm looking forward how you handle these things, and I am here to help if needed! :)

Good luck!

Imperium(Posted 2013) [#6]
I'm exploring Rottnet right now.

Where in the Blitz3d docs does it mention UDPstream? I must be blind...

misth(Posted 2013) [#7]
Just assumed you were using BlitzPlus (B+ as I mentioned in last post), since we are in BlitzPlus forum section.. :D

I have no idea about Blitz3D since I don't own it....


And those work with standard stream writes and reads.

Imperium(Posted 2013) [#8]
Thank you!

I'm actually bouncing between both (blitzplus & Blitz3d), I thought it be better to start with Blitzplus for learning multiplayer programing because in principle 2d is much easier than 3d. I would like to get a rough 2d version of my game working in 2d then possibly move it up to Blitz3d in the future.

The whole BlitzPlus/Blitz 3d thing is a bit confusing. Blitz3d is just Blitzplus with an API wrapped around Direct X7? Blitzplus can do 3d but it has to be plugged in by another engine. With Blitz3d you get a more complete even if dated package.

My post on udp vs tcp really was meant to apply to both. I should have probably post this in the B3d section but also wanted to learn the differences (and get some ideas) about the 2d way of doing multiplayer as opposed to 3d.

misth(Posted 2013) [#9]
No problem!

"Blitz3d is just Blitzplus with an API wrapped around Direct X7?" <- I have no idea of Blitz3D. Don't even remember if I've tried it...


To decide whether to use 2D or 3D completely depends on what kind of game you want to make and of what you can make.

I've been working with 2D for so long, that adding the 3rd dimension has been a pain in the ass.. No idea why :D And also I like 2D graphics more, because sprites are easier and faster to make than 3D models - for me at least.

As far as I know, the netcode doesn't make much difference in 3D than in 2D. You just work with more dimensions in your calculations and coordinations in 3D.

As for practicing the netcoding, I'd say you're better off with 2D, since you want to make a basic game fast and concentrate more on the netcode itself.

Also, when you decide whether to use UDP of TCP, you have to know their pros and cons. For me, UDP has been more nicer to use, since it doesn't have to validate the received packet as TCP does. With UDP, it doesn't matter if you lose packets, because you can always send it again.

In UDP netcodes I've always used a method of not reading data from server, if we haven't sent anything yet. And if enough time has passed (i.e. 30ms or such) from our last packet sending, the client will send new data, even tho we haven't heard from the server.

And if I'm not wrong, UDP data is more acceptable by firewalls than TCP.

Imperium(Posted 2013) [#10]
I think its the other way around, TCP is more trusted than UDP.

I will be strictly learning UDP from now on.

misth(Posted 2013) [#11]
Okay. I remembered wrong. :P

Anyway, good luck! If you'll ever need any help, I think I'm actively checking out the forums.


Matrix 23(Posted 2013) [#12]
when do you think the game will be relesed