Adolfish post mortem

I always love reading game post mortem. Here’s mine.
Adolfish came out of my mind three years ago, while playing with some game mechanics.

The beginning

The first thing I did was using what I knew at the time, C++ and a lot of code. A lot.
I started writing the editor using SDL for the graphics layer, as I used it many times for smaller projects. The editor started to be useful around 2 or 3 months later because I had to program all the UI first.

In the first months Adolfish looked like a prototype, just a fish in a grey environment, where elements where put and tested, and looked like this until I created the physics layer, adding collisions between entities and the movement friction. The game started to be playable around the 4th month, with just a bunch of demo levels, but there were no enemies.

The middle

It was a beautiful world (more on this later), full of dump enemies, just sitting around waiting to be shoot at or avoided! So I had to use a system to make every enemy move and “think”. An AI. Even there I used something from my bag of past projects, LUA, a scripting language. Every clever function like “Shoot” or “Move” or even something like “CalcDistFromPlayer” was written in C++ and passed to LUA to be called whenever needed. Doing this the game code stayed “clear”, calling just core AI functions like events “OnIdle” or “OnDeath”, leaving the logic down to the script.

The end

Doing this, adding some shaders, removing bugs and adding some game features, the game got almost completed, except for one big thing. The fun. Adolfish always looked fun to me and to Andrea, the 2d artist, and even when presented to others, everyone said it was a good game and fun to play, they played the demo, some youtubers even made videos about it, but when we reached Kickstarter it all seamed clear. People just told us what we wanted to hear, from the beginning, and if someone told us “Hey, it sucks!” we just didn’t listen, because it was a one in a million comment, nah? Wrong.

Only when the game started to be something more than a free demo, they all started to tell us the truth. They didn’t like the name. Adolfish. Well, it was just an inside joke about my cat, Adolf, not a joke about Hitler or ww2, but you know, inside jokes should remain “inside”. So can we just change the name and fix everything? No! They didn’t like the graphics either.

Close friends tend to tell you they like it, just because you made it, but on the internet where nobody knows you, or how much work you put in it, you just have to face the ugly truth. Adolfish sucks.

A new beginning (?)

We just canceled our kickstarter campaign, it was obivious we couldn’t reach our set goal. Adolfish will never became a full game as it is right now, so we just decided to delete it. Thanks to anyone who believed in this project.

Per aspera ad astra
See you, Paolo.

Resource manager in Adolfish

When I started Adolfish I choose C++ as my project language and the SDL as my 2D library. At first I thought that the SDL library had some sort of resource management, but I was wrong! For our first demo levels this was not a problem, but as long as we started making longer levels this became a nightmare. In a simple level we had several enemies, something like 20 or 30, and for each of them the engine had to waste time loading the data and memory loading its texture, so I came up with a simple solution. The first thing was to get the filename of the resource (the filename is used as is unique to each resource) and check whether it existed in a “resource” list, if not it gets loaded and its name added to the list, otherwise the function returned just a reference of the resource. After a few tries, it worked! But what happens if we release the memory of a dead enemy? The whole level crashed! So the solution was to check if there were other enemies using those resources and to do so I added a reference counter in the resource list. When the counter goes to 0, we can safely remove the resource from the memory. Here it is a pseudo-code of the resource loader:

and a pseudo-code to release the memory: