Ritmo
The all-in-one toolkit for agent-first game development.
A type-safe ECS runtime for TypeScript. You direct the mechanics and the feel, and your coding agent writes the game. Wrong code does not compile and the error names the fix.
pnpm add @typeonce/ritmo

Why Ritmo
Errors that name the fix
Systems receive only the access they declare. When the agent gets it wrong, the compiler says what to change.
Headless by default
Devtools sessions run the simulation without a screen and show lints, invariants, and why each value changed.
Your renderer, your loop
Ritmo runs the simulation. Drawing stays in your game, with bridges for Pixi and any node-based renderer.
Everything around the core
Input and local multiplayer, rollback and lockstep netcode, and agent tools for pixel art, sound, and music.
A first look
import { Clock, Descriptor, Schema } from "@typeonce/ritmo"
type Vec = { x: number; y: number }
// Define the world once: components, resources, and the fixed step.
const step = Clock.hz(60)
const Time = Clock.resource("Example/Time", step)
const Position = Descriptor.Component<Vec>()("Example/Position")
const Velocity = Descriptor.Component<Vec>()("Example/Velocity")
// Bind the schema to its game-facing APIs.
const Game = Schema.bind(
Schema.fragment({
components: { Position, Velocity },
resources: { Time }
})
)
const AdvanceTime = Clock.system(Game, {
name: "Example/AdvanceTime",
resource: Time
})
// Systems receive only the access they declare.
const Move = Game.System(
"Example/Move",
{
queries: {
moving: Game.Query({
selection: {
position: Game.Query.write(Position),
velocity: Game.Query.read(Velocity)
}
})
},
resources: { time: Game.System.readResource(Time) }
},
({ queries, resources }) => {
const { dt } = resources.time.get()
for (const match of queries.moving.each()) {
const position = match.data.position.get()
const velocity = match.data.velocity.get()
match.data.position.set({
x: position.x + velocity.x * dt,
y: position.y + velocity.y * dt
})
}
}
)
// Starting can fail (the clock is a validated resource),
// and so can a tick: both return a Result.
const made = Game.Runtime.make({
services: Game.Runtime.services(),
resources: { Time: Clock.start(step) }
})
if (made.ok) {
const runtime = made.value
const ticked = runtime.tick(Game.Schedule(AdvanceTime, Move))
if (!ticked.ok) console.error(ticked.error)
}Packages
- @typeonce/ritmoThe type-safe ECS runtime
- @typeonce/ritmo-browserFixed-step loop, keyboard, gamepad, pointer, and touch input
- @typeonce/ritmo-renderRenderer-agnostic entity-to-node mirroring
- @typeonce/ritmo-pixiPixi container adapter
- @typeonce/ritmo-mathVectors, angles, swept collision, and flow fields
- @typeonce/ritmo-netcodeRollback and lockstep sessions over any transport
- @typeonce/ritmo-devtoolsHeadless sessions, traces, replays, and fuzzing
- @typeonce/ritmo-toolsPixel art, animation sheets, sound, and music for agents
- @typeonce/oxlint-plugin-ritmoLint rules for deterministic simulation code