Skip to content

Sein Nav (A*)

Class · USeinNavigationAStar : USeinNavigation

Parent: Sein Navigation

#include "SeinNavigationAStar.h"

can be subclassed in Blueprint

Works out how units walk from A to B: it lays a 2D grid over the level, finds a route around walls and steep ground, then straightens that route into clean waypoints. This is the navigation used out of the box, and the reference other nav classes copy.

Uses A* SEARCH over a single-layer square grid. A* explores cells cheapest-route-first, guided by a straight-line distance estimate to the goal, so it finds a short path without checking every cell. Routing weight is per-cell (higher = costlier ground, so the search prefers cheaper terrain); cells are blocked by baked walls, over-steep slopes, or dynamic blockers stamped in each tick. The search is footprint-aware (configuration-space): it keeps the whole unit clear of walls by the agent’s radius plus a padding margin, measured against a per-cell distance-to-nearest-wall field, so different unit sizes get different routes from the same bake. After the search, a line-of-sight string-pull smooths the cell chain into a short waypoint list, then a wall-push pass nudges those waypoints toward corridor centers. Genuinely unreachable goals return a partial path to the closest reachable cell rather than failing. Searches run synchronously on the game thread; when batched and Sein.Sim.Parallel is on, each worker gets its own scratch so results stay identical to the serial path. Participates in the unified level-data bake as the “Nav” layer provider: it reproduces per-cell cost and connectivity from the shared level substrate and loads its runtime grid from that baked channel.

float MaxWalkableSlopeDegrees · default 45.0f · min 0.0, max 89.0

Editable in defaults and on instances

Maximum walkable slope angle in degrees. Surfaces steeper than this are treated as blocked at bake time.

float BakeTraceHeadroom · default 200.0f · min 0.0

Editable in defaults and on instances

Vertical extent (world units) above the tallest Sein Level Volume that the bake traces start from. Bump this if your walkable surfaces sit near the top of the volume and you want a margin.

bool bBlockElevatedObstacleTops · default true

Editable in defaults and on instances

Block “obstacle-top” cells at bake — walkable surfaces that perch above the lower ground they’re disconnected from (wall / cube tops). They are unreachable AND invalid standing positions, so IsPassable / placement queries must reject them. Left walkable, they would be isolated (pathing-correct, but placement-wrong, and shown as floating walkable cells when a tall play volume encloses them). Detection is local-maximum: a connected walkable component every one of whose disconnected walkable 8-neighbours is more than a step LOWER. A same-level disjoint play region keeps a same-level/higher disconnected neighbour and is never flagged. Off leaves tops walkable-isolated.

bool bDrawCellsInDebug · default true

Editable in defaults and on instances

Emit cell quads (green = walkable, red = blocked) for the nav debug scene proxy. Gated by ShowFlags.SeinNavigation / Sein.Nav.Show.

int32 AStarHeuristicWeightPercent · default 125 · min 100, max 300

Editable in class defaults · Blueprint read-only

Speed-versus-optimality dial for the A* search, as a percent: 100 means “find the shortest path no matter what,” higher means “find a good path faster, accepting up to that-much longer.” The search scores cells as f = g + (h * Weight) / 100, so raising Weight biases it harder toward the goal and expands fewer cells. Default 125 keeps paths at most 25% longer than optimal (visually indistinguishable) for a 5-10x speedup on obstacle-rich terrain; 100 is pure, always-optimal A* (slowest); 200 and up is very fast but produces visible zig-zags.

int32 AStarMaxIterations · default 10000 · min 256, max 1000000

Editable in class defaults · Blueprint read-only

Hard cap on how much work one path search may do — the planner’s patience limit. A* explores cells one at a time; once it has expanded this many it gives up and returns the best partial path it found (the closest-to-goal cell reached), the same as for a genuinely unreachable goal. Default 10000 covers any legitimate path on a 1 square-km map at 100 cm cells. Raise it (50000 and up) for very large maps or fine grids; lower it for a tighter bound on huge maps with many unreachable clicks.