Wall Generation

Walls are how you tell the crowd where it cannot go. Internally the simulation keeps a wall grid: a coarse grid of square tiles (size = WallTileSize) that are either open or blocked. Blocked tiles both block pathfinding (routes go around them) and, when bWallCollision is on, physically stop agents from entering.

Seeding walls from the nav mesh

The easiest way to get walls that match your level is to mirror Unreal's navigation mesh. The crowd actor's Wall Generation Method defaults to Nav Mesh, so the walls are built automatically on BeginPlay.

Wall Generation Method set to Nav Mesh
Wall Generation Method set to Nav Mesh

What happens: the built nav mesh is rasterized into the wall grid - every WallTileSize cell whose centre is not covered by a navigable triangle becomes a wall. So holes, static obstacles and unnavigable regions in the nav mesh become walls in the crowd sim.

Generated wall tiles over the level
Generated wall tiles over the level

By default only enclosed unwalkable areas (holes and obstacles surrounded by walkable mesh) become walls - the outer edge of the nav mesh stays open. Enable bGenerateNavMeshBorderWalls to also wall off the region along the nav mesh's outer border (plus a one-tile fence past its rim), sealing agents inside the navigable area.

Regenerating at runtime

GenerateWallTilesFromNavMesh() is callable directly, so you can rebuild walls at any time (e.g. after rebuilding the nav mesh) regardless of the Wall Generation Method setting. It returns the number of wall tiles added and is safe to call repeatedly - adding a tile that already exists is a no-op.

Generate Wall Tiles From Nav Mesh node
Generate Wall Tiles From Nav Mesh node
int32 Added = Crowd->GenerateWallTilesFromNavMesh();

Stamping walls at runtime

You can also add wall tiles directly, by grid coordinate, without any nav mesh. This is the building block for "place a building, the crowd reroutes around it": convert the building's footprint to tile coordinates and stamp those tiles.

Add Wall Tile node
Add Wall Tile node
// Block the tile at grid (X, Y). Coordinates are in wall-tile units.
Crowd->AddWallTile(10, 4);

// Read back every wall tile (e.g. to visualise the grid):
TArray<FIntPoint> Tiles = Crowd->GetWallTiles();

Newly added walls invalidate the affected pathfinding caches, so existing orders re-route on the next move.

Wall removal and an actor-driven obstacle component are on the roadmap (v1.x). In 1.0, walls are added, not removed - to clear them, reset the simulation and re-seed.

Tuning how the crowd treats walls

Property Effect
Has Collision (bWallCollision) Master switch for physical wall blocking. Off = walls still block pathfinding but agents can pass through them.
Tile Size (WallTileSize) World units per wall tile. Smaller = obstacles represented more precisely, more tiles.
Near Wall Cost (NearWallCost) Pathfinding traversal multiplier for open cells touching a wall. Higher pushes routes away from walls (agents hug corners less). 1 disables the bias.

See the Crowd Actor reference for the full property list.