The core game for Space Battles is run from here, the frontends will display what happened as well as send the commands from each player. This server will do all the logic and calculate the end results before sending back the new state of the game.
- Player can create a game
- Player can join a game
- Player gets an SSE (server sent event) for game updates
- Player can get who is in the lobby
- Player gets event when another player joins the lobby
- Player can change ship type in lobby
- Player gets event when another player changes ship types
- Player can change ship color in lobby
- Player gets event when another player changes their color in the lobby
- When the host quits the game, someone else becomes the host
- When the last player quits the game, the game ends
- Player can ready up
- Players in lobby can see other players who have readied up
- A player joining a game cancels all players ready up
- Players in game cannot change ship type
- Players in game cannot change their color
- When the game starts, players are assigned random locations
- Players can only see the location of other players
- Players can update their speed +/- 1
- add max speed to ships
- add speed to players
- Ships route should return the maximum speed
- Create get my player route to get my player
- create route to increase speed
- Speed cannot be increased past maximum speed
- Speed can be decreased by one
- Speed cannot be decreased below 0
- Each player can set commands for the current turn
- Create tables for turns and player commands
- When a game starts, create the first turn
- A player can submit a command for the current turn
- A player cannot submit multiple commands for the same turn
- When all players are ready, apply the command to the game for each player
- Mark current turn no longer active
- Create a new turn
- Mark all players as not ready
- Players can update their speed
- When a player is submitting a command, they can include a speed increase or decrease
- Players cannot change speeds twice in one turn
- Ships have a max / minimum distance they can travel based on speed
- Ships have shields
- Ships have hull strength
- Players can set their destination
- Players can target a cell to fire at
- Players can ready up their turn
- As soon as the last player readied up their turn the turn ends and the turn simulates
- Results of the turn are kept in a log
- Players get access to the log every turn
- Game ends when only one player remains
- Players are not assigned locations next to other players
- Tweak game size