pacmacro/pm-server-spring

Replace Gamestate manual changes with gameflow event triggers

Closed this issue · 2 comments

The current gamestate manual changes (in the Gamestate controller /gamestate) should be moved into the Admin controller (see issue #32).

Gameflow Overview

Gameflow will therefore be the following process, which combines admin triggers and game triggers:

  • Game initialized or reset (manually triggered by administrative endpoint)
    • Game state INITIALIZING
    • All player states UNINITIALIZED
    • All Pacdots eaten == false
  • All teams choose their characters, changing them from UNINITIALIZED to READY
    • Game state changed from INITIALIZING to IN_PROGRESS (automatically triggered)
    • All players states changed from READY to ACTIVE (automatically triggered)
    • No change to Pacdots
  • Pacman eats a Pacdot (i.e. Pacman's location is updated to be near a Pacdot while the game state is IN_PROGRESS)
    • No change to game state
    • No change to player states
    • The Pacdot within proximity changed to eaten == true (automatically triggered)
  • Pacman eats a Powerdot (i.e. Pacman's location is updated to be near a Powerdot while the game state is IN_PROGRESS)
    • No change to game state
    • Pacman's state changed from ACTIVE to POWERUP for 30 seconds, then back to ACTIVE (automatically triggered)
    • The Powerdot within proximity changed to eaten == true (automatically triggered)
  • Pacman eats all Pacdots and Powerdots
    • Game state changed from IN_PROGRESS to FINISHED_PACMAN_WIN (automatically triggered)
    • No change to player states
    • All Pacdots eaten == true (required precondition)
  • Pacman contacts a Ghost while Pacman is in the ACTIVE state and the Ghost is in the ACTIVE state (manually and physically tagged)
    • Game state is changed from IN_PROGRESS to FINISHED_GHOSTS_WIN (manually triggered by administrative endpoint)
    • The Pacman's state is changed from ACTIVE to CAPTURED (manually triggered by administrative endpoint)
    • No change to Pacdots
  • Pacman contacts a Ghost while Pacman is in the POWERUP state and the Ghost is in the ACTIVE state (manually and physically tagged)
    • No change to game state
    • The Ghost's state is changed from ACTIVE to CAPTURED (manually triggered by administrative endpoint)
    • No change to Pacdots

I will add the above overview to the wiki when the issue is complete.

@pacmacro/android and @pacmacro/ios, if I have made a mistake in this gameflow, please let me know.

Proposed API documentation changes:

API Documentation for Game State

All of the following:

Mapping

/gamestate

changed to:

Mapping

/admin/gamestate

Completed in the above-referenced merge commit.

The wiki has been updated with the above documentation.

For any changes or discussion, please open a new issue.