Synchronizing online games

I’m writing a server for an on-line rts game and trying to decide how to make sure all players see the same thing. Originally, the server was just going to pass commands along to all players, but would all players see the same thing at the same time (eg if player A gives a move order at 5:32, will all players see it at 5:32, or will some see it at 5:33 or later)? One reason for the game logic to be run on the user is that there will be single player, lan capabilities, and direct ip connections.

is the article I’m particularly interested in when the time comes for me to implement networking. It uses the idea of a totally synchronized game by letting player commands lag a few game turns, depending on connection.

  • elias

Typical RTS setups work completely synchronous. Game commences when every msg is processed.

The problem with frame by frame synchronization is that, done naively, everyones response is equal to that of the worst player and it can vary a lot.

Some lessons we learned when getting Duke Nukem 3D to play well over the internet might be helpful.

(1) Get your data rate down. Dont synchronize every frame but rather every N frames. In an RTS you coudl for instance have a “command beat” thats much lower then (and decoupeld from) your frame rate.

(2) Packet aggregate at the server if you have one. You’ll generally get better performane characteristics by collecting all the frames at your server, building one “turn” packet and sending it out to everyone rather then sending individual moves through the server to everyone.

(3) You might want to consider loosening up the synchronization and going with a tiem based scheme for commands and corrections. Looked at this way the RTS problem really isnt different from any other dead-reckoning situation except that your controls are actually looser and thus differences are easier to hide…