Any NPCs · Documentation

Walking, Crossings and Traffic

How NPCs find their way along your roads, when they step onto the road, how the cars stop for them, and what happens when a car comes too close.

← All Any NPCs documentation

1 · Walking lines

Routes built from your roads

When a road network loads in play, Any NPCs builds its walk graph from the same geometry Any City used for the road meshes. Nothing is placed by hand, and a regenerated city gets new lines on its own. The graph has:

  • A walking line along each sidewalk, halfway across it by default.
  • A line around every junction corner, following the curve of the corner sidewalk.
  • A line over each painted crosswalk, stepping up and down raised medians.
  • An unmarked crossing wherever an approach has sidewalks on both sides but no crosswalk (roundabouts, dead ends, two-road junctions), so NPCs are never trapped on one side. At a junction it lies between the junction and the stop line, in front of the waiting cars.
  • Joins between road networks at their linked open ends.

Sidewalks narrower than 80 cm get no line. Very short segments, or a road network whose Stop Line Gap is under 90 cm, leave no room for an unmarked crossing in front of the cars and get none; the Output Log says so. The layout is project-wide:

▾ Project Settings > Plugins > Any NPC

Walk Line Fraction Where the line lies across a sidewalk: 0 at the curb, 1 at the outer edge. Default 0.5
Min Sidewalk Width Narrower sidewalks get no walking line. Default 80 cm
Add Unmarked Crossings On by default: crossings where there is no crosswalk
Unmarked Crossing Width How wide NPCs spread on an unmarked crossing; at a junction at most the road's Stop Line Gap. Default 200 cm
Dead End Crossing Setback How far from a dead end its crossing lies. Default 250 cm

2 · Walking

How they walk

Each NPC keeps its own side of the walking line (most keep right), slows down behind the person ahead, pauses now and then and, at each corner, mostly walks straight on. The walking settings are on the manager:

▾ AnyNpcManager > Simulation Settings > Walking

Crossing Weight How likely an NPC is to cross at a node, against about 1 for walking on along the sidewalk. 0 never crosses. Default 0.5
Pause Chance Chance of pausing for 2 to 6 seconds at a node. Default 3%
Follow Distance Gap kept behind the NPC walking ahead on the same side, so queues form at crossings. Default 120 cm
Agent Radius Size of an NPC for hits, bumps and following. Default 35 cm

3 · Crossing

When they cross

An NPC walks to the curb, stops and waits until both of these are true:

  • The light. The approach's signal is red for cars, with enough red left to walk across plus a safety margin. A road without a signal counts as red.
  • The cars. No vehicle stands on the crossing, no moving vehicle within 15 m is heading for it or will reach it before the NPC is across, and no traffic car standing close by and facing it is next to go. Cars held at a red light of the junction are ignored: they stop behind the crossing.

Once it is clear, the NPC walks across a little faster. While NPCs are on the road, every traffic lane under the crossing is blocked: cars, turning cars included, stop short of it, and a car that can't stop in time brakes as hard as it can. NPCs that wait too long give up and walk elsewhere.

Streams of people don't stall the traffic. Others may join NPCs already crossing only within 3 seconds. After that, a waiting car goes first once the crossing empties, so a busy sidewalk holds a car for about one walk across.

▾ AnyNpcManager > Simulation Settings > Crossing

Max Crossing Wait Seconds Longest wait at a crossing without a signal. Default 25 s
Max Signal Wait Seconds Longest wait at a signal, for signal plans whose red is never long enough to walk across. Default 90 s
Crossing Safety Seconds Extra seconds of free road an NPC wants beyond its walk across. Default 2 s
Crossing Max Look Seconds Longest time ahead an NPC checks approaching cars for, however wide the road. Default 7 s
Crossing Close Radius Moving vehicles this close and heading for the crossing always block it. Default 15 m

4 · Cars

Hits, knockdowns and dodges

Any City traffic, and any pawn moving faster than a walk, such as a player's car, is checked against the NPCs every frame:

  • A vehicle that touches an NPC at 2.5 m/s or more knocks it down. Damage rises with speed, to a kill at 11 m/s. Slower contact is a bump.
  • A knocked-down NPC becomes a ragdoll, lies for 4 seconds and gets up where it came to rest, playing its type's Get Up Montage if it has one.
  • A dead NPC stays as a corpse for 20 seconds.
  • NPCs already on the road run on or back when a car comes. A car mounting the sidewalk makes the NPCs in its path jump aside.
  • Every hit is a Crash: people within 25 m react with their type's weights.

Ragdolls need a physics asset. The mannequin meshes use PA_Mannequin. Give your own meshes one too, or knocked-down NPCs can't fall.

▾ AnyNpcManager > Simulation Settings > Hits

Hit Min Speed Slowest vehicle that knocks an NPC down. Default 250 cm/s
Lethal Hit Speed Speed whose hit takes all of an NPC's health; slower hits take a share. Default 1100 cm/s
Knockdown Seconds How long a knocked-down NPC lies before getting up. Default 4 s
Get Up Seconds How long the get-up takes before the NPC moves again. Default 2 s
Corpse Seconds How long a corpse stays before it is removed. Default 20 s

Next: set how each kind of NPC looks, moves and reacts, and put your own characters on the street.