Skip to content

fix(navigation): a place in a dungeon cell stands on the floor under it - #222

Open
davidc-smith wants to merge 1 commit into
eriknihlen:mainfrom
davidc-smith:fix/dungeon-place-floor
Open

davidc-smith wants to merge 1 commit into
eriknihlen:mainfrom
davidc-smith:fix/dungeon-place-floor

Conversation

@davidc-smith

Copy link
Copy Markdown
Contributor

What this changes

A walk or preview to a place inside a dungeon kept the height it was given. A dungeon map gives a cell by the middle of its bounds (PluginDungeonCell.Center), which in a tall room is metres above the floor. The router only arrives within 1.2 m of a goal's height (GoalHeightTolerance), so such a place came back NoRoute. Even a 3 m room's middle is 1.5 m up. A plugin exploring dungeon 0x5B48 cell by cell got NoRoute for every one of its ~700 cells; in 0x5948 only some routed. Walks to creatures were unaffected, since a creature already stands on the floor.

RuntimeNavigationGoalSource.TryLocatePlace now stands a place in an interior cell on the floor under it:

  • the cell's own floor nearest at or below the point, allowing up to 0.5 m above it so a place given at floor height stays on that floor;
  • where the cell has no floor under the point, as in the upper half of a tall room authored as a cell on top of a cell, the nearest floor of any cell below it in the landblock.

Both the preview (PreviewPathAsync(position, …)) and the walk (GoTo(position, …) / WalkToPlace) locate places through TryLocatePlace, so they agree. Outdoor places, places given with a NaN height, and object goals are unchanged. CellSurface.SampleLevelZAtOrBelow is a new lookup that only considers level faces at or below the point, so a ceiling over the point is never picked; SampleFloorZ returns whichever face it meets first.

No plugin contract change: the abstractions only gain XML doc notes that a cell's Center can be passed as it is. docs/navigation.md is updated to match.

Tests:

  • DungeonPlaceFloorTests (made-up dungeon with a 3 m room, a 5 m room, and a 10 m room built as a floorless cell over a floored one):

    • a goal left in mid-air returns NoRoute today;
    • a tall cell's middle routes and the walk arrives;
    • a floorless upper cell routes to the floor of the cell below;
    • a low room, outdoor places and places with no floor under them are unchanged;
    • a place a little under its floor stays on it.

    With the fix stubbed out, 5 of the 10 fail.

  • CellSurfaceTests: the new lookup takes the floor under a point, not the ceiling over it.

  • DungeonPlaceFloorInstalledDatTests (InstalledDat lane, Diagnostic): routes to the middle of every cell of 0x5948 and 0x5B48 from one start, as given and stood on the floor. Results:

    Dungeon Routed as given Routed on the floor
    0x5948 39 / 327 313 / 327
    0x5B48 9 / 712 265 / 712

    The rest of 0x5B48 lies in wings its cells alone don't connect.

It has also been tested live in a client against both dungeons.

Original behavior

Not a change to how the client behaves in the world. It only affects where the client's own navigation layer puts a place goal before planning a route to it.

Checklist

  • dotnet build AcDream.slnx -c Release is green
  • The portable test filter passes locally (see CONTRIBUTING.md)
  • One topic per PR
  • No code copied from ACEmulator, ACViewer, or holtburger
  • No comments describing the original client's internals

https://claude.ai/code/session_01CJ7QWFYQz9G3sBYnBWWDzU

A place walk or preview inside a dungeon kept the height it was given. A
dungeon map gives a cell by the middle of its bounds, which in a tall room
is metres above the floor, and the router only arrives within 1.2 m of a
goal's height, so such a place came back NoRoute. In 0x5B48 no cell routed
at all, and in 0x5948 only the low ones did.

RuntimeNavigationGoalSource.TryLocatePlace now stands a place in an interior
cell on the cell's own floor nearest at or below it (up to 0.5 m above), or,
where the cell has no floor there, as in the upper half of a tall room
authored as a cell on top of a cell, on the nearest floor of any cell below
it. Preview and walk both locate places through it, so they agree. Outdoor
places, places with no height, and object goals are unchanged.

Against the installed dat, from one start: 0x5948 routes 313 of 327 cell
middles (39 before); 0x5B48 routes 265 of 712 (9 before), the rest lying in
wings its cells alone do not join.

Claude-Session: https://claude.ai/code/session_01Qxrqqq5UccBfoNgzr2T84o

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant