RC RANDOM CHAOS

Inside Fast Food Tycoon 2: Reverse Engineering with AI

· via Hacker News

Original source

Decompiling Fast Food Tycoon 2: Drawing the World

Hacker News →

The author combined Ghidra’s disassembly with GPT-6.1 in an automated agent loop to reverse engineer the 2001 game. Over 9.5MB of decompiled code was indexed in SQLite with custom search tools. The breakthrough came from using Windows’ ReadProcessMemory API to observe live game state—camera position, cash values, selected buildings—then matching those memory addresses to the decompiled code. By patching the game’s message handler, they could inject commands directly into the game loop, allowing the agent to control menus, move the camera, and advance time without touching the executable.

The game employed several rendering optimizations suited to 2001 hardware. A dirty-region system tracked which screen areas needed repainting, avoiding expensive full redraws. The renderer executed multiple passes to handle layering correctly, temporarily marking hidden characters to preserve their silhouettes before drawing overlapping objects. The lighting system cycled through brightness values from 70 at night to 251 during daytime on an hourly schedule. Individual lamps switched on and off based on thresholds tied to their object IDs, creating a ripple effect as the city transitioned between day and night. Each building maintained separate light masks that kept windows and signs bright even as the rest of the structure darkened.

The code revealed systems that gave the city a sense of living continuity. Citizens received daily schedules upon creation that never reset—an office worker routed to a cinema in the afternoon would return there repeatedly. Character types followed stereotypes: goths avoided daytime, students haunted bars at night, and business figures frequented opera houses during evening hours. All character motion came from pre-drawn sprite sheets with named animation sequences. These sequences stored precise decimal movement vectors, allowing the renderer to advance sprites in pixel-perfect sync with their animation frames.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.