Skip to content

arcadekitPrimitives for browser games

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.

Install ​

bash
pnpm add arcadekit effect

effect (~4.1) is the one required peer dependency. The others are optional: install the ones the entries you import need.

PeerRangeNeeded by
three^0.187arcadekit/render-three
@types/three^0.187arcadekit/render-three, for its types (a dev dependency)
foldkit~0.170arcadekit/foldkit
@effect/platform-browser~4.1arcadekit/save/browser, and Foldkit itself
@cloudflare/workers-types^5arcadekit/net/worker, 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.

Entries ​

Each entry's README has an example. An entry imports only the entries under "Uses".

EntryWhat it gives youUses
arcadekit/coreFixedStepClock, seeded makeRng, struct-of-arrays pools, SpatialGrid, EventBuffer. No DOM and no Effect
arcadekit/inputInputController: keyboard, gamepad, touch-drag and swipes mapped to named axes and buttons. No EffectDOM
arcadekit/contentloadContent and makeContentLoader: load files, validate them with an Effect Schema, cache the first successEffect
arcadekit/content/browserfetchJsonSourceEffect, DOM
arcadekit/savemakeSaveStore: a game's records by id under one versioned keyEffect
arcadekit/save/browserBrowserSaveStorage: localStorage, or memory if the browser refusesEffect, @effect/platform-browser, DOM
arcadekit/audioAudioSystem, the Audio service with SilentAudioLayer, and makeAudioSettingsStoreEffect
arcadekit/audio/browserBrowserAudioLayer (Web Audio)Effect, DOM
arcadekit/render-threeStage, MeshInstances, camera helpers, and pixel-art sprites: loadSpriteSheet, InstancedSprites, PixelCameraEffect, Three.js, DOM
arcadekit/gameA game's declarations: Game.Event, Game.Command, Game.Rejection and Game.Simulation (the DOM-free rules), and Game.Loop, which steps one anywhereEffect, core, runtime
arcadekit/game/browserThe 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.combineViewsEffect, core, runtime, DOM
arcadekit/game/scenarioScenarios: given a run, after these steps and commands, it reported these events. Checks a simulation in a test, with no browserEffect, core, runtime
arcadekit/runtimeGameSimulation, the DOM-free half a game implements, and GameLoop, which steps one anywhere. PlayerInputs, the step input of a game with several players, and soloInputEffect, core
arcadekit/runtime/browserGameDefinition, makeGameEngine, makeEngineLoader, combineViewsEffect, core, DOM
arcadekit/runtime/testingmanualFrames: a frame source a test drives, to run an engine without a browser's frames
arcadekit/netLockstep 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 partsEffect, core, runtime
arcadekit/net/browsermakeCoopClient, 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 linksTransportEffect, core, runtime, DOM
arcadekit/net/testingfakeCoopRooms, manualTicker and testCoopGame: a Co-op client's rooms, ticker and game for tests, with no browserEffect, core, runtime, DOM types
arcadekit/net/signallingThe protocol a signalling server speaks, as Effect SchemasEffect
arcadekit/net/workerThe signalling worker, for Cloudflare: signallingRoom (a room's Durable Object class) and signallingWorker (the Worker's fetch)Effect, Cloudflare Workers
arcadekit/foldkitgameViewport, engineEntry, keyPresses, shortcutPressesEffect, 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.

Games built on it ​

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.

Released under the MIT License.