HeadlinesBriefing favicon HeadlinesBriefing.com

Pizza Tycoon Traffic Engine: How 1994 Game Ran on 25 MHz CPU

Hacker News •
×

A developer working on Pizza Legacy, an open-source reimplementation of the 1994 DOS game Pizza Tycoon, cracked the code behind its remarkably efficient traffic simulation. The original game managed to animate 20-30 tiny cars navigating city streets on a mere 25 MHz 386 CPU, creating a convincing sense of urban life despite occasional collision bugs. After 14 years of failed attempts using modern approaches like pathfinding and collision detection, the developer finally reverse-engineered the original assembly code with help from LLMs.

The breakthrough came from understanding how the original developers sidestepped complexity. Instead of tracking destinations or implementing sophisticated collision systems, each road tile carried its own direction information. Cars simply followed the road network, making random turns at corners with a 50% chance of going straight or turning. The entire system relied on one-way roads where cars moved one pixel per frame, with heavier tile-boundary logic running only 1/16th as often. This elegant simplicity meant the game could handle traffic with minimal CPU overhead.

Collision detection used a straightforward O(n²) approach that was surprisingly efficient due to early exits - eastbound cars never checked for collisions with southbound cars since they can't physically intersect on one-way roads. Cars that drove off-screen were simply respawned going the opposite direction. The developer realized that modern concepts like scene graphs and pathfinding were unnecessary complications - the original worked because it embraced constraints rather than fighting them.