Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue scheduling #7

Open
sean-gilliam opened this issue Nov 5, 2023 · 0 comments
Open

Queue scheduling #7

sean-gilliam opened this issue Nov 5, 2023 · 0 comments

Comments

@sean-gilliam
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant