Skip to content

Comments

FEA Implement support for multiple concurrent games#11

Open
lguibr wants to merge 3 commits intomainfrom
fea-add-multigames-on-a-server
Open

FEA Implement support for multiple concurrent games#11
lguibr wants to merge 3 commits intomainfrom
fea-add-multigames-on-a-server

Conversation

@lguibr
Copy link
Owner

@lguibr lguibr commented Apr 9, 2024

  • Introduce an array to hold multiple Game instances
  • Check for an available game slot when a new player connects
    • If no available slot, start a new game and add it to the array
    • If an available slot exists, assign the player to that game
  • Each game instance runs independently with its own lifecycle and communication channel
  • Remove the unused HandleGetSit handler

This commit introduces the capability to host multiple concurrent Pongo games. When a new player connects via WebSocket, the server checks for an available slot in the existing games. If no slot is available, a new game instance is started and added to the games array. This allows multiple games to run simultaneously, each with its own lifecycle and communication channel. The HandleGetSit handler has been removed as it is no longer needed in this implementation.

* Introduce an array to hold multiple Game instances
* Check for an available game slot when a new player connects
  - If no available slot, start a new game and add it to the array
  - If an available slot exists, assign the player to that game
* Each game instance runs independently with its own lifecycle and communication channel
* Remove the unused HandleGetSit handler

This commit introduces the capability to host multiple concurrent Pongo games. When a new player connects via WebSocket, the server checks for an available slot in the existing games. If no slot is available, a new game instance is started and added to the games array. This allows multiple games to run simultaneously, each with its own lifecycle and communication channel. The HandleGetSit handler has been removed as it is no longer needed in this implementation.

Co-authored-by: Comai <github.com/lguibr/comai>
@lguibr lguibr self-assigned this Apr 9, 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

Successfully merging this pull request may close these issues.

2 participants