Parent
Part of #898.
Depends on
#900.
Goal
Replace duplicated chunk-local lighting with one authoritative world-level system whose output is cross-chunk, deterministic, mutation-safe, and compatible with existing worlds.
Scope
- Introduce a
WorldLightingEngine used by generation, loading, and runtime mutations.
- Centralize block opacity, light transmission/attenuation, and RGB emission rules.
- Seed direct skylight columns and RGB emitters, then propagate in all six directions across loaded chunk boundaries.
- Add proper addition/removal queues that follow the full light influence rather than a one-chunk edit box.
- Reconcile light frontiers when a chunk loads, generates, or gains a neighbor; results must not depend on load order.
- Use one water/translucent attenuation rule for generation and runtime updates.
- Remove
entrance_bounce and entrance_dir; ordinary propagated skylight becomes the source of cave-entrance illumination.
- Add chunk content/light revisions or immutable meshing snapshots. Publish a worker mesh only when its captured revision still matches.
- Add a lighting algorithm version to world metadata. Existing worlds keep blocks but ignore stale derived light and relight asynchronously on load.
- Keep chunks non-renderable until the required local light frontier is stable; avoid a one-frame black or fullbright flash.
- Keep GPU meshing disabled until it can consume the same light data and vertex contract.
Acceptance criteria
Required tests
- Cross-chunk skylight in all four horizontal directions and corners.
- Cross-chunk RGB addition and removal from local coordinates 0 through 15.
- Upward/downward propagation and enclosed-cave behavior.
- Load-order permutation tests.
- Relight-on-load migration fixture.
- Mutation-versus-meshing revision rejection.
Verification
nix develop --command zig fmt modules/world-core/src modules/world-runtime/src modules/world-meshing/src modules/world-persistence/src modules/worldgen-common/src
nix develop --command zig build test
nix develop --command zig build -Dskip-present
nix develop --command zig build run -Dskip-present -Dauto-world=normal -Dstartup-diagnostic-seconds=5
Parent
Part of #898.
Depends on
#900.
Goal
Replace duplicated chunk-local lighting with one authoritative world-level system whose output is cross-chunk, deterministic, mutation-safe, and compatible with existing worlds.
Scope
WorldLightingEngineused by generation, loading, and runtime mutations.entrance_bounceandentrance_dir; ordinary propagated skylight becomes the source of cave-entrance illumination.Acceptance criteria
Required tests
Verification
nix develop --command zig fmt modules/world-core/src modules/world-runtime/src modules/world-meshing/src modules/world-persistence/src modules/worldgen-common/src nix develop --command zig build test nix develop --command zig build -Dskip-present nix develop --command zig build run -Dskip-present -Dauto-world=normal -Dstartup-diagnostic-seconds=5