Original Post
Hello,
I'm currently programming the movement engine for my multiplayer game. The game is played through a server which validates everything and sends updates to other clients.
Now I'm at the point where it has to validate player movement and send updates to all clients seeing that player.
Now my question is how I should process movement packets from clients. What I thought of: Having one extra thread which does movement validation. This thread has a queue which stores incoming movement packets based on the order in which they arrive. Then, in every iteration, it takes the next movement packet from the queue and validates it. After it validates it it sends an update to all relevant clients.
Also of note: the game has tile based movement. Meaning one movement advances the player one tile further.
Is this an OK approach or is there a better one?
I'm currently programming the movement engine for my multiplayer game. The game is played through a server which validates everything and sends updates to other clients.
Now I'm at the point where it has to validate player movement and send updates to all clients seeing that player.
Now my question is how I should process movement packets from clients. What I thought of: Having one extra thread which does movement validation. This thread has a queue which stores incoming movement packets based on the order in which they arrive. Then, in every iteration, it takes the next movement packet from the queue and validates it. After it validates it it sends an update to all relevant clients.
Also of note: the game has tile based movement. Meaning one movement advances the player one tile further.
Is this an OK approach or is there a better one?