GameDev 2019 Week 18: Bees
New Map, Spawning Attacks18.05.2019 - 17:56
I actually wrote and finished last weeks blogpost very early, because I really liked how the new water system turned out. And in the evening I created a jungle temple ruins model for a more tropical/jungle themed map.
Yet another modelling day with a bamboo plant, 3 different flower variations and a mangrove tree. And with these and some existing models it is already possible to create a decent looking jungle.
I started the day with some editor quality of life changes like hotkeys to disable the hitbox of a model to be able to click on smaller models within it, like a small flower under a big tree, and also a hotkey to reenable all hitboxes again. Then I played around with post processing effects for a little bit. I added Bloom, but it didn't look as well as I hoped, so I disabled it again and I also disabled Depth of Field, because it is a little bit redundant if there is fog. Then I started to create a new two player tropical island themed map.
The new map still needed a bit more work to be used in the game, but after a while it was ready to be loaded in the game, and... it looked wrong. There were some minor bugs in the export/import system, which needed fixing. I designed the import system with some backwards compatibility in mind, so the old map could still be loaded in the game, but to make use of some of the recent changes I also loaded it up again and added backface culling to all models, which can be backface culled, and by resaving it with the new version the paths to the water textures are now properly saved in the map and no longer hardcoded in the code. Due to some changes in the engine, a few things like projectiles, the hp bars or the gold reward popups were not rendered correctly anymore and had to be fixed. I also limited the camera rotation so it cannot go below the water anymore and set the post processing to the same as the editor. Then I added a shadow quality option, which controls the size of the shadow map. A smaller shadow map looks worse, but results in slightly higher fps, while a bigger shadow maps needs a bit more gpu performance, but looks better. Maybe I'll add a no shadow option in the future, which would increase the performance a lot more, but would require different shaders, so I haven't done it yet.
This was an all over the place day, I started by adding a default model scale to the editor, so the model scale can be set in the assetfile once, and doesn't need to be set in every single project that loads the asset file, and some more minor changes in the editor. Then I added a new attack type to the game, a spawning attack, a tower spawns some friendly entities which attack on its behalf, but I wasn't sure how I wanted to implement the friendly entities yet, so I added a gold command/cheat instead to cheat in gold for testing. And I also made a big button texture for the main menu buttons, even though I'm not entirely sure how to design the main menu yet.
Even though I still wasn't sure what the best way to do friendly entities would be, I figured implementing it in a way is better than not implementing it at all, so I just created a new class for it, even though it shares some code with normal entities or even projectiles. I may refactor some of these things if I think of a nice way to do it. Anyway with the new spawning attack and friendly entities, I was able to add a bee tower to the game, which spawns some bees periodically, when then fly off and attack the enemies. Right now they despawn when their initial target is eliminated, but I am going to add another option for them to retarget another entity. I also created a bee hive model for the tower and a bee model. The bee isn't animated itself, but it doesn't matter that much, because it is fairly small and moving fast anyway. Additionally I produced a bee sound by making weird bzzzz noises into my microphone and I though it sounded weird when listening to it by itself in audacity, but in the game context it sounded a lot nicer, especially when there are multiple bee hives and the sounds melt together like a swarm of bees.
Today I added the ability to unlock a building blueprint in the shop. It turned out to be more complicated than I thought, because I had to change the building interface and the shop, so they could be updated on the fly and not only on initialization. Adding a button to the building interface for the new button was easy, but removing the unlock item from the shop produced some nasty crashes. The shop has a big scrollable container which contains labels for each shop item and each label has a button for purchasing the item. However, clicking the button and thereby purchasing the item and removing it turned out to be a problem. My menu system saves pointers to last clicked or last mouse motioned elements so it can correctly trigger mouse leave or mouse release events. Now, when clicking the button, the label and therefore its button child get removed, but the pointers were still pointing to it and the program crashed. This seems to be a rare situation, because in all of the years of the menu system existing this apparently never happened before, so to fix it, I just added a function to clear all the pointers.
by Christian - 18.05.2019 - 17:56