Pangram verdict · v3.3
We believe that this entire text is human-written.
AI likelihood · overall
HumanArticle text · 1,520 words · 2 segments analyzed
Seven years ago I decided to start learning how to make a game from scratch. And last week I released Satelital, a rule-discovery game about learning alien logic. As a solo developer, I decided to start this project from scratch. My motivation was to learn the actual fundamentals behind the technology of videogames. This meant I had to build most of the tools I would need myself, including the game engine, renderer, puzzles, editors, UX, design, art and music. Now that I've finally managed to release the game, I think it's a good moment to share how I built it. The main reason I got into programming was the idea of eventually working on games. I spent many years working on web and building mobile apps. It was fun, but I felt like I wasn't going in the direction I really wanted to. So one day, after listening to every Jonathan Blow talk I could find and playing too much The Witness, I decided to finally give it a try. I spent many days and countless hours looking for the best tool I could use to make a game, but nothing left me satisfied. The closest I got to having fun with gamedev was with the LÖVE framework making a few jam games. But even with that, it felt quite limiting to not really know what was happening behind the graphics I somehow managed to animate on my screen. Early prototype of a tile-based level editor built with LÖVE and Lua I remember hearing about shaders and parallel programming. The concept always felt very arcane and mysterious to me, but now writing them is the thing I enjoy the most while coding. I finally decided to jump into the swimming pool and actually learn C++. I had to learn how to manage memory and how not to shoot myself in the foot with the wrong tools. I started using SDL2 while trying to use the C++ standard library as little as possible. Before getting too deep into the engine, I actually finished a prototype of the puzzles not long after learning how to draw some simple graphics with C++. It had very early versions of four kinds of puzzles that mostly survived until the final game. It was made entirely with SDL2, but I soon realised that if I wanted more interesting graphics, I would need to use shaders and decided to switch to OpenGL. Early prototype gameplay with SDL2 This puzzle was the first one I made, also the only one that survived until the end With the help of LearnOpenGL I quickly had a triangle on the screen. From there, learning things like lighting, tonemapping, normal maps, shader effects and everything else opened up a whole new way of looking at computers for me. Before, my idea of how a computer actually draws to the screen was quite naive. When I started learning graphics I just wanted to be able to manually change the color of each pixel individually, but in the end the idea of running a program in parallel for every pixel clicked for me. One thing that made a huge difference while working on shaders was having code reloading. Before that, I had a complex system that stored constant values in config files, which would later get passed through uniforms into shaders. Then a custom development menu would provide some UI to tweak those values at runtime. With that I stopped having to reload and compile everything for every little change I wanted to make. It worked, but having to maintain all this extra scaffolding was slowing me down. Another unexpected downside of this setup was that, in some cases, the shader compiler couldn't optimize the code as well as it otherwise could, since knowing constant values ahead of time helps it make better decisions. Having shader reloading made a huge difference. Being able to change some code, save the file and immediately see the result on screen was very useful. Iterating on shaders became much faster and more fun. This was probably my biggest regret about not having it from day one. Color modification preview using shader hot reloading For a big part of the development I was using SDL2, mainly to create a window, read input and get a surface to draw on. But it felt wrong to depend on a library that was several times bigger than my entire game just to handle a few seemingly simple tasks. I decided to drop that dependency and make my own platform layer that I could understand and maintain. I wouldn't have to wait for someone else to fix a bug anymore because now I could just change it myself. It wasn't that hard to end up with a single file with a few thousand lines of code that supported both macOS and Windows. I'm now looking forward to working on mobile and console ports, it feels like it might be a fun thing to work on. At some point during development, compile times were getting longer, so I decided to look into what was going on. I checked where all that time was going, and to my surprise a lot of it was spent compiling standard library things. Stuff like std::function was particularly slow for example. Eventually I realised that I wasn't actually forced to use the standard library just because it was there, and the subset I needed wasn't that hard to implement myself. It took me a month to replace it with my own base library, but it was so worth it. Not only did compile times get faster, but I also learned how a lot of things I had always taken for granted in other languages actually worked. At some point I started looking into Vulkan because I wanted HDR. I couldn't get it working on macOS through OpenGL and I was worried about OpenGL being deprecated in the future. Also I didn't really want to build the whole engine around an API that might become deprecated. Testing alpha blending with my first Vulkan triangles Moving to Vulkan was rough at the beginning. There was so much boilerplate to type and understand. Also, when I started working on the engine, there wasn't much documentation around how to implement a good backend with it. In hindsight, I feel that even though I got a lot of valuable things from tutorials and books, most of them were overcomplicating something that could be much more straightforward. I still have nightmares about trying to resize a window... Getting Vulkan working on macOS was actually surprisingly easy thanks to MoltenVK. It was nice not having to learn Metal and being able to keep the same codebase on Windows. The engine started out only working on macOS, so I was afraid I'd run into a lot of issues when porting it to Windows. But I was quite nice to see Vulkan just working the same day I tried it. Funny looking bug I got doing the Vulkan port My philosophy from day one was to only grow the engine towards exactly what I needed. This was a long solo project, so trying to build a general purpose engine first, without knowing what I needed, would probably have meant never finishing the game. I did waste time on things I thought I would need, but I cut them when I knew I wouldn't be using them. Because I was also learning C/C++ along the way, I made many coding mistakes but I wasn't afraid of big refactors. Cleaning the codebase helped me bring up my morale. From the beginning I wanted to avoid making a 3D engine since I knew that might complicate things too much. But after I finished the prototype, I kept learning about shader techniques and effects. So in the end, my goal was to get as close as possible to a 3D look without actually having to load any 3D polygons. To do this, I chose an orthographic top-down view so I could just prerender the assets in Blender and then load their albedo, normal and height maps as textures. Having a fixed camera meant I could render all the assets from exactly the same perspective, so they would always fit together properly in the game. Other things that needed to be animated were drawn in the pixel shader using SDFs. The terrain of the planets was too big to be stored entirely in textures, so in most cases I had to procedurally generate them in shaders too. Final frame Albedo Normals Light & Shadows Since I wanted a 3D look with dynamic lighting, I also needed dynamic shadows. The final approach I settled on was ray marching. With the height map of each prop, I could make them look as if they were actually sitting in a 3D space, even though everything was still rendered in 2D. In the shader I basically march along the direction of the light and sample the height map to figure out where a shadow should be drawn.
Having the height map was also useful for other things.