I have a love-hate relationship with refactoring. On one hand, refactoring is great because we get to clean up code in such a way where (hopefully) the outcome is having a more stable, reusable code base. On the other hand, it is very tedious, time consuming, and mentally exhausting.
For those who don’t know what refactoring is, here is a good analogy from our writer, Julianna:
It’s kind of like shucking corn — programming style. When you shuck corn; you keep what you want (the cob). Then, you can either throw away the husk, or keep it to make tamales. So, for example, the enemy system, you want to keep what you want for other villain characters, and leave what you don’t want with the original characters. Compartmentalizing, basically.
When refactoring, we want to keep the good parts, aka the cob. However, to get to the cob, we have to tear through the husk to get to what we want. Sometimes the husk isn’t all bad though — as we may want to use that for other things.
Imagine shucking corn, but with your brain — and for hours at a time. If you “shuck” the wrong part, the whole system could break. For example, a (new) bug could start occurring from removing the wrong part. This is why I say it is tedious, time consuming, and mentally exhausting!
The reward though is worth the pain. With a stabler foundation, we’re able to create more, faster. There is generally no additional bugs or things to worry about, because the system is running through the same parts, which theoretically should be clean.
So yes, the past week or so has been mostly a refactoring session. There were quite a few
TODOs in my code that needed cleaning up before the Leave of Absence. Now that we’ve been adding features at the rate we’ve been, there have been an even more
TODOs added that needed attention. The good news is most of these items are now complete, with the exception of a few far off
TODOs that are more relevant once we decide how to build a certain feature. The reward? A more polished and functioning game.
There hasn’t been a whole lot “new” added to the game this past week. However, much of what has been posted about in the last few weeks is now more stable and polished. For example, I mentioned that there was
Ice Physics when the player walks on ice. But what about the enemies? Shouldn’t they slip on it as well? Well of course! Part of refactoring was taking that code from the
Player object and making it reusable for the
Enemy object, and others as well. And may I say, fighting enemies on ice while everyone is slipping is a lot of fun!
Looking past the “refactor” commits, one new thing that came through was the three main
Soldier enemy types, as well as their color variations. The idea here is very similar to The Legend of Zelda: Breath of the Wild’s enemies. For example, Bokoblin‘s are fairly straight forward, with not too much HP, or very smart. Lizalfos are very fast, and chaotic and behavior. Moblins are slow, but generally strong and a lot of HP. For our game,
Orcs are to Bokoblins,
Reptiles are to Lizalfos, and
Minotaurs are to Moblins. In addition,
Reptiles have projectile attacks and can evade attacks, while
Moblins can perform a dash attack to knock the player over. We also added color variations as well. For each color variation, the enemy is a little stronger, smarter, and faster.
Hannah has also been sending me some additional part for the town and a snowy region. Since I love snow, I thought I would share a quick screenshot of a snow scene (nothing here but the tiles and decor tiles). It will look even more amazing once there are other assets on the screen!
I want to end this post with a sketch Hannah did of the hero, whose name we will not spoil right now: