1. Waypoint graphs for traffic
Mark lane points along each road and connect them. A car picks a target waypoint, steers toward it and chooses the next one on arrival. At junctions, choose a random connected waypoint. This avoids pathfinding and costs very little.
Traffic System does this for you with lanes, junctions and speed limits, so you spend your time on the game instead of the plumbing.
2. Rules at junctions
- Slow down when another car is close ahead (a short forward raycast).
- Give way by priority or by a timed signal.
- Never spawn a car where the player can see it appear.
3. Pedestrians
Pedestrians can use the same idea on sidewalk waypoints, with random pauses and a few idle animations. For reactions, add a trigger that makes them flee or stare when something loud happens. Animation basics are in how to animate a character in Blender.
4. A simple wanted level
Keep a number called heat. Crimes add to it, time without crimes decays it. At thresholds, spawn police cars that chase the player using the same driving code and drop heat when they lose sight for several seconds.
heat = Mathf.Max(0f, heat - decayPerSecond * Time.deltaTime);
if (heat >= 2f && chasers < maxChasers) SpawnPoliceNearPlayer();Police weapon art can come from the police weapons pack.
5. Keep performance in budget
- Only simulate NPCs near the player and recycle those that fall behind.
- Use simple colliders and low poly meshes.
- Cap the number of active cars and walkers, and check the budget with the frame time calculator.
Questions
Use a graph of lane waypoints. Cars steer toward the next waypoint and choose a new one at junctions.
Give them sidewalk waypoints with pauses and idle animations, and add simple reactions to nearby events.
A heat value rises with crimes and decays over time. Thresholds spawn police of increasing strength.
Pedestrians can use a NavMesh for freer movement. Cars on roads are simpler and cheaper with waypoints.
Who wrote this
Imersa Studios builds the Unity systems, low poly packs and field guides sold on itch.io. The code and techniques here come from shipping those products. More about the studio.


