digital-boardgame-framework
v0.9.1
Published
Foundation library for turn-based digital boardgames: deterministic engine plumbing, async multiplayer, agent-friendly bug triage.
Downloads
1,207
Maintainers
Readme
Digital Boardgame Framework
Foundation library for turn-based digital boardgames. Provides the small set of plumbing that converged across multiple boardgame ports (Innovation, Impulse, Star Wars Rebellion):
- Deterministic seeded RNG (serializable)
- Turn-boundary state codec
- Structured append-only log (pause/resume for AI rollouts)
- Pause/resume effect context (the
ChoiceRequestprotocol) IPlayerController+RandomAI+ScriptedControllerGameServer— async multiplayer (turn-based, per-player redacted views, shareable URLs)- Bug report transport — agent-friendly triage endpoints, public-read snapshots
- Storage adapters (filesystem for dev, Supabase for production)
- Email notifications via Resend
- React
useGamehook
The library is deliberately small. Game-specific concerns (phase machine, card registry, combat sub-machine, UI) are NOT here — they're recipes in docs/decisions.md instead.
Quick start
npm install
npm run build
npm testTo hook an existing game in, see docs/integration-guide.md. The smallest possible working integration is in examples/tic-tac-toe/.
What you implement per game
Four functions. That's it.
interface GameAdapter<State, Action, PlayerId> {
applyAction(state: State, action: Action, actor: PlayerId): State;
legalActions(state: State, actor: PlayerId): Action[];
currentActor(state: State): PlayerId | null;
viewFor(state: State, viewer: PlayerId): State; // redact opponent hidden info
}The framework handles everything else: persistence, turn validation, per-player views, snapshots, bug reports, email notifications.
Repo layout
src/
core/ Pure modules (rng, codec, log, effects, adapter, controller)
server/ GameServer, SnapshotStore, store adapters, notifiers
client/ React useGame hook
supabase/
schema.sql Apply this to your Supabase project
examples/
tic-tac-toe/ Minimal working integration
docs/
integration-guide.md How to hook an existing game in
adapter-spec.md The GameAdapter interface in detail
decisions.md Recipes for things NOT in the libraryStatus
v0.1 — usable but unproven. No game has been ported yet; the integration guide is theory plus the tic-tac-toe demo. Treat the API as not-yet-stable.
