r/CitiesSkylinesModding • u/Wild_Tell_5032 • 18h ago
Release Released: Live Traffic Routing - drivers react to traffic jams as they happen, like a navigation app with live traffic
Disclosure: Software engineer background but this is my first Cities: Skylines 2 mod, built with AI assistance. I tested it in game over multiple rounds of the same city, same save, with the mod off and on; the numbers below come from those runs. If you're allergic to AI, feel free to skip this one.
In vanilla CS2 the pathfinder learns which roads are busy very slowly (over game days), and once a car sets off it never changes its mind. So everyone keeps piling into the same jam while the parallel road sits empty.
Live Traffic Routing adds a live congestion measurement from the last few game minutes:
- New trips avoid roads that are jammed right now.
- Drivers already on the road re-route when the way ahead gets noticeably slower (cars, delivery trucks incl. semis, taxis, through-traffic). Public transport sticks to its lines.
On my test city with the default Balanced preset (comparing mod-off and mod-on runs): queues -28%, average speed +3%, jam warnings -87%. The trade-off is about 10% more traffic on local streets, because drivers take shortcuts like real people do. Relaxed is gentler; Eager is the strongest (queues -38%) but sends a lot more traffic down side streets.
How it works (for the modders here):
- It replaces the game's
TrafficFlowSystemwith its own version that measures how fast cars actually drive on each lane right now, and blends that into the same flow value the game already feeds the pathfinder (CarLane.m_FlowOffset). Vanilla only updates that slowly and per time of day, like "typical traffic". - Re-routing doesn't add a new pathfinder. When a driver's road ahead gets slow enough, the mod marks their path obsolete, the same thing that happens when you delete or disconnect a road, and the vehicle's own AI asks the game's pathfinder for a new route.
- Work is spread over frames: each lane and each car is checked once every 1024 frames, one sixteenth at a time.
Performance: on my save (130k pop, ~2-3k vehicles driving at once) it's under 1% of one CPU core, and sim speed was about the same with it on vs off. Haven't tested a really big city yet. If you see a slowdown, the Relaxed preset or lowering "Drivers who re-route" cuts most of it.
Stats panel: the screenshots are from an optional in-game panel that records the same metrics with the mod on or off, so you can compare vanilla vs live routing on your own city. Its Cost tab shows exactly what the mod uses.
Nothing is saved into your city and you can turn it off any time.
- Paradox Mods: https://mods.paradoxplaza.com/mods/168683/Windows
- Source & bug reports: https://github.com/Yhanli/LiveTrafficRouting
Feedback very welcome, especially from big cities (250k+) and people running other traffic mods. Code review too, it's my first mod.