Repository navigation
Nav: a navmesh for hand-made levels (nav: true in a level definition) - #130
Merged
Merged
Conversation
A game whose world is level files placed by id has no region, so its NPCs planned on the local grid, in the plane: one under a player on a walkway stood under him, and one on the floor never found the stairs up. A `level` definition now takes `nav: true`. While no region is loaded, the levels placed that say so are baked in memory as they are placed, from their own static solids, in chunks of 32 columns on a world-aligned grid, once per body class of the nav settings, and are one NavRegion: routes, plain_sight, nav_path, path_to, move_to path=true and clearance use it. Movers and what has Health are left out of the bake and carve it, as does everything that is not the levels' own: a shut door closes its doorway, a crate gives its ground back when it is broken. Chunk bakes are kept by what they are made from, in the world and in the process, so levels placed again bake nothing twice, and a baked solid that goes bakes only its chunks again. The body classes are built at once on the compute pool. Nothing is written to assets/nav/. A level without `nav` builds nothing, so a game that does not ask plays, and replays, as it did. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
NoLevelNav (the note that the levels placed ask for no navmesh) is outside the simulation: a function of the levels placed and content, made again by the snapshot rebuild. The levels' bake reads the levels' own static colliders, only where no region is loaded, so a voxel field cannot be what it reads. Co-Authored-By: Claude Mythos 5.2 <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.
What
A navmesh for hand-made levels. A
leveldefinition takesnav: true; while no region is loaded, the levels placed by id that say so are baked in memory as they are placed and are oneNavRegion, so NPC routes,plain_sight,nav_path,path_to,move_to path=trueandclearancework in a game built of level files as they do in a region.Why
A game whose world is level files placed by id (
spawn_level_by_id) has no region and so no tiles to bake. Its NPCs planned on the local grid, which plans in the plane: an NPC under a player on a walkway stood under him, and one on the floor never found the stairs up.How
Healthare left out and carve the navmesh, as does everything that is not the levels' own: a shut door closes its doorway and gives it back when it rests open; a crate gives its ground back the tick it is broken, with nothing built again.LEVEL_CHUNK) on a world-aligned grid, one bake per body class of thenavsettings, each from the solids within the body's reach of it, through the same sampler as a tile (bake_chunk), stitched across every edge as a voxel region's chunks are.ChunkKeywhose hash is its solids and the grid's corner, inNavBakesand in a process-wide store, so levels placed again (a chapter restarted, a snapshot loaded, the next test) bake nothing twice.refreshmakes it again whenPlacedLevelsor content changes, or when a baked solid goes or moves (only its chunks are baked). The body classes are built at once on the compute pool.assets/nav/;--check-contentand--bake-navdo not see it. Only machines that simulate bake.Compatibility
A level without
navbuilds nothing:refreshremembers that the levels placed ask for none and returns.LevelDef::navis not serialized when false, so definition hashes do not change. With a region loaded the navmesh is the region's, as before.Checks
crates/shards_npc/tests/npc/level_nav.rs(7 tests): the stairs are taken and a goal overhead is not in plain sight; a level that does not ask keeps the local grid; a door carves its doorway; a baked solid that goes bakes only its chunk; a solid withHealthcarves and gives its ground back; two levels are one navmesh and levels placed again bake nothing; an NPC climbs the stairs to a player on a walkway.cargo clippy --workspace --all-targets -- -D warnings,cargo test -p shards_npc,cargo test -p shards_level. The whole workspace and the template were not run locally (the machine ran out of memory building them next to other work); CI runs them.docs/agents/world-regions-nav.md,CHANGELOG.md,docs/engine-progress.md.🤖 Generated with Claude Code