-
Notifications
You must be signed in to change notification settings - Fork 0
Room lifecycle
X
^
|
+---------+ | OWNER LEAVES
| |----+
| START |
| LOBBY |
| |
+---------+
|
| START
|
V
+---------+
| |<--------------+
| IN | |
+-------| GAME |<---+ |
| | PHASE1 | | |
| +---------+ | |
| | | |
| | SOLUTION| |
| | FOUND | |
| V | |
| +---------+ | |
| TIME | | | |
| OUT | IN | | |
| | GAME | | |
| | PHASE2 | | |
| +---------+ | | RESTART
| | | NEXT | SAME
| | ROUND | ROUND | SESSION
| | END | |
| V | |
| +---------+ | |
| | | | |
+------>| SOLUTION|----+ |
| DISPLAY | |
| | |
+---------+ |
| AFTER |
| LAST |
| ROUND |
V |
+---------+ |
| | |
| END |---------------+
| LOBBY |
| | +(at any state)
+---------+ | ALL LEAVE
|
V
X
A user has just clicked on the "new room" link. He becomes the owner of the room.
Once created, other users can join using the room address.
The start lobby is a form describing the game session.
Form is read/write for the owner, read only for other users.
Visibility option: unlisted or public. Default: unlisted.
Duration option: specified number of rounds, or of victories, or unlimited. Default: 5 rounds.
Joining after start option: allowed or not allowed. Default: allowed.
Owner decides when game starts (START action).
- Cli -> Srv: start (owner only)
- Cli -> Srv: set visibility (owner only)
- Cli -> Srv: set duration (owner only)
- Cli -> Srv: leaving room
- Srv -> Cli: user joined
- Srv -> Cli: user left
- Srv -> Cli: visibility changed
- Srv -> Cli: duration changed
- Srv -> Cli: game started (includes game board)
- Srv -> Cli: room killed by owner Future: 'user ready' signals, chat, invitation to join, kick, select different game boards
Players have a time limit to find a solution before the round ends.
Upon finding a valid solution, phase 2 is triggered.
Upon reaching the time limit, the round ends.
- Cli -> Srv: leaving room
- Cli -> Srv: announce solution
- Cli -> Srv: fetch time left
- Srv -> Cli: user joined
- Srv -> Cli: user left
- Srv -> Cli: solution announced - new phase starts
- Srv -> Cli: round ends
Players have a shorter time limit to improve on the previously announced solution.
Upon reaching the time limit, the round ends.
- Cli -> Srv: leaving room
- Cli -> Srv: announce solution
- Cli -> Srv: fetch time left
- Srv -> Cli: user joined
- Srv -> Cli: user left
- Srv -> Cli: new best solution for a user announced
- Srv -> Cli: round ends
If a solution was found, it is replayed (automatically) and players have a time limit to study the solution.
Score is updated if needed.
Upon reaching the time limit, a new round starts or the end lobby is displayed if the last round was played.
- Cli -> Srv: leaving room
- Cli -> Srv: fetch new scores
- Cli -> Srv: fetch time left
- Srv -> Cli: user joined
- Srv -> Cli: user left
- Srv -> Cli: new round starts
- Srv -> Cli: game ends
The final scores (rounds won, game winner) are displayed.
The lobby remains alive as long as one player stays.
The owner can restart the game session with the same parameters as when he created the game.
- Cli -> Srv: leaving room
- Cli -> Srv: fetch new scores
- Cli -> Srv: restart same game (owner only)
- Srv -> Cli: user joined
- Srv -> Cli: user left
- Srv -> Cli: game started Future: 'user ready' signals, kick, chat
If all players leave the room, the room is destroyed.