aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 27b0b66b5244d2d6d8e16a900ceaccc0b5bc38ea
parent 9cbfef5b96e43b0415a8628b58fccb33941f7edb
Author: anon <anon@example.com>
Date:   Tue, 27 Oct 2026 18:34:54 +0000

Normalize unavailable tileset heights during mission preparation

Diffstat:
MTODO.md | 5+++--
Mdocs/mission-interiors.md | 43+++++++++++++++++++++++++++++++++++++++----
Mserver/mission_scene.go | 7+++++++
Mserver/mission_scene_test.go | 40++++++++++++++++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 6 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1542,8 +1542,9 @@ client rendering fixes and checks are in [nano damage](docs/nano-damage.md). reciprocal links and standing floor height. Route this backend through live movement and enforce room transitions before enabling private entry; this verification does not establish native equivalence for every query or slope. - Resolve why library330 tileset types0/1 load as zero in WASM despite archived - height words65535; preserve raw data until the producer is established. + The original generated-world factory clears tileset heights >=6553.5 after + decoding. The scene builder now applies that shared rule; ordinary low + heights at any tileset index and the raw archive values remain intact. This is not usable entry, recovered style selection or a private-world boundary. See [mission interiors](docs/mission-interiors.md) and [doors](docs/mission-doors.md). - [ ] [P1] Complete mission-key destination metadata and duplication. Check: diff --git a/docs/mission-interiors.md b/docs/mission-interiors.md @@ -293,8 +293,9 @@ archived uint16 height words65535. The live preview serves exactly the original 6032-byte map330 record (SHA256 `eb749f11b9a0322b9da329b5628cc7739702d7f297ebb2244acb1d9403969e9c`), so stale asset data does not explain the discrepancy. The decoder retains the -archived values; recover the producer of the runtime zeros before using these -heights for room admission. No client patch or inferred sentinel rule is added. +archived values. The original generated-world factory clears heights >=6553.5 +before room admission; the scene builder now applies that separate preparation +step. See the normalization evidence below. The owned browser and analysis sessions are closed; the single shared preview remains running. @@ -358,8 +359,8 @@ their resource URLs. No WASM source or published client artifact changes. These are owned client-only fixtures. The sole shared HTTPS preview continues to run; the backend is not yet routed through live character movement. Private assignment, immediate entry/return persistence, key admission, instance isolation, -room-transition vetoes and retirement remain open. The raw-versus-runtime -heights of library330 types0/1 also remain unresolved before live admission. +room-transition vetoes and retirement remain open. Generated-world preparation +now resolves the raw-versus-runtime heights of library330 types0/1. New evidence/reproductions in `local/mission-interior/` are `llr-room-admission-evidence.json`, `llr-room-floor-evidence.json`, @@ -381,3 +382,37 @@ passes56 roots/525 results under race; that binary predates the final empty-tree fallback, which is covered by the final focused race run. Final build and vet pass. Logs are `final-mission-scene-race-tests.json`, `final-room-physics-race-tests.json` and `final-mission-scene-tests.json` in the investigation directory. + +## Generated-world tileset preparation + +The original generated-playfield factory (`KKR:0x100f3b20`, evidence +`ev_630e6a787acd35966b3bfc5b18dfd51b171b413f872590d7aab4e69014917e9c`) +clears each scaled tileset height >=6553.5, then calculates room height bounds. +This is a preparation rule applied to every tileset index. The server now +performs it in the scene builder, while its raw archive decoder still preserves +the authored uint16 height words. Library340's ordinary heights4/4/8/16 all +survive, including its nonzero entries at indices0 and1. + +An isolated diagnostic WASM build logs the original BBR decoder's writes for +map330 as6553.5/6553.5/6/4/5.9000001. Read-only capture after generated-world +loading finds0/0/6/4/5.9000001 in the same resource object. Its three PNG grids +and final height table agree with the unmodified published client's earlier +capture. Static factory code supplies the normalization rule; the diagnostic +observes the decoded writes and subsequent loaded values. These observations +resolve the earlier discrepancy without changing the client port. + +The scene regression checks that a standing character is rejected in a wall +cell whose unavailable ceiling was previously interpreted as thousands of +units high. It also verifies normal room admission, preservation of raw decoder +values, and preservation of ordinary low heights at all indices. The complete +room/library/generator suite passes under the race detector. Build and vet pass. +This corrects the physics backend; private entry and live movement routing +remain unfinished. + +Reproductions are `tmp_build_tilemap_trace.py`, `tilemap-trace-client/`, +`runtime-tilemap-decode-trace/`, `tmp_verify_tilemap_normalization.py` and +`tilemap-normalization-verification.json` in `local/mission-interior/`. +The diagnostic is an owned client-only fixture (player294); it does not modify +the shared preview or published WASM. All owned browsers and analysis sessions +are closed. `cr-tilemap-short-evidence.json` confirms the underlying short +reader copies the raw two bytes; it contains no normalization rule. diff --git a/server/mission_scene.go b/server/mission_scene.go @@ -40,6 +40,13 @@ func (geometry *sceneGeometry) missionScene(layout missionLayout) (*missionScene if err != nil { return nil, err } + // Source: client/game/kkr.dll/lifted-0071.c, sub_360F3B20. + // Generated missions clear unavailable heights before room admission. + for index, height := range library.ground.tilesetHeights { + if height >= 6553.5 { + library.ground.tilesetHeights[index] = 0 + } + } scene := &missionScene{ground: library.ground, rooms: make([]placedRoom, len(layout.rooms))} minimum := layout.rooms[0].floor for _, room := range layout.rooms { diff --git a/server/mission_scene_test.go b/server/mission_scene_test.go @@ -8,6 +8,7 @@ import ( "fmt" "math" "os" + "slices" "sync" "testing" ) @@ -430,3 +431,42 @@ func TestMissionSceneSelectsStackedRoomsByHeight(t *testing.T) { t.Fatal("stacked copies must share the original mesh") } } + +func TestMissionSceneAppliesNativeUnavailableHeightNormalization(t *testing.T) { + geometry := missionGeometryFixture(t) + + scene, err := geometry.missionScene(missionLayout{template: 331, width: 4, depth: 6, floorHeight: 10, + rooms: []missionRoom{{x: 1, z: 3, rotation: 2}, {template: 37, x: 1, z: 1}}}) + if err != nil { + t.Fatal(err) + } + wall := scene.roomAt([3]float32{11.9, .8, 20}) + room := scene.roomAt([3]float32{15, 1, 16}) + library, err := geometry.dungeonLibrary(331) + + if err != nil { + t.Fatal(err) + } + if !slices.Equal(scene.ground.tilesetHeights, []float32{0, 0, 6, 4, 5.9}) { + t.Fatal("native generated-world heights", scene.ground.tilesetHeights) + } + if wall != nil || room != &scene.rooms[0] { + t.Fatal("unavailable wall height must not admit an ordinary standing character") + } + if library.ground.tilesetHeights[0] != 6553.5 || library.ground.tilesetHeights[1] != 6553.5 { + t.Fatal("scene normalization must not change the archived tilemap decoder") + } +} + +func TestMissionScenePreservesOrdinaryHeightsAtEveryTilesetIndex(t *testing.T) { + geometry := missionGeometryFixture(t) + + scene, err := geometry.missionScene(missionLayout{template: 341, width: 8, depth: 8, floorHeight: 10, rooms: []missionRoom{{x: 1, z: 1}}}) + + if err != nil { + t.Fatal(err) + } + if !slices.Equal(scene.ground.tilesetHeights, []float32{4, 4, 8, 16}) { + t.Fatal("ordinary heights, including indices zero and one, must survive normalization", scene.ground.tilesetHeights) + } +}