Multiplayer

Blitz3D Forums/Blitz3D Beginners Area/Multiplayer

Sph!nx(Posted 2008) [#1]
I know, it's a little early for me but I'm trying to grasp a little of how multiplayer works in Blitz3D.

I've looked through the code archives and the forum. There are great examples to be found, but what I wanted to know if there are ways to make things a little more simple.

I've read about Blitzplay and I assume its a library that extends the current commands set regarding multiplayer. Though, I found a lot of talk about it, all the links are dead and the pages google provided me are also dead.

Anyone has some more information about Blitzplay or other ways of doing these things simple and effective? I just need a general direction, so I can implement it in my potential game, when the time is due.


Thanks a lot!


Ross C(Posted 2008) [#2]
Try rottnet in the toolbox section.

In my experience, multiplayer can be tricky. The way i do it is to nominate a server computer, the one with the highest bandwidth, as it will be sending and receiving to all computers. Every other computer simply sends positional/rotation data to this computer and it serves it out when there is a change in positions.

You wouldn't send positional data out, unless there has been a change, as your always looking to use the least bandwidth.

You will probably be using UDP protocol for multiplayer fast moving games, so you will need to manually check the packets have,

1. arrived and
2. arrived in the correct order. You tag a time stamp onto each packet (using the millisecs() command if you wish, or simply a number you increment). Compare each packets timestamp with the most recent one. If it's older, than you disregard that packet, as it contains old data.

Now, you will need a prediction routine in place for dealing with moving your characters inbetween packets. If you don't, your character will jump from packet positional location, to packet positional location. You need to take the last 2 or 3 packet positions and estimate from them, where abouts your character is now.

Lunch time for me. I'll be back if i think of anything else :o)


Sph!nx(Posted 2008) [#3]
Thanks Ross!

So if I understand right, in a 'normal' single player game, you simply update everything in your loop and in a multiplayer game you check the actions, or packets, first, if they need update for preservation of bandwidth. Sounds very logical to me.

Then I also guess there needs some alterations in the 'key input' commands, so that certain actions will happen when the right person, or client, its the key. Not that I move all characters by letting my own character move forward :P


I will take a look at rottnet!


Ross C(Posted 2008) [#4]
Well, when the user inputs a key to move, you should set a flag to indicate a packet needs to be send containing positional data, or all data if your game requires that.


Sph!nx(Posted 2008) [#5]
I understand right, instead of coding in the input into the game, I should make the players all the same, yet 'labelled' differently. They react upon the same kind of input, yet accompanied by a sender with the corresponding label.

Quite different than a single player game. Although, I should tweak my 'key input system' a bit, if I want to be able to have the option that the potential player can configure his own keys in the games setup.


Blitzplotter(Posted 2008) [#6]
I have been playing with a client / server thing from first principles. basically my clients put a request to a server, and it is only when the server responds to the client - and all other clients that the move action is carried out. I am beginning to understand the problems with this approach... but it is a long way of.