/welcome-game

Welcome to your perfect home board game web client

Primary LanguageTypeScript

Welcome To Your Perfect Home

A web implementation of the Welcome To... board game. Built with Next.js with data stored in Mongodb. Hosted online here.

The base game is fully implemented. It would be nice to one day add the advanced city plans, roundabouts, and support for expert rules.

To run locally

  • npm install
  • add MONGODB_URI=<MongoDB URI here> to a .env.local file at project root
  • npm run dev

How it works

  • Game state (what turn it is, what cards are drawn, etc.) and Player state (player board, name, etc.) are stored in MongoDB.
  • The app queries game/player state on game load, and stores them in a reducer which is accessed throughout the app via React context.
  • Client manages state transitions and enforces legal moves by the player. It then submits that to the API. The API trusts that the client is a good actor, because who would cheat in a friendly board game :)
  • Client polls API until every player has finished the current turn. Repeat forever until game ends.