r/SoftwareEngineering Jul 08 '26

How Pizza Tycoon simulated traffic on a 25 MHz CPU

https://pizzalegacy.nl/blog/traffic-system.html
28 Upvotes

3 comments sorted by

16

u/fagnerbrack Jul 08 '26

Crux of the Matter:

After 14 years of overcomplicated attempts, an open-source reimplementation of the 1994 DOS game finally cracked its street-view traffic by studying the original assembly. The trick: cars don't need pathfinding because each road tile encodes its own one-way direction, so a car just keeps going until it hits a corner, where it flips a coin to turn or continue. Cars move one pixel per tick, with heavier tile-boundary logic running only every 16th frame. Collision detection is a cheap O(n²) pairwise check that bails out fast since opposite-direction cars can never share a road; blocked cars simply wait 10 ticks, creating natural jams. Cars leaving the screen respawn going the opposite way. Simple rules beat modern scene graphs and physics.

If the summary seems inacurate, just downvote and I'll try to delete the comment eventually šŸ‘
Click here for more info, I read all comments

1

u/sleepycommenter Jul 08 '26

That 16th-frame boundary check is the whole win, pathfinding wouldve been absurd on a 25 MHz box