Repository navigation
Generate nav ladders from climbable brushes in nav_generate - #2280
sunzenshen wants to merge 31 commits into
Conversation
Bug from 2a78129 which breaks polyhedron math
Stack array ptr cannot be null
Validate the remaining signed span before linking a brush ladder. Preserve legacy manual and entity ladder creation. Co-authored-by: Rainyan <Rainyan@users.noreply.github.com>
Keep the descent backlink and clear the behind slot explicitly when generating a brush ladder. A shared landing can also be a valid forward or side result. Co-authored-by: Rainyan <Rainyan@users.noreply.github.com>
Brush ladders were built after sampling, so the sampler never continued from their ends and a landing reached only by the climb got no nav area. 31 of 43 generated climbs with a linked bottom and no top exit on the ntre_ maps had no area at the landing at all. Build brush ladders before sampling, as stock Source does with its ladders, and connect them once areas exist. Skip a ladder-end seed whose ground is more than a player height below the ladder end, so a climbable brush over a void does not seed the void's floor. When connecting a brush ladder, take the floor under the foot as the bottom area before falling back to the nearest area: for a foot that hangs above the floor the nearest area can be the top landing, which then drops every top exit. If no top exit is found, scan again from a step higher, for a climbable brush that ends below the landing's lip. From-scratch nav_generate on 21 ntre_ maps against the curated meshes: climbs linked up and down to the curated areas 100 -> 120 of 157, no top exit 45 -> 27, no climb that matched before lost its match. Bullet, Transit, Ridgeline and Skyline output is unchanged.
A climbable brush often gets a ladder on its wide face and more on its narrow end faces. The player hull overhangs an end face narrower than itself, so a small sideways drift while climbing loses the surface: on Transit, bots mounted the 19-unit end faces of the 19x34 brush and fell off about 30 units up on every try, while the 34-unit face worked. After building the ladders of one brush, remove a ladder when a wider ladder of the same brush faces another way and covers its height. End faces that reach lower than the wide face's ladder stay. From-scratch nav_generate on 21 ntre_ maps: linked end-face ladders 106 -> 56 (the rest are Apparatus end faces that bots climb), matched curated climbs with up/down links unchanged at 120/120, none lost. Transit, 4 pinned CTG rounds: 33 ascents, all on the 34-unit face, all reached the top.
CreateLadder's clearance traces start on the ladder's own face. On a climbable brush that the generation trace mask treats as solid, every trace starts in solid, so the bottom moves up until it leaves the brush. The wide face of a climb brush then loses its ladder or keeps a stub, and only the narrow end faces remain, which bots fall off. Start the traces just off the face. The full-height ladders this restores can top out under a prop or ceiling, where the top-exit scan starts inside solid and finds no landing. Retry that scan from the ladder top as well as above it. From-scratch generation of the 21 ntre_ ladder maps: matched climbs linked both ways 119 -> 130 of 157, none lost; short ladders 23 -> 0.
Merging grows nav areas without re-adding them to the area grid, so during generation a grid lookup misses the merged-in part of an area. Brush ladder top scans now look the landing up in the area list directly. On 21 ntre_ maps this links Sentinel C1/C2 (CTG and JGR) both ways; no climb that linked before loses its links. The wider lookup also finds floors past the far side of a climb, and snapping the ladder top down to such a floor ends the climb under the brush top (Dawn/Dusk C1, bots fell off 3 of 3). A brush ladder now drops a forward exit more than a step below its top.
Replace the brush-ladder bool parameter of CreateLadder, CommandNavBuildLadder and ConnectGeneratedLadder with a NavLadderSourceType enum, so call sites read as the ladder source instead of a bare true. Name the bottom-floor reach and the behind-exit range, and reword two comments that restated history or code. No behavior change: nav_generate of Transit, Rogue and Sentinel CTG with this build matches the previous build's output byte for byte.
Valve SDK files keep their original code under #else, so every NEO change to them sits behind #ifdef NEO. Move the brush ladder paths of CreateLadder and ConnectGeneratedLadder into NEO-only helpers: end clearance and span reject, the bottom area lookup, and the top area search with its retries. The SDK bodies keep their lines and call a helper at each hook point. Guard the source parameter, the area lookup option and the ladder source enum, and restore blank lines the branch had changed outside the guards. No behavior change: nav_generate of 8 ntre_ ladder maps (Release) gives byte-identical navs before and after. Rogue varies under load in both builds; at 2 wide its six runs are identical.
7ce9bf8 to
c24fb28
Compare
sunmachine
left a comment
There was a problem hiding this comment.
Agreed with @AdamTadeusz on his observations; no notes to add here. This one is dead code as far as I can tell.
LadderFromPolyhedron has a single exit that returns true, so the warning branch in BuildBrushLaddersFromBsp never ran. It also read the polyhedron after Release(). Make the function void and remove the branch.
Say what the ladder foot is and why the nearest-area lookup can return the top landing, and which slot Disconnect() clears when the behind area was also found by a forward or side scan.
Merging grows the surviving area in place, but the grid kept only the cells of its original extent, so a grid lookup could miss the merged part for the rest of generation. Add the area to the cells its new extent covers in FinishMerge and MergeEdit. With the grid current, brush ladder generation no longer needs its own lookup over all areas, so remove it. What is left of the top area helper is the retry scans, so name it for that.
c24fb28 to
52138a3
Compare
Keep the blank separator lines after #endif instead of before it, with the non-NEO text unchanged.
Put the separator lines before #ifdef NEO back where the SDK has them and keep the ones after #endif.
|
|
||
| #ifdef NEO | ||
| //-------------------------------------------------------------------------------------------------------------- | ||
| static const float LadderEndScanStep = 10.0f; |
There was a problem hiding this comment.
Nit: this is a compile-time constant, so constexpr like GenerationStepSize in nav.h. No change needed if you'd rather leave it.
| static auto DrawLine(const Vector& from, const Vector& to, float duration = NDEBUG_PERSIST_TILL_NEXT_SERVER, | ||
| int r = 255, int g=255, int b=255) | ||
| { | ||
| return NDebugOverlay::Line(from, to, r, g, b, true, duration); | ||
| } |
There was a problem hiding this comment.
This DrawLine honors duration, but the macro it replaces ignored it and always passed NDEBUG_PERSIST_TILL_NEXT_SERVER. The existing DrawLine( ..., 3, ... ) calls in this file (the sniper spot drawing and the two near the ladder edit code) now keep their lines up for 3 seconds instead of one frame. Maybe give the new helper its own name and leave the macro for the old call sites?
The brush ladder debug helper honored its duration and shadowed the SDK macro, which ignores it, so the existing sniper spot and ladder edit lines stayed up for 3 seconds. Give the helper its own name. Also make LadderEndScanStep constexpr.
|
I noticed all the ladders on apparatus have two ladder nav things after generation, I don't see the same on bullet's ladders so maybe that's a map quirk, maybe @DESTROYGIRL can tell us more?
|
Not sure, the ladders do have slanted tops, I'd assume it's that looking at the pic. Rogue also has slanted top ladders so you could test on that |



Description
Builds on #1833 (Rainyan's brush-ladder generation), rebased on master, with fixes on top. A squash
merge should keep Rainyan's credit (
Co-authored-by: Rainyan <Rainyan@users.noreply.github.com>).nav_generatenow builds nav ladders for climbable brushes (CONTENTS_LADDER). Master builds none,so a mesh generated from scratch has no ladders and a mapper places each one by hand. With this
change the generated mesh has a ladder on each climb, linked to the floor and the landing where
the geometry allows it.
The fixes on top of #1833 reject ladders that cannot be climbed, drop the extra ladders on a
brush's narrow end faces, and connect the ladder ends to the right floor and landing areas. The nav
grid is now updated when areas merge, so lookups during generation see the merged areas.
The generated ladders are rougher than hand-edited ones: some climbs with narrow landings, lips or
thin poles still need manual edits.
Toolchain
Linked Issues