Repository navigation
feat(nav): MovementLink, authored edges the axis auto-connect can't make - #59
Merged
Merged
Conversation
The graph only links nodes that share an X or a Y, so a diagonal flight
of steps (flying-platform's stern, drawn at 45 degrees down to the main
deck) can't be walked: games had to teleport entities or script
straight-line moveTo hops around the graph.
A MovementLink { dx, dy } on a MovementNode adds a two-way edge to the
node at its world position + (dx, dy), resolved within LINK_TOLERANCE
(4 px) in a second pass once every node is in, costed at its
straight-line length. The walker already walks any leg as a straight
line, and Floyd-Warshall needs nothing new. Graph gains addLink and
nearestNodeWithin; the engine forwards addLink.
A diagonal link can't be pruned by a later addNode: the in-between
pruning only drops edges between two nodes on the new node's own axis.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
MovementLink is an additive API, so a minor bump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The nav graph only links nodes that share an X or a Y (
graph.zigautoConnectAxis). Diagonal connections can't be expressed. In flying-platform, the ship's stern has steps drawn at 45° down to the main deck. The demo's opening crew should walk down them from the balloon ferry, but today they have to be teleported (flying-platform-labelle#1031).What
MovementLink { dx, dy }, a new component. Put it on aMovementNodeentity to link that node to the node at its world position + (dx,dy).controller.LINK_TOLERANCE(4 px), because offsets are measured from art.buildGraphIntoState, after every node is in. Graphs rebuild whenever the node set changes, so links follow rebuilds.Graph.addLink(a, b): idempotent; returnserror.InvalidNodefor a self-link or a removed or unknown node.Graph.nearestNodeWithin(pos, tol).PathfinderWith.addLink.MovementLinkis exported throughComponents, so the assembler registers it.addNodecan't prune a diagonal link. The in-between pruning only drops an edge between two nodes on the new node's own axis.Testing
zig build testandzig build specpass. New tests:nearestNodeWithin.local:plugin, the stern deck got 4 nodes and one link down the steps. The opening crew walk the deck at y 36, go diagonally down the steps ((95,31) → (116,0)) and carry on along the main deck.graph built: 33 nodes, with no link warnings.Release
This is additive, so it should ship as 4.1.0. The game PR pins it after release.
🤖 Generated with Claude Code