Top
Best
New

Posted by FinnKuhn 8 hours ago

How Pizza Tycoon simulated traffic on a 25 MHz CPU(pizzalegacy.nl)
238 points | 48 commentspage 2
hilti 5 hours ago|
I love these posts, because I always wanted to get into game development and never found spare time. Thank you so much!
kilroy123 6 hours ago||
I don't have much to add except to say, I love this trend of people rebuilding old games like this. I hope to see a lot more of this.
thire 4 hours ago||
Is it me or the last gif actually displays a bug? there is a brown car stuck in the middle and other cars are moving through it
ge96 6 hours ago||
I see some cars disappearing

edit: actually if it hits an end of a road, it spawns to a lane next to it either goes opposite direction or turns (referencing first gif)

Wonder if they could have considered ensuring no cars stack on top of each other

cowomaly 6 hours ago|
There are some rules where in their collision detection they basically don't check; for example cars going east will never intersect with cars going south so just drive through them. I'm not sure if this was an optimisation to just speed up collision detection by checking fewer cases or they were trying to prevent too many traffic jams by having better collision detection. Probably a bit of both :)
timcobb 5 hours ago||
> Maybe 20 or 30 tiny sprites at a time, but they navigate the road network, queue behind each other at intersections, and generally look like a living city. Yes, it was a bit buggy because sometimes they would drive through each other, but it was good enough to just give some sense of life to the map. All that on a 25 MHz 386 CPU.

is that much of anything for a 25MHz CPU? We're talking about something cycling 25 million times per second, surely that's not such a big deal for a 386?

leecommamichael 1 hour ago|
Thank you for writing effectively what I was curious about. "Simulating traffic" can mean a lot of things, I remember on the old SimCity they just "colored" each road-tile as red/yellow/green, (no doubt from a ternary flag) and the visuals just sort of blended between the states (car density.)

Being able to do millions of things each second should enable all sorts of behaviors, especially for a game of the era when you asked the OS to kindly step aside while you run your program.

timcobb 4 minutes ago||
> especially for a game of the era when you asked the OS to kindly step aside while you run your program.

totally! I was also wondering this. I know each operation takes some number of cycles, but there's still 25,000,000 of them happening per second, and there's no multi-tasking... :shrug: :)

jszymborski 7 hours ago||
I couldn't understand why someone would want to reimplement Pizza Tycoon, until I realized I played it's sequel as a child, which is much maligned compared to the original.
cowomaly 7 hours ago|
I tried the sequels and they never clicked for me either. Probably also due to the missing nostalgia factor :)

As to why I did this; when I had some time between university and starting a job many years ago I was looking for a hobby coding project and was inspired by TTDPatch and OpenTTD so I figured I'd do the same but for Pizza Tycoon. No specific reason other than that I played the game a lot as a teenager and there were some small things that I found annoying, so I saw some room for quality of life improvements. Fully aware that not many people care about this game (also didn't really expect to really get very far tbh), but still I had (and have) a lot of fun and learned a lot in the process of writing a modern engine for this.

jszymborski 6 hours ago||
Pizza Tycoon, while not the most famous game, is still very well regarded! I've only played Pizza Tycoon/Connection 2, and so I don't think nostalgia is why I didn't love it. That said, something about it stuck with me over all these years (I ended up purchasing it again as an adult on GOG, long having lost the disk).

Good luck! It's not always about the destination :P

chajath 2 hours ago||
[dead]
seriousmountain 5 hours ago||
This is a really nice observation. It reminds me of how cellular automata traffic models work in general — instead of giving each car a brain, you encode the rules into the cells and the car just asks "what does this cell tell me to do?" Way cheaper than pathfinding, and the emergent behavior from simple local rules often ends up looking more natural than scripted AI would. The constraint of a 25 MHz CPU basically forced them into the more elegant solution.
fedorsapronov 6 hours ago|
Fascinating how constraint breeds elegance. 25 MHz forces you to find O(1) or O(log n) solutions where modern devs would reach for O(n²) and more hardware.

Same principle applies to on-chain computation: gas costs force you to find closed-form solutions. For example, computing φⁿ (golden ratio to the power n) naively requires n multiplications. Using the matrix identity [[1,1],[1,0]]^n via repeated squaring gives you O(log n) — and the Fibonacci numbers fall out for free. The old game devs would have appreciated EVM constraints.