Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld e339ab22-c…

NavGraph

How a creature finds its way through the house.

by◐aiden·posted 1d ago
What it does

game.monsters.NavGraph

How a creature finds its way through the house.

The graph is the house. Nodes are the twelve areas and the doorways between them; edges are the doorways and the stairways. So a creature routes the way a person does — room, doorway, room — and it uses the same doors the player uses.

A doorway is a node, not just an edge, so a creature walks to the door and then through it rather than straight at a wall corner.

Why not a voxel grid: a grid over a two-storey house is thousands of nodes built from raycasts, and it would have to be rebuilt whenever a door moved. The room graph is about thirty nodes, comes free from the plan the house is already built from, and cannot disagree with the geometry, because it is that plan.

local NavGraph = require("game.monsters.NavGraph")
local points, status = NavGraph.route(from, to)  -- plain world points, first to last
local spot = NavGraph.randomRoom(rand)           -- somewhere to wander to
local rooms = NavGraph.roomsNear(point, 4)       -- the rooms a searcher checks first

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

strict

roomRect(id: string) → void

argtypedescription
idstring

doorPosition(room: ?, door: ?) → void

The world position of a doorway, which is where its two rooms meet.

argtypedescription
room?
door?

centre(rect: ?) → void

argtypedescription
rect?

build( ) → void

Build (or rebuild) the graph from the house plan.

addNode(id: string, position: { number }) → void

argtypedescription
idstring
position{ number }

addEdge(a: string, b: string, cost: number?) → void

argtypedescription
astring
bstring
costnumber?

graph( ) → void

asVec(p: any) → void

argtypedescription
pany

route(from: any, to: any) → void

A route from one world point to another, as plain world points from the first to the last. The caller gets nothing it has to know the graph to use, and a route it can walk one step at a time.

argtypedescription
fromany
toany

randomRoom(rand: () → void

A random room to wander to, for a creature that has nothing better to do. Kept here so a patrol never has to know the house layout.

argtypedescription
rand(

roomsNear(point: { number }, count: number) → void

The rooms nearest a point, for a creature searching where the player was: it checks the rooms around the last known position rather than standing on the spot.

argtypedescription
point{ number }
countnumber

insideRoom(rect: ?, x: ?, y: ?, z: ?) → boolean

argtypedescription
rect?
x?
y?
z?

insideAnyRoom(x: number, y: number, z: number) → boolean

argtypedescription
xnumber
ynumber
znumber

insideOpenDoorway(x: number, y: number, z: number) → boolean

Is this point inside a doorway a creature could see through? A doorway that carries a lock is shut, and a shut door is a wall.

argtypedescription
xnumber
ynumber
znumber

clearLine(from: any, to: any) → boolean

argtypedescription
fromany
toany

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing up to 3 levels deep. Open a part to see what it holds further down.

7+items
▣
module · born here
❒asset
# game.house.HouseBuilder The twelve areas of **The House That Knows You**, as data and one builder. `HouseBuilder.build()` is called from `game.house.sceneContent`, which the scene build calls, so what it makes is baked into `scenes/house.scene/scene.json` and is there the moment the world opens. ## The plan is data - **`ROOMS`** — each area's interior rectangle: `x0..x1`, `z0..z1`, `y0..y1`. The entrance hall is `HALL`, and is built by the scene skeleton, not here. - **`DOORS`** — a doorway is declared by `(a, side, at, other)`: room `a` cuts an opening on the wall named by `side`, centred at `at` measured along it. It is declared by room-and-side rather than by a coordinate because two rooms never share a wall: interiors are spaced so neighbouring walls **abut** and never coincide, and each room cuts its own. Two coplanar walls look perfect in a still frame and shimmer the moment the camera moves. - **`STAIRS`** — the three places the house changes level, each with the room it starts in, the room it arrives in, and the item that locks it. The hole a stair needs is derived from the same entry, so a stair and its hole cannot disagree. - **`PROPS`** — what each room is furnished with; `hide = true` marks a place the player can get inside. - **`UNLIT_ROOMS`** — the basement, secret room, attic and storage room carry no light on purpose. They are torch territory. ## What it exposes - `build()` — build it all. Called from the scene build. - `area(id)` — the centre of an area, for any slice that needs to place something in a room. `roomOf(id)` gives the rectangle. - `doorInfo(id)` — a doorway's lock, for the systems slice. - `hidingPlaces()` — every `hide_<room>_<n>` entity, by name. ## What it names, so other slices can find it `room_<area>` is each room's root; `light_<area>` its bulb; `door_<id>` a door leaf; `door_stair_<id>` a locked stair door; `hide_<area>_<n>` a hiding place; `prop_<area>_<n>` furniture; `spawn_resident_<area>` and `patrol_<area>` the two anchors the monsters slice uses. The furniture is **blocked out**: named, in the right place, at the right size, in a plain material, so the game runs and the polish pass can put the real prop exactly there.
▲ 0↑ born
backing path · game/monsters/NavGraph.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.