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

Multi-game servers #7

Open
migomipo opened this issue Nov 18, 2020 · 0 comments
Open

Multi-game servers #7

migomipo opened this issue Nov 18, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@migomipo
Copy link
Owner

migomipo commented Nov 18, 2020

I've been thinking about adding the ability to run multiple simultaneous games at once in a single server. The server should have the capability to move players between games, and the player lists, chat and all game state will be separate for each game. There's actually one feature in the HQM protocol that makes it easier to reset state when moving players between games.

Plenty of technical issues need to be fixed:

  • Currently, pretty much all code is run in a single Tokio task and is therefore single-threaded. For this feature to work, we're going to need at least one Tokio task per game.
  • Player session handling needs to be rewritten to ensure that messages are handled by the correct game instance
  • Some data will have be shared between tasks, so we need to add a lot of mutexes and/or channels to the code.
  • Right now, the physics-heavy game loop is done in the same Tokio thread as all the I/O stuff. This will be an issue if we run multiple games in a server, as the game loop may starve the I/O code. We need to move as much of the game loop as possible into a different non-I/O thread. The easiest option would be tokio::task::spawn_blocking or tokio::task::block_in_place, but rayon::spawn could also be considered.
@migomipo migomipo added the enhancement New feature or request label Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant