Ludum Dare 45 Post Mortem
A short post mortem of my Ludum Dare 45 game09.10.2019 - 17:57
At the end of august when ludum dare normally would have been if it didn't switch to a twice per year schedule I got the itch to participate again, but because it was only happening in october I forgot about it again. Then on Friday evening after I finished working on my game I opened twitch 2 minutes before midnight (the starting time in europe) and saw Quill18 streaming in the science&technology section, clicked on his stream and saw that ludum dare was happening this weekend. So I decided to participate very spontaneously.
The theme this time was "Start With Nothing", which pretty much allows for every type of game, because in basically every game you start with nothing or very little and go from there. In RPGs you start with a naked character and progress from there, in strategy games you start with an empty map and build things and battle royals are very typical of starting with nothing. When I was scrambling to find an idea I thought of "The Ranch", which I was watching again recently and they had a drought and were hoping for rain and even the last two european summers were extremely dry. So my idea was to take a desert and turn it green, starting with no water and trying to irrigate the area.
In past Ludum Dares I have been switching between C++ and HTML 5. HTML 5 has the advantage of being able to participate in the Compo because I don't have a lot of preexisting code that I cannot share and additionally it is very nice to judge for others, because people don't need to download and execute anything on their own computer. But I always feel limited with HTML 5 because it doesn't have the performance of native C++ and OpenGL. And because I was working a lot on my own game and made a lot of improvements to my engine I wanted to use it again for Ludum Dare (although most of the improvements were for 3D and not 2D), it's always a nice benchmark of the state of my code.
However, I cannot really share the code of my engine, not necessarily because I don't want to, but it's over 10 different libs, which all depend on each other, I don't use github, so they aren't hosted anywhere and a lot of the code is extremely messy and I don't have the time to go over everything and make sure it's ok to share. And even just sharing the binary libs isn't feasible, because they are over 500mb and nobody wants to download that and I don't even know whether that would be allowed for the Compo.
So, I cannot compete in the Compo and have to participate in the Jam, but I prefer the rules of the Compo so I constrain myself to the same 48 hours and having to create everything within these hours.
The first little bit of every new project is always tedious. Copying my template project, adjusting some settings, adding a few libs that I changed since I created the template project, creating a few skeleton classes that I am going to need later and copying some code from other projects. After that I had a small quad and a camera that I could move around and a basic ui with a sample button. I started with the map and made a bigger tiled map. However, I knew I wanted a custom shader for it to have a smooth irrigation effect, so I also made a custom map shader that also gets a moisture buffer which tells it on a scale from 0 to 1 how green the tile is supposed to be. I am using a texture array and every desert tile has a corresponding grass tile and the shader mixes between them according to the moisture level.
Then I worked on the building mechanic, which is quite straight forward, take the mouse click, adjust the coords with the camera translation and convert them to tile coordinates. I added a Building super class that all the different building types can inherit from and stored a list of buildings in the map class. The building sprites are in the same tilemap as the ground tiles so to render them I just add another quad to the map, which has always a moisture level of 0 so it is always fully visible (I forgot that part at first and my buildings turned transparent^^).
The first building I created was the well, which not only pumps up water and adds it to the stored water currency, but it also irrigates the tiles next to it. In the init function of the Well it stores a list of pointers to the moisture levels of the tiles in its radius and then every update tick it increases the moisture level a little bit. With this I was able to test the map shader and it worked quite nicely.
From there I added the apple tree that produces apples from time to time that are sold to give the player money. I also added the water tank which increases the water storage capacity and a plastic water tank, which is just an easter egg telling people not to use plastic.
To irrigate a bigger part of the map I added a sprinkler that just irrigates a larger area than the well.
Just having an empty desert that turns green over time wouldn't feel very alive, so I also added the ability to buy animals and have them live on the property. They are just static sprites, which move around randomly. Every animals has a special action, like milking a cow or collecting eggs from a chicken, which can be triggered from the animal window, that appears when clicking on an animal. However, the special action can only be triggered if the happiness of the animal is above 50%, and the animals only get happier when they are on green tiles and are getting less happy when they are not.
Because having to click through multiple animals every few seconds to manually trigger their special action would be very tedious, I also added another building - the barn - that automatically triggers the special action from animals in its range.
The animal window also shows a Slaughter option, but because animals are not killed for their meat in this imaginary country, it only triggers an error popup. The only way to get rid of an animal is to release it into the wild. As another little easter egg, llamas do not have the slaughter option, but instead have the option to participate in a llama beauty contest, where they can win money for the player.
One of the first points I wrote down when I was gathering some ideas at the beginning was having some kind of weather cycle. The game starts with the default weather of a mix between sunshine and clouds, but it can also randomly change every 15 seconds to either full on drought or rain. When the weather is in drought mode, the stored water is slowly being used and when it is raining the complete desert gets slightly greener. I also added a rainwater collector building, that collects a lot of water very quickly when it is raining. To make the current weather type more unique I added a global color to the shaders, which is a bright gray on overcast days, a dark gray when it is raining and white when there is pure sunshine. However, having the color switch instantly looked very bad, so I made it change slowly over a few seconds, which is a very nice effect.
The sound effects for the game were a little bit of a problem. I don't have easy access to any of the animals, so I had to try to make their sounds myself, which is very difficult, especially for llamas who according to my quick youtube search don't make any really distinguishable sounds, but at least they turned out quite funny (at least for myself). For the building sound effect I just took a walnut and hit it on my desk a few times. For the music I used wolfram tones again, which can create some decent music pieces very quickly and easily. And the rain sound effect was also easy, I just recorded the shower for a few seconds.
When I added the sounds to the game I encountered a bit of a problem. My audio library, which I had overhauled a few months ago for my bigger game, didn't work with the small ludum dare game, because the main thread didn't need to load a lot of assets, so the audio thread didn't have time to finish loading the audio files before the main thread wanted to create a source from them and the game crashed. Because there was no easy fix, I used my old audio system instead, but it was lacking some features, so I decided later that I was going to use the 3rd day to fix my audio system.
One of the last things still missing, was a UI design. I went for a simple brown in brown style to give it a slightly rustic ranch feeling. The Top UI shows the stored water and the money as well as the current weather status. The building UI has all of the building buttons, which are just the building sprite on a simple button. Additionally I added a hover popup for all the building buttons, that show how much the building costs and a small description of what it does. Finally, I added a simple start ui with some simple instructions for the game.
The map was looking very boring without anything on it, so I made a few cactus and tree sprites and added them to the map when it is created, which made it look a lot better. And I also added a restart button, if the player got stuck for some reason or just wants to try again. Finally, to prevent players from getting stuck (I hope), I made a very short tutorial section telling the player to start with a well and place an apple tree next to it, so the player has an income of stored water an money.
The 3rd Day
After this I stopped early on the 2nd day and watched the NFL games. As mentioned above, I generally stick to the Compo rules even though I have to participate in the Jam. However, because I had the problems with my audio engine, I wanted to use the 3rd day to fix my audio library, so I figured I might as well shift a few hours from the 2nd day to the 3rd and watch football instead. I changed the way the audio thread loads audio files so when the main thread tries to create a source from an audio file that isn't loaded yet, the main thread stalls until the loading is complete.
I also made the final touches to the game today, which were mostly balancing some numbers and a little bit of polishing, but I also added a small particle effect when it is raining for better immersion.
All in all, I am quite happy with how the game turned out. Obviously there are still a lot of things that I could have done better, but for (mostly) 48 hours it's alright. Because I have to compete in the Jam while still sticking to the Compo rules, I have no chance of a top result, because the Jam allowes for multiple people in a group, who use the full 72 hours and can even use some preexisting assets (I think?), but I mostly participate for the challenge of creating a game in 48 hours and there is no price anyway, so it's just for fun.
by Christian - 09.10.2019 - 17:57