- 2D game, not a shooter obviously.
- Using TCP - prefixing all messages with message lengths, all handled in the download algorithm.
- Enabled NO_DELAY
- Server has a fixed game loop of 60 ticks each second
- At the start of each loop the server downloads all available data from all clients and tries to process any full messages received (i.e. if message length has been reached, etc...). During this stage, if a message received is for example, "player X moving left", then the server checks if the received coordinates from where the player moved from is not using any sort of speed hack by comparing current position in server memory (etc.. etc.. handled all of this), then all other connected clients have their upload buffer added to with this new movement message.
- During the middle of a game loop (where the game tick is processed) all new messages to upload are placed into their respectful client upload buffers. (i.e. a NPC moved left/right).
- Just before the end of the game loop the server uploads all data in all uploads buffers of all connected clients.
- At the end of the game loop, all connections are checked to see if everyone is still connected correctly.
- There is only one thread which handles all of this
- Client has a fixed game loop of 60 ticks each second
- Also downloads everything at the start of the loop
- Also uploads everything just before the end of the loop
- Checks the server connection at the end of the game loop
- There is also only one thread which handles all of this.
All replies appreciated, thanks