Bug hunt: Why you only need Paris to beat Pizza Tycoon (1994)

cowomaly1 pts0 comments

Bug hunt: Why you only need Paris to beat Pizza Tycoon (1994) — Pizza Legacy Blog

The new release of<br>Pizza Legacy v0.1.0 introduces the ability to win the<br>game, just like the original.

How to win the game is a question I hadn't really considered<br>when playing Pizza Tycoon (1994) in my childhood. I<br>had fun just opening restaurants and designing pizzas, aided by a<br>healthy dose of arms dealing to fund the expansion of my pizza<br>empire. But winning? Never happened, probably never thought about<br>it.

As I started the reimplementation project I looked at the data<br>files that come with Pizza Tycoon and found the<br>graphic file ENDE.VGA and the text file ENDE.E,<br>which tell us what happens when you win:

ENDE.VGA (ende being German for end).

The first line of ENDE.E:

You have achieved the unthinkable!<br>You are King of the whole Western fast food market! You are the<br>one, the only PIZZA TYCOON.

So although this makes it clear that there is a way to win the<br>game, it doesn't tell us how exactly (other than being the<br>king of the whole western fast food market, but that could<br>mean a lot of things).

I just ignored this question for a long time since I had so much<br>to implement before even worrying about how the player would win,<br>but at some point I came across a Reddit post titled<br>'beat' Pizza Tycoon? (Why did this happen?). After<br>finding this post I got curious, but not curious enough to do a<br>proper investigation, so I looked up the game-over conditions<br>in the assembly and used Claude to analyse it, which<br>suggested:

end_of_week_processing checks once per week<br>whether the current player has >= 5% market share in ALL 10<br>cities .

This fit my mental model: it made sense from a gameplay<br>perspective and it fit with the text I had seen from<br>ENDE.E. It didn't match what the Reddit user was reporting<br>though, claiming only to have restaurants in Paris and Berlin, but<br>maybe they had omitted some details about what they were doing, or<br>had a corrupt save game? I reached out but didn't hear back.

Something doesn't add up

Later, during playtesting of my own engine I was watching Pizza Tycoon -<br>Worldwide Pizza King - Episode Ten, which shows YouTuber<br>AppleSauce playing in Paris when suddenly the win sequence<br>triggered.

Because the entire playthrough leading to their victory was<br>recorded, I could clearly see that they did not in fact have<br>restaurants in all cities in the game, so something else was going<br>on. I was now actually getting closer to needing to implement the<br>winning scenario in Pizza Legacy, so, back to the assembly for a proper<br>in-depth look to see what was going on.

The relevant code lives in a function I named<br>end_of_week_processing (I've spent the past 15 years<br>slowly documenting the assembly of the game's executable PT.EXE; the<br>names are mine or IDA generated). This function is called once per<br>in-game week for each human player, and it does things like checking<br>for bankruptcy, weekly profit transfers of the cities you're not<br>currently in, and the victory condition check.

Screenshot of IDA (The Interactive Disassembler) showing the<br>code below in graph view.

The victory condition check is the following:

loc_546CD:<br>xor bl, bl ; city index = 0 (Paris)<br>jmp short loc_546F3 ; start loop

loc_546D1:<br>movzx eax, bh ; bh = current player index<br>imul eax, 0x0A ; player * 10 (10 cities)<br>movzx edx, bl ; city index<br>cmp byte ptr marketshare_percentages[edx+eax], 5<br>jb short loc_546F8 ; market share loc_546F3:<br>cmp bl, 0x0A ; loop while city jb short loc_546D1 ; jump to loop implementation

loc_546F8: ; post-loop code<br>movzx edx, bh<br>...

In C that would look something like:

int number_of_cities = 10;<br>for (int city_id = 0; city_id

The issue is that<br>schedule_fullscreen_status_update(GAME_OVER_YOU_WON) executes<br>inside the loop instead of after successful completion. This<br>wasn't "all cities need at least 5% market share". All<br>you need is city 0 to have at least 5% market share!

Testing it myself

This new understanding explains both the Reddit post and the<br>YouTube video. To be sure, I tested it myself, and indeed in my own<br>save game with more than 5% market share in six different cities<br>nothing happened until I also opened a couple of restaurants in<br>Paris, and boom, for the first time in my life, I had won Pizza<br>Tycoon.<br>I was curious to see if this behavior was the same<br>in the original Pizza Connection (in German).

I could have tried to verify this in the German executable as<br>well, but I've only documented the assembly of the English PT.EXE;<br>the German PC.EXE was built with a different compiler and has a<br>very different layout, so locating the equivalent victory-condition<br>code would have required a substantial amount of reverse<br>engineering. Instead I tried to just reach at least 5% market share<br>in Paris through playing.

To get my market share up quickly (because I was investigating,<br>not looking to spend an evening actually playing the game), I<br>needed money. The fastest way is weapons dealing: buy cheap,<br>sell expensive, hope you don't...

pizza game market tycoon paris share

Related Articles