Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 2.4 KB

DEVELOPERS.md

File metadata and controls

67 lines (48 loc) · 2.4 KB

Development

Getting started

Requires Node and Yarn.

git clone https://github.com/averycrespi/thinktank.git && cd thinktank
yarn        # Install dependencies
yarn start  # Run the client in development mode on localhost:3000
yarn test   # Launch the interactive test runner
yarn build  # Build the client for production
yarn serve  # Run the server on localhost:8000

Warning: When running on localhost, you may experience errors related to CORS.

To fix these errors, you can:

  1. Disable CORS in your browser (not recommended), or
  2. Run the server on a domain with the appropriate CORS headers.

Environment variables

See the Create React App docs for more information.

  • REACT_APP_URL: URL of the server. Default is "http://localhost:8000".
  • REACT_APP_PORT: Port that the server will be hosted on. Default is "8000".

Hosting your own instance

You can easily host your own instance with Netlify and DigitalOcean.

Make sure that you set REACT_APP_URL for the client.

Example configuration for proxying the server with Caddy:

# ./Caddyfile

# Note: This config was written for Caddy v1.

thinktank-server.example.com {
    # Allow requests from dev/prod clients.
    header / {
        Access-Control-Allow-Origin *
    }
    # Forward requests to the server at localhost:8000.
    proxy / 127.0.0.1:8000 {
        transparent
    }
}

Terminology

For general terminology (e.g. board, game, player), see the boardgame.io docs.

  • Cell: A location in the grid. Addressed by a 1D index or a 2D coordinate pair.
  • Enemy (piece): P is an enemy of Q iff P and Q have different owners.
  • Friendly (piece): P is friendly to Q iff P and Q have the same owner.
  • Grid: A 2D array of cells. Each cell may contain a piece.
  • Hand: A list of tokens that a player may place on the grid.
  • Home: The region that a player's base must stay within. Other pieces cannot enter.
  • Piece: A token that is owned by a player.
  • Spawn: The region that a player may place pieces inside. Surrounds a home.
  • Token: A game entity such as a blocker, upwards tank, or base.