I have made a snake clone with the purpose of allowing many people playing as possible. This game will most likely be played at a Local LAN party i attend regularily with a usual attendace of about 400 people. I want to have the ability for at least 64 people playing at one time, however i am wanting to have about 200 players at once. This is because the game will likely be used as a fun competition for hardware prizes dontated to the LAN.
The game can be downloaded here: http://goldenstudios.or.id/forum/index.php?act=Attach&type=post&id=1267
You will have to edit the config.xml to the ip address of the computer which will be running the server. And edit how many players must be connected before the game starts.
Controls:
Left - turn snake left
Right - turn snake right
Space - turbo speed
I am alittle concerned about the lag that is felt by players who connect to another computer running the server ( if the server is run on the same computer as the player there is no lag).
The nework protocol used in this game:
C = client
S = server
start up
C connects to S
S returns unique ID
C sends userName
S waits until sufficent players connected then sends inital game state to every C
playing
C sends change in keys being pressed flags to S
S adds this message to a buffer to send
S sends the buffer every 20 msec (if the buffer has at least one message) to every C
The keyboard input rate is 16.7 hz
The underlying game state rate is 50 hz
The incomming network msg handling is 50 hz
The outgoing network msg is 16.7 hz
The video frame rate is independant.
So assuming a 20 msec network delay then the message round trip should be approx: 20 delay to server + 20 delay at server + 20 delay to client which is about the 16.7hz mark and so should be not noticable by the user.
Is this thinking above incorrect? How would i go about reducing this delay?
Initally i thought what it is my update rate of the server (20 msecs) however that would mean that there should be lag even if the server and the client are on the same computer so it must be the delay caused by the network.
Any help would be greatly appreciated.