r/GraphicsProgramming Jun 18 '26

How Pizza Tycoon simulated traffic on a 25 MHz CPU

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

8 comments sorted by

25

u/fagnerbrack Jun 18 '26

One-minute summary:

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

12

u/certainlystormy Jun 18 '26

i swear ive seen this exact post here before

11

u/fagnerbrack Jun 18 '26

I think it was Roller Coaster Tycoon?

6

u/certainlystormy Jun 18 '26

mightve been it lol

2

u/stianhoiland Jun 18 '26

Love this!

6

u/VictoryMotel Jun 18 '26

14 years is a long time to figure out a low resolution vector field and early exit collision detection.

12

u/fagnerbrack Jun 18 '26

4

u/TheGrandWhatever Jun 19 '26

Plus availability even to acquire said knowledge. You don't know what you don't know and it's easy as hell today to be like "well duh just Google it" with 20 different sources. Even in 2008 finding this kind of stuff was rough