The same run on every peer
A fixed-step clock, a seeded random generator and pools that allocate nothing per step. The same seed and inputs give the same run.
arcadekit/core
A deterministic simulation, a game loop, input, saves, audio, pixel art and lockstep co-op. One package, on Effect, Foldkit and Three.js.
arcadekit is one package of primitives for browser games made with Effect 4, Foldkit and Three.js. Each of its entries has a page here.
Status: alpha. Interfaces and stored data change whenever that improves the code, with no compatibility layers. Each release's changelog says what broke.
pnpm add arcadekit effecteffect (~4.1) is the one required peer dependency. The others are optional: install the ones the entries you import need.
| Peer | Range | Needed by |
|---|---|---|
three | ^0.187 | arcadekit/ |
@types/ | ^0.187 | arcadekit/, for its types (a dev dependency) |
foldkit | ~0.170 | arcadekit/ |
@effect/ | ~4.1 | arcadekit/, and Foldkit itself |
@cloudflare/ | ^5 | arcadekit/, for the types of Cloudflare's runtime (a dev dependency) |
They are peers so your app has one copy of each: Effect services and Three.js instanceof checks need that.
The package is ESM only and has no root export: import an entry, such as arcadekit/core. It needs TypeScript 5.4 or later, and Node 22 or later for tooling. TypeScript 5.4 to 5.6 need skipLibCheck, since Effect 4.1's own type files need 5.7.
While below 1.0, a minor version (0.3 to 0.4) may break the interface, and its changelog says how; a patch doesn't. Use a ~ range to take only patches.
Each entry's README has an example. An entry imports only the entries under "Uses".
| Entry | What it gives you | Uses |
|---|---|---|
arcadekit/ | FixedStepClock, seeded makeRng, struct-of-arrays pools, SpatialGrid, EventBuffer. No DOM and no Effect | |
arcadekit/ | InputController: keyboard, gamepad, touch-drag and swipes mapped to named axes and buttons. No Effect | DOM |
arcadekit/ | loadContent and makeContentLoader: load files, validate them with an Effect Schema, cache the first success | Effect |
arcadekit/ | fetchJsonSource | Effect, DOM |
arcadekit/ | makeSaveStore: a game's records by id under one versioned key | Effect |
arcadekit/ | BrowserSaveStorage: localStorage, or memory if the browser refuses | Effect, @effect/, DOM |
arcadekit/ | AudioSystem, the Audio service with SilentAudioLayer, and makeAudioSettingsStore | Effect |
arcadekit/ | BrowserAudioLayer (Web Audio) | Effect, DOM |
arcadekit/ | Stage, MeshInstances, camera helpers, and pixel-art sprites: loadSpriteSheet, InstancedSprites, PixelCamera | Effect, Three.js, DOM |
arcadekit/ | A game's declarations: Game.Event, Game.Command, Game.Rejection and Game.Simulation (the DOM-free rules), and Game.Loop, which steps one anywhere | Effect, core, runtime |
arcadekit/ | The same, plus Game.Engine: a simulation with the view and input that draw it and read its input, as a service an app drives. Game.Frames, Game.frameLoop, Game.combineViews | Effect, core, runtime, DOM |
arcadekit/ | Scenarios: given a run, after these steps and commands, it reported these events. Checks a simulation in a test, with no browser | Effect, core, runtime |
arcadekit/ | GameSimulation, the DOM-free half a game implements, and GameLoop, which steps one anywhere. PlayerInputs, the step input of a game with several players, and soloInput | Effect, core |
arcadekit/ | GameDefinition, makeGameEngine, makeEngineLoader, combineViews | Effect, core, DOM |
arcadekit/ | manualFrames: a frame source a test drives, to run an engine without a browser's frames | |
arcadekit/ | Lockstep multiplayer for 2 to 4 peers over a Transport, with an in-memory network for tests. combinePlayerInputs makes PlayerInputs from its confirmed steps. CoopRules, a Co-op game's lockstep parts | Effect, core, runtime |
arcadekit/ | makeCoopClient, the Co-op client: one player's lobby, run and drawing for a CoopGame, over browserCoopRooms. Under it, hostRoom and joinRoom (join code to WebRTC links) and linksTransport | Effect, core, runtime, DOM |
arcadekit/ | fakeCoopRooms, manualTicker and testCoopGame: a Co-op client's rooms, ticker and game for tests, with no browser | Effect, core, runtime, DOM types |
arcadekit/ | The protocol a signalling server speaks, as Effect Schemas | Effect |
arcadekit/ | The signalling worker, for Cloudflare: signallingRoom (a room's Durable Object class) and signallingWorker (the Worker's fetch) | Effect, Cloudflare Workers |
arcadekit/ | gameViewport, engineEntry, keyPresses, shortcutPresses | Effect, Foldkit, runtime, DOM |
The source is in the arcadekit repository, with two genre packages and two demo games built on these entries. ADR-0018 records why the kit is one package.
packages/survivors.packages/push-puzzle.The demos don't publish: copy from them. The repository's README says how to make a new game, in an existing genre or a new one.