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

Ensure players are in the right order before starting a map #119

Open
clxxiii opened this issue May 29, 2024 · 0 comments
Open

Ensure players are in the right order before starting a map #119

clxxiii opened this issue May 29, 2024 · 0 comments
Assignees

Comments

@clxxiii
Copy link
Collaborator

clxxiii commented May 29, 2024

Player Moving Algorithm

If no changes (no joins/leaves) have occured in the lobby for 10 seconds:

  1. If a player is in their correct placement, ignore them.
  2. If a player is in an incorrect place, add them to 2 different lists (one for each team).
  3. Swap index 0 of red with index 0 of blue, then index 1 of red and index 1 of blue etc.
  4. If there is an uneven number of players, it means a slot is open, so find the open slot and move them.

If at any point a player joins or leaves the lobby, abort the process and start waiting again.

Sadly, direct swaps don't work. meaning we have to use a 1 -> 3, 2 -> 1, 3 -> 2 type of swap for each player.

@clxxiii clxxiii self-assigned this May 29, 2024
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