zozo123 · C → Rust CRAFT

The playable product of Michael Fogleman’s Craft rewritten in Rust (winit + wgpu + Tokio). Not an all-Rust repo — the original C client and Python server stay in-tree as reference and the golden-parity oracle. This site is the invoice, DAG, sandbox map, and e2e demo for the zozo123/Craft fork.

Budget model

Token-primary accounting

The rewrite ran under a hard cap of $120. Cost is token-primary: agent work is estimated from tokens at $0.02 per 1k tokens, then converted to USD. The live append-only ledger is rust/tools/spend-ledger.json (reporter: cost_report.py).

  • What costs money: Cursor agent coding turns (plan, port, fix, docs).
  • What is $0 tokens: GitHub Actions rust-e2e, islo job runs, snapshot bakes, sandboxes that only compile/test/record.
  • Hard stop: refuse entries once cumulative ≥ $120; no nested agents inside islo VMs (API unreachable / phantom key).
  • Execution model: Cursor writes Rust · islo runs deterministic gates · GH Actions is the public e2e mirror.

Trace narrative: COST_TRACE.md · board: EXECUTION.md.

MetricValue
Cap$120.00
Spent$112.95 (94%)
Remaining$7.05
Tokens (est.)~3.20M
Pricing prior$0.02 / 1k tokens
Gatesislo + GH = $0 agent tokens

Invoice

Workshop packing slip

Line items match the ledger waves. Status stamps the work as merged to zozo123/Craft master within budget.

INV-CRAFT-RUST-001

Bill to zozo123 / Craft fork
From C (GLFW/OpenGL + Python server) → Rust (wgpu/Tokio)
Status MERGED · master · PRs #1#3 (+ Pages)

PAID IN BUDGET
Cap $120.00
$112.95
Remain $7.05 · 94% · ~3.20M tok
WaveAmount
Planning + DAG + cost model$8.00
Oracle harness (C goldens)$1.50
Core port + finish (parity)$5.00
Matrix + cube$3.50
Mesh + craft-sim$2.50
Physics$3.00
DAG reopt$0.50
wgpu walkable client$9.00
craft-db + protocol$5.00
craft-server (Tokio)$5.00
Net e2e$6.00
Ambient occlusion$5.00
Online engine + 2-client e2e$14.00
Product e2e (stream + HUD + peers)$16.00
Clippy 1.97 fix$1.20
Demo recorder + lavapipe CI$16.00
PR#1 open / verify / merge$1.50
Rust-first README$3.00
README price tag + DAG$1.50
GitHub Pages (invoice + explanations)$2.50
SW factory lessons (islo + Incredibuild)$1.50
islo snapshots + GH gates$0.00
YC post + repo-composition honesty pass$1.70
Total$112.95
Terms: hard stop at $120 · no nested agents in islo VMs
Artifacts: docs/demo.{mp4,gif} · workflow rust-e2e + pages

Execution graph

Cleared DAG

The rewrite was sequenced as a software-factory DAG: each node had a concrete gate (unit/parity test, net e2e, islo bake, or GH Actions). Later nodes were deliberately re-ordered so a walkable / networked client shipped before polish (HUD/AO) — then AO, HUD, peers, demo, and docs closed the finish line.

flowchart LR
  A[A_oracle] --> B[B_matrix_cube]
  B --> C[C_mesh]
  C --> D[D_physics]
  D --> E[E_client]
  D --> H[H_db]
  D --> I[I_proto]
  H --> J[J_server]
  I --> J
  C --> G[G_AO]
  E --> G
  G --> S[S_full_stream]
  J --> S
  E --> F[F_HUD]
  S --> K[K_peers]
  F --> K
  K --> L[L_full_v2]
  L --> M[M_demo]
  M --> N[N_README]
  N --> P[P_pages]
          
NodeWhat it deliveredGate
A oracleC dumpers → goldensmake -C oracle golden + Rust parity
B–Dmatrix, cube, mesh, physicscrate tests / mesh_e2e
E clientwalkable wgpu window--smoke
H–Jdb, protocol, Tokio servere2e_net
G AOneighborhood occlusionao_sum + mesh-fanout
S full streamchunk >2000 blocksnet-smoke / net-play
F / KHUD, daylight, hotbar, peers--connect + online_e2e
L full-v2product mp e2e snapshotislo craft-mp-e2e
M demolavapipe offscreen videoGH demo job + docs/
N / PREADME + this Pages invoicePR merge + pages workflow

Source of truth: rust/EXECUTION.md.

islo.dev sandboxes

Snapshots & jobs used

islo VMs were the deterministic factory floor: restore a snapshot, pull rust-rewrite, run gates, optionally bake the next snapshot. Agent tokens inside those VMs = 0. Nested Cursor agents were blocked (unreachable API / phantom key) — Cursor wrote code; islo only compiled, tested, and recorded.

SnapshotRole~Size
craft-base-v1Oracle / base toolchain after C goldens job238 MB
craft-mesh-v1Mesh / core gate bake261 MB
craft-sim-v1craft-sim mesh stats path277 MB
craft-full-v0First full client+server vertical1.0 GB
craft-ao-v1AO mesh-grid fanout bake1.0 GB
craft-full-v1Multiplayer engine e2e1.2 GB
craft-full-v2Product finish (full stream + HUD + peers)1.2 GB
Job / sandbox patternWhat it provedJob path
craft-oracle C oracle goldens on a fresh VM jobs/craft-oracle
craft-gate fmt / clippy / parity gate bake jobs/craft-gate
craft-mesh-fanout AO mesh-grid signals → craft-ao-v1 jobs/craft-mesh-fanout
craft-mp-e2e 2-client online_e2e + live net-play → craft-full-v2 jobs/craft-mp-e2e
craft-demo-rec (ad-hoc) Debian12 + lavapipe + ffmpeg → demo.mp4/gif islo use · software Vulkan
craft-*-regress (ad-hoc) rust-1.97 fmt/clippy/test with goldens islo use · craft-full-v1/v2

Software factory

How we ran it — what worked / less so

This rewrite was treated as a software factory: a DAG of small work units, each with a deterministic gate, a budget line, and a clear handoff. An agent (Cursor) writes code; the floor (islo.dev sandboxes + GitHub Actions) compiles, tests, bakes snapshots, and records demos at $0 agent tokens. Build-acceleration platforms like Incredibuild sit in the same factory mindset — distribute expensive compile/link work — and are linked here as part of that ecosystem; this particular run’s gates were carried by islo VMs + GH runners rather than an Incredibuild grid.

RoleToolIn this project
Agent / writer Cursor Ports, fixes, docs, ledger — the only token-costing layer
Sandbox floor islo.dev Snapshot ladder craft-base-v1craft-full-v2, job TOMLs, parallel signals, lavapipe demo record
Public e2e mirror GitHub Actions rust-e2e parity + demo artifact; pages deploy
Distributed builds Incredibuild Linked as SW-factory build acceleration; not wired into this Cargo/islo path

What worked

  • DAG + budget ledger — forced finish-line clarity; token-primary accounting kept gates free and spend visible.
  • islo snapshots — restore → pull → gate → bake meant fast, repeatable e2e without rebuilding the world each time.
  • Parallel sandboxes for signals — mesh fanout, mp-e2e, regress, net-play ran side by side; cheap retries.
  • C oracle goldens — bit-parity against the original sources caught port drift early.
  • Split of labor — Cursor writes; islo/GH only run. Nested agents inside VMs were correctly abandoned.
  • Headless lavapipe demo — proved the full stack without a display and gave a shareable artifact for Pages/README.
  • Reordering the DAG — ship walkable + net before perfect AO/HUD, then close polish — got to a playable product faster.

What worked less

  • Nested agents in isloapi.cursor.com unreachable from job sandboxes / phantom API key. Factory rule became: no agents in the VM.
  • Toolchain skew — rust-1.97 clippy caught unnecessary_unwrap that local 1.92 / GH stable missed; need the strictest gate in the loop.
  • Silent set -e failures — early sandbox scripts exited 101 with no logs; had to re-run with captured RCs.
  • Snapshot name collisions — rebaking craft-full-v2 failed until the stale snapshot was deleted.
  • Latent GPU uniform stride — interactive path never hit CI until offscreen demo; WGSL 112B vs Rust 96B.
  • Ad-hoc multi-client stress — 4× --net-play editing the same block hung; 2-client mp-e2e remained the trusted gate.
  • Incredibuild not on the critical path — Cargo builds here were local/islo/GH single-machine; an IncrediBuild grid would matter more for heavier CMake/MSVC or huge workspaces than this Rust crate set.

Bottom line: the SW factory worked when the graph was honest, gates were deterministic and free, and agents stayed on the write side of the line. Links: islo.dev · incredibuild.com · zozo123/Craft.

Public e2e

GitHub Actions

Workflow rust-e2e mirrors the factory gates on every push/PR:

  • parity: C oracle goldens → fmt → clippy -D warningscargo test --all → smoke → net e2e (online_e2e, e2e_net, --net-smoke, --net-play)
  • demo: install lavapipe + ffmpeg → headless --demo → upload craft-rust-demo artifact
  • pages: deploy this docs/ site to zozo123.github.io/Craft (pages.yml)

Credits

Attribution

Original Craft

Game design and C implementation by Michael Foglemangithub.com/fogleman/Craft. Terrain, protocol ideas, AO approach, and the playable feel remain his.

This rewrite

Rust port, Tokio server, wgpu client, islo factory DAG, lavapipe demo, and this Pages invoice: fork zozo123/Craft. Execution model: Cursor agent writes Rust; islo.dev sandboxes + GitHub Actions run deterministic e2e gates ($0 agent tokens).

Software factory

Deterministic gates on islo.dev sandboxes and GitHub Actions; agent writes stay in Cursor. Incredibuild is part of the same accelerated-build / factory ecosystem (not wired into this Cargo path). Lessons: SW factory — what worked / less so.

Stack

Rust · winit · wgpu / WGSL · Tokio · SQLite · Mesa lavapipe · ffmpeg · GitHub Actions · islo.dev snapshots · Incredibuild (ecosystem).