Gruedorf Post 2021-10-24
- Built a Breakout clone
- Built a platformer in the style of old DOS games
I built a clone of Breakout. You can play it online.
This one actually has a win condition! If you beat three levels you are done! I feel like this game is a little more even in terms of difficulty than Tank Attack but honestly I've never been especially good at Breakout so what do I know?
In terms of features, it's pretty standard barebones Breakout. Each brick is worth 100 points and takes one hit to break; you get a new life at certain score thresholds, etc.
I actually finished this one earlier in the week, and decided to just get started on the next. So uh...
Zombies, Bullets, and Platforms
I also built a platformer! You can play it online, too.
It features a hero wearing a bright magenta shirt, so I think we can all agree it is an instant classic. This one also has a win condition -- it's got four levels, and if you beat all four, you win! If you feel like it has no particular theming to hang the narrative together, you are correct. Thanks for noticing.
Feature-wise, it's got your standard jumping and shooting, limited health and ammo, and collectible score/money. There are five different enemy types, all with different behaviour. There's an overworld map for level selection, including gating different areas of the map behind completing a particular level. Dying in a level just shunts you back to the overworld map (and resets your ammo and money to what it was before you entered).
I had a bunch of ideas for other things to add, and I'll probably come back to it some day, but I felt like I'd reached the right point to stop with this one.
Thoughts, Feelings, and Lessons Learned
As hoped, making these small games is both helping me understand how I like to build stuff in Godot, and also giving me small drips of dopamine, so that's nice. I'm coming to realize that, while after trying a bunch of different engines, Godot ended up being the one I hate the least, I've still been fighting it and trying to stick with building things how I want to instead of what is easy and natural with the engine. I'm also finding out that I may actually be faster with Godot now than I ever was with Verge, if I actually co-operate with the engine.
I wanted to collect some notes and thoughts about the things I learned this week. Mostly, I'm writing them down to solidify them in my own head, but you never know, maybe this will help other people out too. Almost all of these come from building the platformer because I didn't bother to write any notes down while building the Breakout game because I was kind of operating in a fugue state.
AnimationTrees Will Break Your Heart
I use AnimationTrees for some of the animation handling in the game, and that may be a complete mistake -- multiple times, Godot went behind my back and messed up some of my entity scenes in a way that I needed to dig into the .tscn files directly to figure out what was what. It was like, the first time you added an instance of a given enemy to a level, it would be fine, but the second one would freak out in weird and unpredictable ways, and cause the first to glitch as well?
In any case, I eventually figured out that it was because (for some reason), the enemy scene was being saved with a relative path for some of its animation stuff which went to its parent and back in --
../Zombie/Sprite:frame for instance, when just
Sprite:frame would be correct. This meant it seemed to work as long as it retained its name of Zombie, but since Godot cannot have siblings with the same name, the second Zombie would get named
Zombie2 and it would break, both because the second one wouldn't animate correctly and it would be trying to animate the first as well.
To fix this bug I ended up manually modifying the .tscn files. Thankfully, Godot's PackedScene file format is dead simple.
A generic physics engine is great for getting going quickly, but it can be kind of a pain, even when it's specifically got special handling for games like Godot's. I'm not sure it's more of a pain than writing it all myself, but it does mean you have to sneak around behind its back sometimes. I lost a couple of hours of development time to trying to get my moving platforms to stop being pushed around by the player and bullets.
Think About Testing
Even if it's a pain, it's worth putting a little extra time into making it so you can run a level scene directly (instead of using F5 to run, you use F6). If you have autoloads that set things up, this will be a little annoying, but ultimately it will be worth it -- especially in a game like this where levels are quite discrete and some levels act as "gates" to the others.
Tool scripts in Godot are when you mark a script (with the
tool keyword) as running in the editor as well as in the game. Since Godot's IDE is actually written in Godot itself, this means you can do whatever you want within the editor, with the full runtime engine available -- including the current scene tree and the editor UI.
They're something I've dabbled in a little with Godot, but not as much as I'd like. They seem incredibly powerful for custom ad hoc stuff. In this case I added a couple of small things like making sure (some of) the enemies would face in the right direction to make it easier to see how they would interact with the player, and drawing a bounding box in the level based on where its camera bounds were set up. I need to try to do more with them!
- Cheat codes: you're going to want them for testing. Maybe I left them in my games when I shipped them?
- Consider using separate tilesets for your foreground and background tilemaps. Maybe then I'd stop drawing them into the wrong frigging layers.
- Draw all your sprites facing the same direction instead of picking a random one each time, maybe?
That's it for this week! I'm not sure exactly what I'll tackle next, but I've been adding ideas to a list whenever I think of another game I'd like to remake or a problem I'd like to tackle or a style I'd like to try, and it's getting pretty long already!
I probably WON'T try to do two games next week. I was having a lot of fun (... most of the time) working on the games this week, but I don't want to burn myself out even further -- if I only get one done next week (or if I take two weeks to build the next one!) I'm not going to be too hard on myself.