packages/compiler.compileWorld(world) owns, validates and freezes a deterministic manifest for the current primitive authoring format. The real Simulation installs its rows into the canonical store before publishing the runtime. Darkwind has 1,480 authored rows plus player.local; all places remain resident. The production simulation worker projects those rows through EcsPresentation, so doors, collected-item visibility and flag-dependent materials use the same entities that full checkpoints capture.
#Identity and assets
Each manifest includes an explicit {place, source, entity} table. For legacy world format 1, the entity ID is authored: followed by SHA-256 of the canonical tuple [world.id, place.id, object.id]. Display labels, release labels, array order, transforms and materials are excluded from identity. Different places can reuse a local source ID without collision. Changing the source ID or its source place changes this default identity. World format 2 instead requires a persisted entityId on every object. Authoring import and transactions materialize legacy IDs and preserve them through source renames and cross-place moves. Duplicate/invalid global identities reject; the compiler never guesses identity from geometry.
The existing PlaceBuilder fixture helper generates source IDs from a sequence unless callers supply options.id. Inserting a new builder call can therefore change later generated source IDs. The compiler stabilizes a given serialized source identity; it cannot infer persistent authorship from an edited sequence. Import once into a persisted authoring document to stabilize those existing IDs, then edit that document. Live runtime activation remains separate unfinished work.
The manifest signature includes compiler version primitive-world.2, the authored-world fingerprint, mapping hash and asset catalog hash. Primitive mesh IDs identify the four supported shapes. Material IDs are content hashes of owned values normalized to the existing six-decimal authored precision. The catalog stores those same normalized values, and sorted mappings/catalog keys make source order irrelevant to their hashes. Existing authored-world fingerprints remain unchanged.
Compilation rejects malformed material/conditional data, invalid transforms and identity collisions before returning anything. Bounds are 65,535 authored entities (one slot reserved for the player), 4,096 unique materials and 4,096 possible conditional writes. Runtime presentation still has its separate 4,096-instance scene budget, including procedural travelers. These are independent caps, not a promise that every maximally populated manifest fits one render view.
#Runtime and checkpoint boundaries
Installation creates PersistentIdentity, Transform, PlaceMembership, RenderMesh and MaterialRef in private construction batches. Only a complete runtime is returned. Shared/local door, inventory and flag changes produce one atomic ECS update for affected transforms and materials. Transform hierarchy validation and ordinary mutation journals remain active.
Compiled bindings require authored entities and their components to remain present, retain their source place and refer to known assets. Runtime render entities must also retain their spatial/material dependencies and the supported primitive shadow/LOD policy. Rejected edits leave the accepted store and journal untouched. Non-render spawned entities remain valid, and runtime render entities can be deleted atomically.
Native collision shapes still come from the authored physics definition. Existing door interactions update both physics and compiled render transforms. Arbitrary direct ECS transform writes do not rebuild collision shapes; general live editing, collider transactions and rollback are unfinished. The authored presence/place restrictions prevent unsupported structural edits from silently removing only one side of that binding. They are not a multiplayer authorization boundary.
Simulation checkpoint profile 4 seals the compiled signature alongside all ECS rows. Restore recompiles the supplied world, checks the exact signature and validates the complete candidate. Explicit profile-1/profile-2 migration adds authored rows without replacing retained player/spawned/native state. Profile-3 migration verifies the old compiled signature and preserves all authored rows, including edits, while binding compiler 2. Local player saves and relay room data keep their formats.
#Delivery and verification
The worker's acknowledged presentation channel allows one posted frame at a time, coalesces requests while main is busy, and samples current committed ECS state when acknowledged. Journal overflow and receiver recovery use a full baseline. Main keeps GPU ownership. Structured-clone messages are bounded in flight; transferable pools and binary transforms remain open.
tests/compiler.test.ts checks identity stability, immutable manifests, invalid content, actual Darkwind projection parity across all three places and shared states, compiled binding rejection and full native migration. The previous adapter supplies an independent expected scene. tests/presentation-delivery.test.ts exercises 10,000 blocked requests, exact latest-state catchup, stale acknowledgements, journal overflow, replacement-consumer baselines and failure/disposal. Browser acceptance holds the real worker acknowledgement, verifies one frame remains outstanding, then releases it and observes movement catchup; the full shared journey checks presentation and gameplay together.
This primitive compiler is an integrated foundation for milestone 7. Prefabs/overrides, source diagnostics, imported GLB/skeletons/textures/audio, collision build artifacts, incremental dependency invalidation, live content/state activation, build jobs and portable release packaging remain unfinished. No full roadmap milestone is completed by this increment.
#Integrated acceptance and cost
Clean source cbb9ec34f56b0d5d868dc99c2fdf21d6ff6144ef passed 129 headless checks and 22 pinned-Chromium browser scenarios. The player canvas itself must contain visible geometry; DOM text is excluded from that assertion. The welcome and shared-room captures retain the authored appearance. The separate Chrome 156 headless software configuration produced missing world graphics and one interaction failure; its cause is unproven and that run is not acceptance evidence for that configuration.
The simulation benchmark measures all 1,481 live entities at 0.187 ms p95 for 1,800 headless ticks after 300 warmups. The checkpoint benchmark measures a 950,285-byte complete envelope at 36.778 ms capture p95 and 315.186 ms independent restore p95 (five warmups, 30 samples). Both were collected after local tests stopped. These are scoped single-machine runs, not multiplayer capacity or universal speed guarantees. Full snapshots now include static authored rows; content/state separation, avoiding redundant startup work and off-frame scheduling remain necessary before using them at frequent network boundaries.
Reusable prefab compilation now resolves bounded inheritance and instance overrides ahead of this primitive compiler. Its independent source/build format preserves persisted bindings and produces world format 2 plus a dependency index. It does not change the primitive compiler version or existing world fingerprints.
#Authored route content
Format-4 worlds use route-world.4, retaining the format-3 model catalog and adding bounded platform definitions on visible box objects. The first waypoint must match the source pose. Compiled definitions are immutable and preserve authored identity; initial rows add the separate platform collision proxy, kinematic body, pending target and PlatformRoute time. The native adapter omits a fixed collider for these boxes, and the simulation owns their active kinematic binding. Historical format-1/2/3 compiler identities remain unchanged. See authored platform routes for time, obstruction, checkpoint and multiplayer limits.