-
Notifications
You must be signed in to change notification settings - Fork 0
Description
With multiple people playing and general network latency, there's a near absolute chance that individual players could issue multiple commands within the game server's tick. Take for example the following:
Player 1: issues 3 commands
Player 2: issues 4 commands
Player 3: issues 2 commands
with the following message order placed on the queue
p2 | p2 | p3 | p1 | p1 | p2 | p3 | p1 | p2
If processed in order, that would give p2 an unfair advantage, as they would have more actions per tick than the rest.
I see one of two ways of handling it. There may be more, but this is what I see.
- create an in-memory queue and a re-sequencer to intersperse the commands (maintaining FIFO) like such
p2 | p3 | p1 | p2 | p1 | p3 | p2 | p1 | p2
- or we create individual in-memory queues for each player and a router. We then iterate over the first elements of their queues per server tick.
p2 | p2 | p2 | p2
p3 | p3
p1 | p1 | p1
process p2, then process p3, then process p1 ....
I'm leaning towards the latter, as the logic would be simpler.
Thoughts @rezalas?