I've been writing a bit in my project Devlog on the Final Storm project, but I don't think anyone views those things. I think if I post here there might be a bigger since of accountability since more eyes tend to peruse this area. And with 2 weeks left until release, I'm in crunch mode and thought I'd use the log as a "debrief". I'm going to try to post daily between now and release.. If I don't, someone should call me out on it :)
As I mentioned in the previous devlog, optimizations were something I really wanted to look into. Let me be clear - the game runs very well on my 5 year old laptop, but it also has an NVIDIA GTX 660 in it. I've tested on a few more laptops from the same era (2012) with integrated Intel graphics and also an android build on my 2013 Nexus 5 and the game runs but not AS smooth. I wanted to change that. So yesterday and today I did a few things.
1 - I was using KinematicBody2D for all of the bullets and that was really unnecessary. I did it in the spirit of "make it work, optimize later". Well now is later. So my first optimization was to remove that and back up to an Area2D implementation that I had read was faster. It was in fact faster (I didn't measure, but performance improvement was obvious just by playing on the low end devices).
2 - Next I looked at memory pooling. Rather than instancing and destroying every node as needed I thought I'd create a pool of bullets and "borrow and return" them. I grabbed a pool implementation no github (MIT license) for the Godot engine and the code looked reasonable, but when I tied it in, the performance was abysmal! It was at this time someone on Discord pointed out that Godot had a "Shower of Bullets" demo that I should checkout.
3 - Shower of Bullets took a different approach. It created a bullet manager (sort of like a pool) but didn't create a bunch of scene nodes to represent the bullets. Instead the manager entity was the only node - and it would draw all the bullets in it's draw function, and "tap into" the Physics Engine notifying the engine where the bullets were and where they were moving. This seemed perfect. I tied it in, and on my worst performing device (Android), performance was smooth as silk! But there was a problem. The collision detection events were not delivering any information on which bullet hit it's target! Upon examining this with a few developers on Discord, we THINK this is an engine bug. So I posted an issue on github about it. I did pull up the engine code but at this point with 2 weeks left, I have too many other things to code before worrying about that. It'll have to wait until I get the remaining features in the game.
4 - With only the one optimization (Area2D) in place I figured I could also reduce draw calls on the bullets. The bullets were layering a few sprites together to create lighting effects and so I was able to merge them effectively cutting the number of sprites drawn per bullet by at least half! That's a big savings in itself.
So with that done I turned to do some light graphics work today. The game needed a splash screen to replace the default splash screen so I threw this together - I'm not sure if it's final or not - I'll probably iterate on it but it's a start. I wanted to make sure to get the "Powered By Godot" in there because I'd really like to build awareness for that engine. That engine is making incredible strides daily!
WARNING - NOT MY FINEST WORK
I also didn't like the fact that I was using the same graphics for Rail Gunners and Sentinels so I busted out the GIMP and created a new Rail Gunner graphic that I think will do the trick:
That said I'm continually amazed at how nice tools like GIMP, Krita, Blender and Godot are.
Well - that's it for tonight - Tomorrow I'm going to start putting in logic for boss battles and try to wrangle together at least one boss. I'm also thinking about throwing achievements in there :)