Client:
- Code: Select all
connect to server
while( user does not exit && connection live)
check for user input
send commands to the server
estimate outcome and update world data with 'best guess'
draw graphics
play sounds
receive updates about the game from the server
correct any errors in world data
draw graphics
play sounds
end
Server:
- Code: Select all
while( true )
check for and handle new player connections
check for client commands
sanity check client commands
run AI
move all entities
resolve collisions
sanity check world data
send updates about the game to the clients
handle client disconnects
end
I have a few questions regarding this in relation to event and state synchronization. So far in my game the client is basically an advance input listener that draw graphics. If a client makes a command it will first reach the server and with the next state synchronization the client will see the effect. The game is an asteroids clone, throttle, rotation, bullets, etc.
- 1. How often do you usually send state synchronisation messages to all players from the server? I have been experimenting with everything between 100 ms - 1000 ms and different amount of prediction. With 100 ms (10 statesyncs every second) the bandwidth is consumed very quickly with just a few players, is that to be expected?
- 2. I might have missunderstood what event synchronization in the multiplayer guide that can be found http://playerio.com/documentation/tutorials/building-flash-multiplayer-games-tutorial/. But is it just a way of feeding the other clients with information so that they can make better predictions? Or does event synchronisation refer to the client sending user input to the server?
I actually have more questions, but let's start with these.
Thanks again!