Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[server] Implement server-side board simulation (matches) #7

Open
6 tasks
lunacys opened this issue Apr 24, 2024 · 0 comments
Open
6 tasks

[server] Implement server-side board simulation (matches) #7

lunacys opened this issue Apr 24, 2024 · 0 comments
Labels
feature A new feature server Game Server related tasks

Comments

@lunacys
Copy link
Collaborator

lunacys commented Apr 24, 2024

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:

pub fn hard_drop(&mut self) -> Result<MoveResult, BoardErrorReason> {

or the board is dead:
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
@lunacys lunacys added server Game Server related tasks feature A new feature labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature server Game Server related tasks
Projects
None yet
Development

No branches or pull requests

1 participant