Skip to content

Tomelia1999/Brainwar

Repository files navigation

Games

Solana Dice

Brain Wars

Description

Last game standing game. Need to make fast decisions, whether to stay or bail. Since playing VS people, it really is a mental war.

Players place a bet at the start of the game. On the server side, a random number is generated that determines the length of the game, 0[s] to 45[s].

Each player decides when to cash out, and that exited last, wins. If no player exited and the game ended, all players lose.

Rules

  1. Each game length varies, players don't know how long is the current game. The last player to leave before the round finishes, wins.
  2. Each game must contain at least 2 players, since this is a PVP game. Once 2 players are ready, the countdown starts and every player may join until the game starts.
  3. The platform opens rooms with a fixed bet price, each player an choose the room the fits him the most.
  4. The player who wins the game, earns his entry fee times the amount of players who have played. But if no player exits before the clock stops, the house wins.

Implementation

Server

  • axum for the web server
  • websockets for quick communication
  • postgres for storing game data
  • react for the frontend

Blockchain

Each round we'll sample solana blockchain and get the latest block hash. We'll convert this blockhash to a number between 0 and 45. We'll then use this number to determine the length of the game. We'll encrypt this data and store it on the blockchain, when the game ends we'll publish the decryption key.

References

  1. axum - confused about the websocket/chat example model
  2. axum - websocket example
  3. axum - SQLx
  4. axum - Zero2Prod
  5. axum - examples
  6. Code Coverage - Rust
  7. axum-login
  8. TS-Rust Binding
  9. Rust websockets messaging

About

Solana based game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published