-
Notifications
You must be signed in to change notification settings - Fork 1
Description
After a lobby starts, a new match is started.
Each match consists of a number of boards which equals to the total number of players in the match.
Players executes an input (move, rotate, drop, etc), client-side board interprets it, then client sends the command to the server, which also interprets it.
Each move is sent to all players in the match to replicate the board's state so a player sees other's boards.
Server-side simulation is needed to guarantee game consistency, e.g. a player cheats and modifies his game client, which makes pieces move and rotate freely ignoring current board state.
If a move results in an error:
Quader/src/engine/src/board.rs
Line 181 in c552734
| pub fn hard_drop(&mut self) -> Result<MoveResult, BoardErrorReason> { |
or the board is dead:
Quader/src/engine/src/board.rs
Line 30 in c552734
| pub is_dead: bool, |
then the player has lost the match.
Also, all attacks are going through the server and it calculates outgoing garbage and selects a player to send the garbage to.
Subtasks:
- Receive player inputs (commands) via WebSockets
- Interpret the inputs
- Broadcast send the inputs to other players
- Add board validation method which compares client-side and server-side board states
- Add a method for getting player's board state
- Calculate damage and send garbage