🧩 HyperToken

A game engine where the entire state is a CRDT.

Deterministic replay. Serverless multiplayer. Forkable worlds. Built on Automerge, with Gym/PettingZoo interfaces so any game doubles as a training environment.

Play Blackjack β†’ Play Cuttle β†’

What This Gets You

Serverless multiplayerCRDTs sync state across peers without a server
Perfect replayEvery action recorded with actor and timestamp
Forkable worldsSnapshot state, explore alternatives, compare outcomes
AI training environmentsGym/PettingZoo interfaces out of the box
Offline-firstPeers diverge safely, converge mathematically
Traditional Engine:   Server decides β†’ clients accept β†’ monthly hosting bill
Blockchain Engine:   Consensus decides β†’ everyone pays gas β†’ wait 15 seconds
HyperToken:          CRDTs merge β†’ everyone agrees β†’ zero infrastructure

What You Can Build

Card Games

Blackjack, Poker, Cuttle, custom TCGs. Tokens compose with provenance tracking.

Strategy Games

Game theory simulations, tournaments, agent competitions.

Multiplayer Worlds

P2P sync, no servers, games that outlive their creators.

Training Environments

Any game is automatically a Gym environment. Multi-agent via PettingZoo.


Try It

git clone https://github.com/flammafex/hypertoken
cd hypertoken
npm install && npm run build
npm run blackjack
# Multiplayer
npm run blackjack:server   # Terminal 1: Host
npm run blackjack:client   # Terminal 2: Join
# AI training bridge
npx hypertoken bridge --env blackjack --port 9999

How It Works

Tokens Compose With Provenance

const enchantedSword = engine.dispatch("token:merge", { 
  tokens: [sword, fireEnchantment]
});
// enchantedSword._mergedFrom = [sword.id, fireEnchantment.id]

State Syncs Automatically

const host = new Engine();
host.connect("ws://relay.local:8080");

const client = new Engine();  
client.connect("ws://relay.local:8080");
// Both make changes β†’ CRDTs merge β†’ identical final state

Any Game Is a Training Environment

from hypertoken import HyperTokenAECEnv

env = HyperTokenAECEnv("ws://localhost:9999")
env.reset(seed=42)

for agent in env.agent_iter():
    obs, reward, term, trunc, info = env.last()
    action = policy(obs) if not (term or trunc) else None
    env.step(action)

What's Inside


Status

βœ… Core engine complete
βœ… CRDT synchronization
βœ… P2P networking
βœ… Python bridge for RL
βœ… WASM acceleration
βœ… Docker deployment
πŸ”„ Documentation in progress

Get Involved

GitHub β€” Source, issues, PRs
Documentation β€” Guides and API reference
Cuttle β€” Play the demo