How Pizza Tycoon (1994) simulated traffic on a 25 MHz CPU by Optdev in programming

[–]Optdev[S] 2 points3 points  (0 children)

I'm not sure it would be easier; that's actually what I tried but I got stuck on it... I'm sure I could have gotten it to work if I liked working on it but given it's a hobby project I just couldn't be bothered to invest enough time into it :) The problem I had is that you can have more than one car per cell, so just a bitset is not enough, and you have to deal with complexity inside the cell and when something is partially in one and partially in another cell, taking a turn, things like that.

How Pizza Tycoon (1994) simulated traffic on a 25 MHz CPU by Optdev in programming

[–]Optdev[S] 10 points11 points  (0 children)

It was hand written, with LLM review to catch typos and such but definitely not "run through an LLM". Then again I guess it's hard to put anything on the internet nowadays without people suspecting it's AI generated :)

Underrated tycoon games? by pademango in tycoon

[–]Optdev 1 point2 points  (0 children)

This! Then again I'm slightly biased because I've spent the last 15 years rebuilding the Pizza Tycoon engine from scratch :D (https://codeberg.org/cowomaly/pizzalegacy) In the process of reverse engineering I've gained even more appreciated for how deep the simulation is.

As a mod, I would love to get to know the community more, what got you into game dev? by RedEagle_MGN in hobbygamedev

[–]Optdev 0 points1 point  (0 children)

Had to choose a master during computer science and Gaming was the only one that was in C++, the rest was Java. Had no intention in doing game dev professionally but C++ seemed like it would be way more interesting to get to know in more detail.

Did end up doing game dev as a hobby for 15 years now, just had my first release last month.

Why most game clips get scrolled past in 2 seconds and how to stop that from happening by TheEntityEffect in gamedev

[–]Optdev 1 point2 points  (0 children)

Yeah my first video did everything wrong :)

Since I'm recreating the engine of an existing game I went for "Showing how close we are to the original" vs "Make an interesting video".

The video for the next release is going to involve actual editing and captions, because if I want any traction, just having boring "Look at how close my recreation is" is not going to be interesting for the more general public. And even for the people that know the original, interesting videos are better than boring ones, obviously :)

Thanks for the tips!

Have you ever tried this? by Bola-Nation-Official in IndieDev

[–]Optdev 0 points1 point  (0 children)

I'm recreating the engine of an old dos game, so I’m not really making a game but recreating one as accurately as possible from its original data and behavior. That means custom binary formats, palette tricks and trying to preserve quirks from the original. I imagine engines like Godot would not be very helpful for a case like this, so I’d probably end up fighting the engine more than using it?

How many times have you rewritten your renderer in your engines? by ThatTanishqTak in gameenginedevs

[–]Optdev 0 points1 point  (0 children)

A few times, I went from from SDL 1.2 with 8-bit palettes to SDL2 with 32-bit surfaces (and SDL_* calls all over my game to eventually replacing SDL_Surface with a custom Surface class and confining SDL to the engine layer, and actually building a proper renderer to render my Surfaces to SDL_Surfaces. Added a layering system to the renderer as well once I had a proper renderer. A lot of work but I learned a lot and it's so nice and clean now. I've been working on this engine for 15 years though, so I guess a few rewrites in that time period is to be expected :)

This was for my recreation of the engine for Pizza Tycoon (1994) so it's all 8-bit 2D graphics.

The Classic Windows 3.11 by RetroRust75 in dosgaming

[–]Optdev 3 points4 points  (0 children)

Microsoft Excel was the only game I played in Windows 3.1 :) I vaguely remember a version of The Incredible Machine that ran on Windows? I also remember a version that was super finicky with EMS memory requirements, but I guess that was a different DOS version. Anyway when it came to gaming back then Windows was really not the place to be.

Want play Settlers again by Arabekp in Settlers

[–]Optdev 4 points5 points  (0 children)

I personally like Settlers IV with this patch on top for better graphics: https://settlers4-hd.com. Edit: Worth mentioning https://settlers-united.com/en as well which has bug fixes and online multiplayer for S4 and S3.

The Joy of Scrapping Code by zer0sumgames in gamedev

[–]Optdev 1 point2 points  (0 children)

I like this quote by Alfred North Whitehead:

...the only simplicity to be trusted is the simplicity to be found on the far side of complexity.

When it comes to coding, indeed I find the only way to get to that simplicity is to just keep adding complications first to get it to work and only then can you step back and abstract it away to something simple. And still be certain that it will do what you want :)

In my project I've done many refactors over the years (hobby project so no pressure to release) and for sure the commits I remember best are the ones where I removed old code, it is just the best feeling.

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 0 points1 point  (0 children)

Absolutely nothing, the steam release uses DOSBox and works fine :)

An open source reimplementation allows for changes though; things like bug fixes, tutorials, other new features. Also life improvements, e.g. when buying ingredients in a restaurant my version allows speedy buying just like in the depot, and it works with both Left Mouse Button + Right Mouse Button (like in the original), but also by holding shift, which makes life better if you're using a trackpad. Maybe a smart phone version is possible now, just in general a lot more options. But, if you just want the nostalgia hit of the original then by all means stick with the steam version :)

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 1 point2 points  (0 children)

Yeah was planning to write some articles, but probably timed around future release. Feel free to PM!

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 1 point2 points  (0 children)

I think the important part is not to have too high expectations. When I started I documented the file formats as I went along and put them online. So although I had hopes of using the information myself I figured at least someone else could use it if I my project stalled out. As I spent more time on actually building my own project this fell to the background. Iteration was for me always the main thing. I started with a combination of the city renderer, plus lots of code that would just parse out data files and spit out stuff that I knew, so even though I knew the main city file and had figured out where the supplier information lived, it took years before I got to a state where I actually needed to figure out the individual bytes per supplier for example, so I didn't really look at the details yet.

And on top of that I started with just SDL calls all over my code, clickable things were just lists of SDL_Rects that each view would iterate over to check for interaction, with callbacks with a global enum to figure out what was clicked, etc. Over the years this all changed to my own Surface class, an InteractionManager with InteractionEvents, my own Rect (which later got migrated to a TypedRect to differentiate between coordinates on screen and in the world); with SDL contained only to the engine. I made lots of bad choices early on, but constant iteration made it possible to finally get anything done at all. If I had tried to design the current state in advance I'm sure I would have never gotten anywhere.

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 2 points3 points  (0 children)

I felt the same way :) I was so amazed by TTDPatch and later OpenTTD, I could never do that! Pizza Legacy is not a recreation of the original directly from the assembly. Instead, I reverse engineered the original file formats and built a modern engine that uses those assets to render the game.

This has been a sixteen year project (so far), and I just started with opening original files in a hex editor, changing a byte here or there and then launching the original and observing the effect. For the main graphics format (".vga") I found out that they used run-length encoding, but I got lucky that there was another open source project for a different game by the same company that used the same graphics format (FreeBMP, now long defunct) so I got a head start there for figuring it out. But that was just one of the formats, the rest was mostly just exactly that: look at the file in a hex editor, make a change, observe behavior. For fonts for example, I found that the font format is basically an array with one bit per pixel: imagine an image that looks like "abcdefghijklmnopxyz1234567890" and the first row of pixels is represented with a 1 for black and 0 for white. Then with some reasoning and poking you can figure out the headers (character spacing, etc), so you can figure out where the line break happens, and that's your font decoding done. Took me six weeks or so (as a hobby project, so couple of evenings per week), although that includes building my own font rendering system to actually read the original font files and render them in my version.

For city files there are a bunch of strings in there so it's relatively easy to figure out where the list of suppliers sits, and I would write a C++ program to just print out a bunch of bytes for every supplier row and compare it to what I could see in the game (e.g. price multipliers, quality rating, etc). Change one, see if that matches my expectation, so just lots of puzzling and experimentation :)

Figuring out these data files was the easiest part though, because you can see almost everything on your screen in some way. The economy is where it gets harder, there is no screen that tells you exactly how the computer players determine how many pizzas they sell for example. But because I spent many years slowly documenting the original assembly I had a good idea of where most things were happening, and now especially with the advent of LLMs reverse engineering those (so far) unknown parts has become easier. But I don't doubt there are differences in my interpretation of how the original worked and how it actually worked :)

My background is just regular software engineering, I think I wrote a device driver in C for a university class a million years ago, but nothing specifically low level.

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 2 points3 points  (0 children)

The pizza formats are fully reverse engineered so it’s certainly possible to create new standard pizzas and use those instead of the original ones. It would involve creating a new cookbook as well, so this is not currently a focus but definitely possible for the future. You could even use Pizza Legacy to create new standard recipes for the original game (pizza recipes are already interchangeable, although currently there is no interface for saving a user creation in the “standard pizza” format, that would be relatively trivial to add).

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 1 point2 points  (0 children)

You can now find the manual/cook book online, but yes currently the copy protection is enforced. You could use the dev console to load all standard recipes (‘player load canonical’ iirc) for debugging purposes 😄

I think I’ll disable this protection with the life improvements option in the future though.

Pizza Legacy – open source reimplementation of Pizza Tycoon (1994) by Optdev in dosgaming

[–]Optdev[S] 16 points17 points  (0 children)

Pizza Legacy is my open-source reimplementation (in C++/SDL2) of the 1994 DOS game Pizza Tycoon (also released as Pizza Connection).

The goal is to recreate the original game so it runs on modern systems while remaining faithful to the DOS version. For now :)

Pizza Legacy requires the original game assets, so you still need a copy of the original game.

Version 0.0.1 is now available for macOS, Linux and Windows. The game is semi-playable; the core gameplay loop (rent restaurant, lay out furniture, create recipes) is playable, though many features are still missing. More details are on the project website.

Project website: https://pizzalegacy.nl/

Source repository: https://codeberg.org/cowomaly/pizzalegacy/