The lack of multiplayer examples in sdl is lacking and in general for any game code. Let’s do our part to change that. Here is how most poeople start a multiplayer project:
http://www.breakersgambit.com/?p=24 or http://www.cratemonkey.com/?p=356 (they are the same example)
The client connects and tells the server when it moves where it is. The server then tells the other clients the x and y that client reported. The result kind of works with a handful of players and very few objects. If you put, let’s say, ten players in even a small closed in room the players blip around the room and it looks like connections and disconnections make server lag.
I would like to address the first issue first. **>How can we get clients in sync so that they can run around and fight each other in real time?<**The second issue I would like to tackle later. Most people just give up on sdl_net and use something much more premade for the server and try to make whatever they find work for their game from someone elses code and someone elses physical server.
Let’s collaborate here. What do you guys think we can do to sync up the clients? Let’s lay out several ways we could do it and move forward with a couple. When I say we I mean I am willing write the code and post it for all to see and use freely.
I’ll give interested people that are a little google challanged a push in the right direction http://www.mine-control.com/zack/timesync/timesync.html This stuff hurts ur brain so let me kick it off…ok, how about I make the server the decider, have it take snapshots of it’s data, send ping messages to clients regularly and note the time this takes, and this way when a client fires an arrow at another client we can rewind time to the point when it actualy happened (about) and send clients data about the event that is put in sync to a greater degree by the clients because they act on information that is never further behind than the latency between the server and client rather that the latency between a client, the server, another client, the server, and the original client again?? Collision detection required for fast paced player versus player action would be suppoted even when a thousand players fire lightning bolts at each other in an mmorpg. (in theory)