pureboard

pureboard

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

A library for creating multiplayer boardgames

Overview

Do you want to implement multiplayer turn based game, but replication and visualization is a headache? Worry not, just:

  1. Implement game as pure functions mutating a state
  2. Create a React (or React Fiber if you want 3D) component to display that
  3. Let pureboard handle the rest - game is now playable online
npm install pureboard

pureboard is a library that allows for easy implementation of multiplayer games, by replicating actions on a state. It's designed for boardgame-like games, but can be used for other projects. It uses zustand for state management, so replicated state on client can be easily used in a React project.

Players are sending actions that can mutate server game state. First, server tries to apply the action on it's state, and if it's valid, it get's send to all players.

Usage

API

See example directory for example of a online multiplayer connect4 game.

  1. Run npm install in root directory
  2. Run npm install in the example directory
  3. Run npm run dev in the example directory
  4. Open http://localhost:3000 in your browser