2D worlds you can replay

LudoWeave Engine

A Python engine for small 2D worlds with verified replay, five presentation speeds and a headless comparison of complete replay histories.

Experimental alpha. Repeating world state does not guarantee identical graphics or sound across devices.

Clockwork Arena's unmodified offscreen frame at 60 ticks, with geometric game sprites on a dark background.
Actual capture / Clockwork Arena

Latest verified change · F01 + F03 / PR #266 ↗ · Merged

Compare verified histories and inspect them at five speeds

PR #265 adds 0.25x, 0.5x, 1x, 2x and 4x presentation speeds. PR #266 fully verifies both histories before reporting identical, different, invalid or incompatible. These are merged features, not a new packaged release.

Verified · F01 + F03 / PR #266 · 4f7d98bc1f55

Merged documentation closeout · PR #267

Remaining features require individual approval

F01 speed presets and F03 replay comparison are integrated. The 11 October documentation closeout clarifies that F02 and F04 through F10 remain proposals; it adds no runtime capability.

Reviewed main head · 0e5f378c825f

Read the source decision ↗

Source checked . Documentation and retained evidence review, not a new runtime test.

Read change evidence ↗

Professional relevance

Useful for designing state ownership, recovery and inspectable interfaces. These examples make failure behavior and authority explicit.

Explore the engineering background →

01 / Recorded experiment / 11 October 2026

Same recording. Different pace.

Inspect 180 saved Clockwork Arena ticks, then compare four retained outcomes. The browser draws recorded positions. It does not run the engine or change the histories.

different

Both 180-tick histories verify. After 60 matching batches, move.x differs at consumed input tick 60: +1 in the original, -1 in the variant. The state first changes at tick 61.

Original · tick 0
836509570019
Compared history · tick 0
836509570019

Teal: player · Orange: enemies · Cream: projectiles. Derived positions, rounded to five decimals. Hashes identify the full canonical state.

Canonical states match at this tick.

Playback starts paused. Loading retrieves 87 KB from this site.

Inspect this saved comparison report · JSON

Read all four results and download the evidence

One changed input: different

Both 180-tick histories verify. After 60 matching batches, move.x differs at consumed input tick 60: +1 in the original, -1 in the variant. The state first changes at tick 61.

Comparison report · JSON · Compared history · JSON

Different timeline label: identical

The canonical artifact hashes differ because the timeline label changes. The verified input and world histories are identical. A different artifact identity is not automatically a gameplay difference.

Comparison report · JSON · Compared history · JSON

Damaged final receipt: invalid

The variant has the same early input change, but its final post-state hash was deliberately damaged. Full verification fails. The comparator withholds the earlier divergence report.

Comparison report · JSON · Compared history · JSON

Different platform profile: incompatible

The variant declares a different platform profile. It cannot be verified by this composition. No gameplay difference is reported.

Comparison report · JSON · Compared history · JSON

Original history · JSON · Capture manifest and SHA-256 hashes · Five upstream speed summaries

Captured locally using Python 3.12.14 and the merged source at 4f7d98b. All five Null-renderer summaries match. Null playback is unpaced, so these runs do not measure window cadence or GPU output. The older engine-rendered images below retain their September provenance.

Read the source contract (opens in a new tab) ↗

How to find the first difference between two game replays →

In plain terms

Record a small game session, then replay it to check whether the same inputs produce the same world.

Why it matters

When a simulation behaves unexpectedly, replay helps trace what happened. People, tests and AI tools use the same rules to change the world.

Follow the example, step by step
  1. Record a session

    Save the inputs and world changes from the Clockwork Arena example.

  2. Replay the record

    Run the recording again without needing a display or audio device.

  3. Compare the result

    Check the recorded world state before optionally displaying the replay.

Decision and trade-off

Keep device pacing outside canonical state

Documented approach

The optional audio adapter is explicitly pumped by its owning application. It uses blocking output without Python stream or completion callbacks, while Null remains the default.

Alternative and scope

The earlier provider restriction admitted only Null audio. This decision adds optional device output without introducing a worker or a process-global mixer; background mixing and richer formats remain deferred.

Cost of the choice

Writes may block or underrun, and there is no hard real-time guarantee. Device latency and completion do not control canonical state or replay.

What the evidence establishes

ADR-0034 records local qualification with hosted qualification pending at this snapshot. The captured example below uses Null audio and therefore adds no listening or device-audio evidence.

Read the decision source (opens in a new tab)
Source-backed system map

Consumed input becomes replay-owned evidence

The play loop records consumed snapshots and receipted transactions. A fresh headless process verifies the artifact; optional rendering and audio remain presentation layers.

Consumed input becomes replay-owned evidencePLAY LOOP: Consumed input snapshots. Receipted world transactions. RECORDING ARTIFACT: Owned inputs and checkpoints. Bounded buffering; save after close. HEADLESS VERIFICATION: Fresh process; artifact-owned input. World hash and checkpoint checks. These are selected boundaries, not a sequential execution trace.
Selected documented boundaries, illustrated here; not a runtime screenshot or complete execution trace. Read the diagram source (opens in a new tab)
01

Inspect playback without changing the recording

Five speed presets scale windowed presentation deadlines without changing simulation history. Null and offscreen playback remain unpaced. The retained local fixture produces identical summaries for all five presets, which checks results rather than window cadence.

With controls enabled, Space pauses or resumes and Right Arrow advances one tick while paused. Paused Left Arrow rewinds one tick; Home returns to the initial tick. Held keys do not repeat. Controlled playback requires a window and one tick per recorded batch.

Seeking first verifies the entire artifact, then reconstructs a fresh world from the initial snapshot to the selected boundary. Resume starts fresh presentation deadlines, so paused or skipped time does not create a catch-up burst. Reconstruction is synchronous within the 3,600-tick/batch viewer bound; no seek-latency guarantee is made.

M244 displays the current/final tick, playback state and contextual hints using built-in diagnostic glyphs. The panel can be hidden without changing replay hashes or summaries. Very small windows reduce legibility, the panel overlays the game view, and playback still exits at completion. The portfolio's older captured frames are not evidence of the new panel.

02

Find the first meaningful replay difference

The headless comparator verifies both complete histories independently, then walks fresh sessions together. It compares state, checkpoint presence, length, transaction tick ranges, consumed inputs and transaction content. Presentation-only timeline labels are ignored; even a late invalid receipt prevents an earlier divergence report.

Inputs are bounded to 64 MiB per file and 3,600 ticks and batches. Difference detail has a global 128-node budget and 128-character text limits, with explicit truncation. This bounds the public report, not internal comparison latency. Hashes are not author signatures and a reported boundary is not a root-cause diagnosis.

03

One canonical world for humans and agents

LudoWeave gives its application runner, command line, tests, rendering adapters, and agent interface the same authoritative world and command contracts. Deterministic clocks, stable entity identity, immutable schemas, and explicit ownership make state changes inspectable rather than implicit.

  • Atomic command transactions with dry-run, optimistic hashes, semantic diffs, and receipts
  • Snapshots, checkpoints, replay-owned input history, and parent-referenced timeline branches
  • Backend-neutral rendering with an optional pinned wgpu adapter and offscreen capture
  • Clockwork Arena recording, headless verification and hash-checked presentation
04

Agent control is a capability boundary

The typed agent service declares capabilities, quotas, redaction, and serialized mutation. Its local MCP adapter uses standard input and output, opens no network listener, and remains read-only unless the trusted composition root explicitly enables writes.

The Agent World Builder example closes the loop from typed creation and validation through capture, query, adjustment, diff, telemetry, tests, and replay evidence.

05

Experimental by explicit contract

The repository records the current baseline as a community-alpha release candidate and marks every Python API and wire format experimental. Packaging, CI, checksums, an SPDX SBOM, installed-artifact smoke tests, and a pinned provenance workflow support evaluation without implying production stability.

Optional sample audio is available with blocking presentation pacing and explicit resource ownership. This does not imply general production audio support: the current README keeps network transports, a visual editor, 3D, executable plugins and native acceleration deferred. Device playback is optional presentation, not a stable production-audio guarantee.

Captured example · 2026-09-09

Clockwork Arena: a captured local run

Two unretouched offscreen frames from the pinned example, captured at 60 and 180 ticks with Null audio. A second 180-tick run matched both the canonical state hash and captured pixel hash in this environment.

Windows · Python 3.12.13 · wgpu 0.32.0 · AMD Radeon(TM) Graphics · Vulkan · 960 × 540

Compare the captured frames ↑

This verifies a bounded local example, not device-audio playback, interactive input, performance, cross-device determinism or production readiness.

Read commands, environment and hash results

Captured from the Apache-2.0 LudoWeave example. Read the source license and attribution notice.

Interactive illustration

Inspect a replay boundary

An illustrative one-dimensional world: each consumed input moves a position by −1, 0 or +1. Step through the saved inputs, then change one input to see the first checkpoint disagreement. This is a teaching model, not LudoWeave execution or a captured game recording.

Inspect the saved example

Initial position: 0. Inputs: 1, 1, 0, -1, 1, 0. Checkpoints: 1, 2, 2, 1, 2, 2.

Replay applies the same inputs to the same starting state and compares each position. This model uses integer positions, not the engine’s world hashes.

Tick 0 of 6 · Position 0. Ready to inspect.

Matching state does not establish who supplied an input, identical pixels or device-audio behavior.

Read the pinned replay contract ↗ (opens in a new tab)
Continue the engineering story
Engineering history
Source snapshot

Inspect the checked source

Evidence reviewed . Individual decisions and captured examples retain their own source revisions and limitations.

Read the checked README (opens in a new tab)

Technical footprint

Repository-described tools and interfaces, not a proficiency rating.

  • Python
  • ECS
  • wgpu
  • MCP