aorecomp

Anarchy Online classic in the browser

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


commit 81e9747ed9d7e3faff2c7df2f23d847e779aa9ea
parent 7b9b44289189dc6a2db343d01113a792ed8bdf31
Author: anon <anon@example.com>
Date:   Thu,  5 Nov 2026 20:26:17 +0000

Ground early shop interiors in original geometry and close A4

Diffstat:
MTODO.md | 16++++++++--------
Mdocs/city-doors.md | 52+++++++++++++++++++++++++++++++++++++++++++---------
Mserver/combat_visibility.go | 2+-
Mserver/mission_movement.go | 4++--
Mserver/mission_world.go | 2+-
Mserver/npc_navigation.go | 2+-
Mserver/scene_geometry.go | 15+++++++++++++--
Mserver/scene_queries.go | 4++--
Aserver/shop_geometry.go | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
Aserver/shop_geometry_test.go | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/world_actions.go | 2+-
11 files changed, 183 insertions(+), 27 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -79,7 +79,7 @@ research separately. More screenshots and test cases do not count as new gamepla two-observer/reconnect checks, completing this finite appearance scope. See [NPC appearance scope and evidence](docs/npc-appearances.md). -- [ ] **A4: Doors visibly open where players enter.** Reproduce Entertainment +- [x] **A4: Doors visibly open where players enter.** Reproduce Entertainment <-> Trade and the Entertainment shop near Bronto Burger. Zoning already works; city/shop proximity animation is not established by permanently open mission doors. Identify the actual portal/door objects and implement shared state @@ -89,13 +89,13 @@ research separately. More screenshots and test cases do not count as new gamepla and Neutral shop/zone route using the same implementation. Record portals that genuinely have no moving door rather than inventing an animation. November 5: ten audited endpoints now share native opening/closing state and - replay it after reconnect. Nine endpoints pass the full two-client scenario. - The Old Athen approach needs its original side ramp and a forward jump over - the threshold; passage and source closure work, but the destination retains - server Y=5 while the native client lands at Y=4.26. Public shop interiors lack - server collision geometry. Keep this gate open until the Clan arrival agrees - with the native floor; retain the strict failing arrival assertion. See - [door implementation and remaining verification](docs/city-doors.md). + replay it after reconnect. All ten endpoints pass the full two-client scenario. + Original collision geometry now grounds the four selected shop interiors, + fixing the Clan arrival mismatch without relaxing the position assertion. + The Old Athen approach uses its original side ramp and an ordinary forward + jump over the threshold, which also stops the native client without server + corrections. All selected portals have moving panels, including the whom-pah. + See [door implementation, verification and scope](docs/city-doors.md). - [ ] **A5: Useful, nonempty early shop stock.** Inventory every terminal in the selected starter and basic shops for all three factions. Supported purchases diff --git a/docs/city-doors.md b/docs/city-doors.md @@ -113,7 +113,7 @@ geometry is changed to bypass it. ### November 5 result ledger -Nine of ten endpoints pass the full two-client scenario, including passage, +Before shop collision support, nine of ten endpoints passed the full two-client scenario, including passage, open/closed reconnect and authoritative arrival: | Capture directory under `local/city-doors/` | Passing endpoints | @@ -130,19 +130,53 @@ All selected portals have moving panels; none needs a synthetic animation. `20261105-120928/clan-shop` demonstrates normal forward-jump passage into 1180, correct source closure and visibly settled native arrival. Its final assertion -still fails: native position is approximately [201.01, 4.26, 160.5], versus server -[201.00072, 5, 160.50998]. `sceneGeometry.physical` currently supports outdoor -terrain and generated missions, not public shop interiors. Consequently the -server keeps the authored door height instead of following this native floor. +failed: native position was approximately [201.01, 4.26, 160.5], versus server +[201.00072, 5, 160.50998]. The server supported outdoor terrain and generated +missions, but lacked public shop collision. Consequently it kept the authored +door height instead of following this native floor. The strict 0.5-metre three-dimensional arrival assertion remains in the test. -A4 is still open; this is the specific remaining acceptance failure. The earlier `20261105-120737` jump attempt fired during turning and landed before forward movement. The fixture now waits for the actual forward key event. The bounded collision audit and native-only diagnostic answer only the exterior -threshold question; they do not establish interior collision support. Further -work should reproduce the 1180 arrival directly and add its missing geometry, -without repeating the nine passing routes or broad native step-up research. +threshold question; they do not establish interior collision support. + +### Shop collision + +The four selected interiors (1180, 1183, 1186 and 1191) now load original room +records, dungeon floor grids and per-room collision surfaces. They use the same +floor, sphere, line, room admission and movement routines as generated interiors, +while their immutable scenes stay separate from generated mission ownership and +retirement. No floor constants or doorway coordinates are adjusted. + +LLR `CreatePlayfieldFromResource` (`0x100291d0`) and `InitializeSpace` +(`0x10029bc0`) retain the authored room poses. The room reader (`0x10033d50`) +initializes placed/template positions and rotations identically. `LoadSurface` +(`0x1003edd0`) selects resource1000013 with identity `(playfield << 16) | room`. +LLR `sub_3802C270` reads serialized neighboring room indices, skipping exterior +and self links. Static `GetSafePos` (`KKR 0x1014dad0`) uses room 0: the resource +constructor initializes its safe-room index to zero and the static reader does +not overwrite it. These are original resource contracts, not inferred geometry. +Evidence is retained in `local/old/mission-interior/llr-evidence.json`, +`llr-room-evidence.json`, `llr-room-surfaces-evidence.json` and +`kkr-room-admission-evidence.json`. Authored door-to-link binding beyond the +selected unlocked shop routes remains outside this change. + +`TestClanShopArrivalSettlesOnOriginalFloor` failed at Y=5 before this change and +passes at Y=4.26 using normal CharacterReady and simulation ticks. A second +regression walks between the Clan shop's authored rooms in both directions. +All 34 focused collision, room lifecycle, visibility and door test roots pass +(`interior-regressions.log`), along with `go vet ./server`. + +The corrected Clan browser scenario passes in `20261105-121750/clan-shop`: +native arrival [201.009995, 4.26000309, 160.5] agrees with authoritative +[201.01, 4.26499, 160.50998]. The strict arrival assertion is unchanged. Both +clients show the source door closed after passage. All seven other affected +shop entry/return scenarios pass in `20261105-121950/` (`browser-shop-floors.log`). +Together with the two unchanged whom-pah endpoints in `20261105-114234/`, this +completes the ten-endpoint A4 scope. The arrival views were inspected, and all +test-owned browsers and servers exited. A4 is closed; exact original proximity +timing and other public interiors remain outside this finite scope. Nineteen focused Go test roots passed (`go-regressions.log`), along with `go vet ./server`, the native browser snapshot test, JavaScript syntax and diff diff --git a/server/combat_visibility.go b/server/combat_visibility.go @@ -25,7 +25,7 @@ func (server *server) combatVisible_locked(attacker, target *character, now time func (geometry *sceneGeometry) lineOfSight(playfield uint32, origin, end [3]float32) bool { // client/game/llr.dll/lifted-0018.c::sub_3802C170: same room or direct open pair. - if scene := geometry.mission(playfield); scene != nil { + if scene := geometry.dungeon(playfield); scene != nil { first, second := scene.roomAt(origin), scene.roomAt(end) if first == nil || second == nil { return false diff --git a/server/mission_movement.go b/server/mission_movement.go @@ -9,7 +9,7 @@ type playerRoomState struct { } func (player *character) vetoPosition(position, previous *[3]float32) bool { - scene := player.geometry.mission(player.playfield) + scene := player.geometry.dungeon(player.playfield) if scene == nil { return player.geometry.playfields[player.playfield].veto(position, previous) } @@ -88,7 +88,7 @@ func (player *character) vetoPosition(position, previous *[3]float32) bool { } func (scene *missionScene) safePosition() [3]float32 { - // client/game/kkr.dll/lifted-0096.c, sub_3614DAD0: GetSafePos uses the exterior room. + // client/game/kkr.dll/lifted-0096.c, sub_3614DAD0: GetSafePos uses the designated safe room. room := scene.entrance position := room.position local := room.tilePoint(position, scene.ground.spacing) diff --git a/server/mission_world.go b/server/mission_world.go @@ -16,7 +16,7 @@ func (geometry *sceneGeometry) physical(identity uint32) bool { if geometry == nil { return false } - if geometry.mission(identity) != nil { + if geometry.dungeon(identity) != nil { return true } _, exists := geometry.playfields[identity] diff --git a/server/npc_navigation.go b/server/npc_navigation.go @@ -73,7 +73,7 @@ func (queue *navigationQueue) Pop() any { func planNPCRoute(npc *character, destination [3]float32) [][3]float32 { // This bounded half-metre search is reconstruction policy, not a recovered // original server algorithm. Probe copies never alter the live actor or DB. - if scene := npc.geometry.mission(npc.playfield); scene != nil { + if scene := npc.geometry.dungeon(npc.playfield); scene != nil { if scene.roomAt(destination) == nil { return nil } diff --git a/server/scene_geometry.go b/server/scene_geometry.go @@ -15,6 +15,7 @@ type sceneGeometry struct { models map[uint32]collisionSphere terrain map[uint32]*terrain missions map[uint32]*missionScene + interiors map[uint32]*missionScene } func readSceneGeometry(files fs.FS) (*sceneGeometry, error) { @@ -27,7 +28,17 @@ func readSceneGeometry(files fs.FS) (*sceneGeometry, error) { database.file.Close() return nil, err } - return &sceneGeometry{database: database, playfields: playfields, surfaces: make(map[uint32]*sceneSurface), waters: make(map[uint32]*sceneWater), models: make(map[uint32]collisionSphere)}, nil + geometry := &sceneGeometry{database: database, playfields: playfields, surfaces: make(map[uint32]*sceneSurface), waters: make(map[uint32]*sceneWater), models: make(map[uint32]collisionSphere), interiors: make(map[uint32]*missionScene)} + // Original dry interiors on the selected early city/shop routes. + for _, identity := range []uint32{1180, 1183, 1186, 1191} { + scene, err := geometry.staticDungeon(identity) + if err != nil { + database.file.Close() + return nil, err + } + geometry.interiors[identity] = scene + } + return geometry, nil } func (geometry *sceneGeometry) model(identity uint32) collisionSphere { @@ -93,7 +104,7 @@ func (geometry *sceneGeometry) surface(identity uint32) *sceneSurface { } func (geometry *sceneGeometry) sphere(playfield uint32, center [3]float32, radius float32) surfaceContact { - if scene := geometry.mission(playfield); scene != nil { + if scene := geometry.dungeon(playfield); scene != nil { return scene.sphere(center, radius) } layout, exists := geometry.playfields[playfield] diff --git a/server/scene_queries.go b/server/scene_queries.go @@ -68,7 +68,7 @@ func (layout scenePlayfield) veto(position, previous *[3]float32) bool { } func (geometry *sceneGeometry) line(playfield uint32, ground *terrain, origin, end [3]float32, clip bool) surfaceIntersection { - if scene := geometry.mission(playfield); scene != nil { + if scene := geometry.dungeon(playfield); scene != nil { return scene.line(origin, end) } layout, exists := geometry.playfields[playfield] @@ -89,7 +89,7 @@ func (geometry *sceneGeometry) line(playfield uint32, ground *terrain, origin, e } func (geometry *sceneGeometry) floor(playfield uint32, ground *terrain, origin [3]float32, point, normal *[3]float32) waterContact { - if scene := geometry.mission(playfield); scene != nil { + if scene := geometry.dungeon(playfield); scene != nil { scene.floor(origin, point, normal) return waterContact{} } diff --git a/server/shop_geometry.go b/server/shop_geometry.go @@ -0,0 +1,52 @@ +package main + +import "fmt" + +func (geometry *sceneGeometry) dungeon(identity uint32) *missionScene { + // Public interiors are immutable; generated scenes have a separate lifecycle. + if scene := geometry.interiors[identity]; scene != nil { + return scene + } + return geometry.mission(identity) +} + +func (geometry *sceneGeometry) staticDungeon(identity uint32) (*missionScene, error) { + library, err := geometry.dungeonLibrary(identity) + if err != nil { + return nil, err + } + scene := &missionScene{ground: library.ground, rooms: make([]placedRoom, len(library.rooms))} + for index := range scene.rooms { + room := &library.rooms[index] + if room.water { + return nil, fmt.Errorf("public interior %d room %d requires liquid physics", identity, index) + } + // client/game/llr.dll/lifted-0017.c::sub_380291D0 keeps the authored pose. + scene.rooms[index] = placedRoom{template: room, position: room.position, rotation: room.rotation, + surface: geometry.surface(identity<<16 | uint32(index))} + if scene.rooms[index].surface == nil { + return nil, fmt.Errorf("missing public interior %d room %d surface", identity, index) + } + } + + // client/game/llr.dll/lifted-0018.c::sub_3802C270 reads authored adjacency. + // Static GetSafePos (client/game/kkr.dll/lifted-0096.c::sub_3614DAD0) uses room 0. + scene.entrance = &scene.rooms[0] + for index := range scene.rooms { + room := &scene.rooms[index] + for _, door := range room.template.doors { + position, direction := scene.portal(room, uint16(door[1])) + if door[0] == -1 { + continue + } + if door[0] < 0 || int(door[0]) >= len(scene.rooms) { + return nil, fmt.Errorf("invalid public interior %d room link %d", identity, door[0]) + } + if int(door[0]) <= index { + continue + } + scene.links = append(scene.links, roomLink{[2]*placedRoom{room, &scene.rooms[door[0]]}, position, direction}) + } + } + return scene, nil +} diff --git a/server/shop_geometry_test.go b/server/shop_geometry_test.go @@ -0,0 +1,59 @@ +package main + +import ( + "math" + "testing" + "time" +) + +func TestClanShopArrivalSettlesOnOriginalFloor(t *testing.T) { + world := newPlayerCollisionWorld(t) + player, client := world.characters[1], world.clients[1] + player.playfield, player.position = 1180, [3]float32{201.01, 5, 160.5} + client.loading = true + + if err := world.handleCharacterReady(client); err != nil { + t.Fatal(err) + } + started := player.movement.updatedAt + for frame := 1; frame <= 120; frame++ { + world.advancePlayerMovement(started.Add(time.Duration(frame) * time.Second / 60)) + } + + if math.Abs(float64(player.position[0]-201.01)) > .01 || math.Abs(float64(player.position[1]-4.26)) > .01 || + math.Abs(float64(player.position[2]-160.5)) > .01 || player.movement.falling { + t.Fatal("Clan shop arrival differs from the native settled floor", player.position) + } +} + +func TestClanShopMovementCrossesAuthoredRoomLinks(t *testing.T) { + world := newPlayerCollisionWorld(t) + player, client := world.characters[1], world.clients[1] + player.playfield, player.position = 1180, [3]float32{201, 5.01, 188} + player.rotation = [4]float32{0, 0, 0, 1} + + if err := world.handleMovement(client, playerMovementRequest(player, 1)); err != nil { + t.Fatal(err) + } + started := player.movement.updatedAt + for frame := 1; frame <= 480; frame++ { + world.advancePlayerMovement(started.Add(time.Duration(frame) * time.Second / 60)) + } + forwardRoom, forwardPosition := player.roomState.room, player.position + if err := world.handleMovement(client, playerMovementRequest(player, 2)); err != nil { + t.Fatal(err) + } + if err := world.handleMovement(client, playerMovementRequest(player, 3)); err != nil { + t.Fatal(err) + } + started = player.movement.updatedAt + for frame := 1; frame <= 960; frame++ { + world.advancePlayerMovement(started.Add(time.Duration(frame) * time.Second / 60)) + } + + scene := world.geometry.dungeon(1180) + if forwardRoom != &scene.rooms[0] || forwardPosition[2] < 194 || + player.roomState.room != &scene.rooms[1] || player.position[2] > 182 { + t.Fatal("walking failed to cross the shop's authored room links", forwardPosition, player.position) + } +} diff --git a/server/world_actions.go b/server/world_actions.go @@ -229,7 +229,7 @@ func (server *server) handleMovement(client *worldClient, body []byte) error { traceLog.Printf("Character %d zoning %d -> %d", client.id, playfield, destination.Playfield) return server.updateUser_locked(*destination) } - if server.geometry != nil && server.geometry.mission(playfield) != nil { + if server.geometry != nil && server.geometry.dungeon(playfield) != nil { // Relay the admitted pose, and correct the owner when its compact position changed. reported := encodeMovementBase1491(body[16:]) for axis, value := range character.position {