GameDev 2019 Week 7: Cool Tools
Tower Buttons, Particles18.02.2019 - 17:30
At the end of last week I added path finding for flying mobs into the game, but having flying squirrels looked a bit weird, so I created an animated bird model. However, when loading it into my animation editor I noticed that it wasnt working anymore. After a little while of bug searching I realized that "fixing" the deep copy bug in my animated model class broke the editor, because it relied on the shallow copy. And because I didn't want to change every single feature of the editor I added a function called setSkeleton_DO_NOT_USE() to the class to override the bug fix, high quality code design right there :D
Today I added the bird model into the game and also implemented the wave data files properly. The game now uses the data specified in the file to create the mobs for every wave and the mobs hp, speed, gold rewards and flying attributes are set correctly. I also added the "Pirate" on hit effect, which gives the player some amount of gold with some chance on every successful hit of the tower. However, just increasing the gold amount in the ui is a little underwhelming, so I wanted to add a gold reward popup whenever the effect triggers and also when an entity dies and the player gets its gold reward. Therefore I created the first and probably least cool tool of the week, a class to automatically create a gold reward texture with up to n different values, in which ever font, color and size I need.
Using the texture created yesterday I was able to add a gold reward popup feature into the game. Now, whenever an entity dies or the pirate on hit effect triggers, a small number will appaer and move up a little bit before fading out to tell the player that he got gold. I also fixed a bug in the entity rotation where the entites were sometimes rotated backwards to their movement direction and finally added shadows to the entities, which makes them look a lot better. They still cannot recieve shadows, because I haven't updated that shader yet, but they are are in sunlight most of the time anyway.
Up until today the buttons to build a tower were just normal button with the name of the tower as text on them, but the text was a lot wider than the button which looked stupid. And hardly any game would have building buttons with just text on them, thats for the accountant programs ;). Anyways, I wanted the buttons to have images with the tower they are for on them. Obviously the best solution would be to create a high quality render in blender and then use photoshop to create a texture for the button and place the rendered image on it. However, that would require a lot of manual labor and aint nobody got time for that. Another option would be to render the towers to a texture whenever the game starts and then use that texture on the buttons, but this would slow down the startup time, which isnt ideal either. So instead I created another tool that takes every tower blueprint file, renders its model using opengl, takes the framebuffer data and turns it into an image, then scales the image down for anti aliasing and adds optional borders or maybe other effects to it and updates the tower blueprint file with the filename of its image button texture. It took a few hours to write the program, but now whenever I add, change or delete a tower, or want to change the background color or the borders of the buttons, I can just run the program and it will create all the textures almost instantly.
Then I added the button textures into the game ( the background and hover colors are temporary until I decide how I want to design the ui, and also some towers dont have their own models yet ):
My flame trap is showing a flame burst particle effect when it is triggered, but so far it was only using red squares, which didn't look that great. I tried to create a nice animated texture in photoshop but it looked even worse than just red squares. So I started to work on yet another tool, actually one that I wanted to created for years: a particle animation software renderer. Years ago I used the test version of Particle Illusion to create some fireball and teleport particle effects and included them in some videos. However, the full version back then was like 600 dollars and since then it got bought and is now 2k dollars. And I feel confident I can create the feature that I would want to use myself. So I started to work on it and by the end of the day the first tests looked very promising.
Continued to work on my particle program and added a lot of features to it so at the end of the day I was able to make a decent looking fire particle animation with it, that swirled around a bit with some sparks flying of it and then turned into smoke.
To incoorporate the new textures created with my particle program I had to update a few things in my opengl particle editor, it's still not completely done, but enough to add the fire particle effect into the game. While adding the effect into the game I also completely reworked how particle effects are loaded into the engine. Or rather added, because there was no real way before, I was loading them from file for every instance, now they can be loaded as a template into the engine and then every instance gets created from the template. Here is a low quality gif of the animation ( couldn't figure out how to export high quality gifs from photoshop ), no in game screen shot yet, there are still some changes I want to make to it:
by Christian - 18.02.2019 - 17:30