pingpoli.de



GameDev 2019 Week 21: Back To Menu

Explosion Trap, Watermill

09.06.2019 - 17:40
Monday 03.06

I started the new week by changing the entity spawning so every player can have a different number and different types of entities spawning every wave based on the choice in the wave selection phase. I also added an elemental type icon to the entity window. Then I went through all attack types and converted their damage calculation to the new combat system function so every damage is calculated in the same place. A few days ago I had the idea of an unstable explosion trap that explodes, deals massive damage, but can only attack once, because it explodes and disappears. To get it working I had to add custom on hit functions to the tower blueprints so I could remove the trap after its explosion. It turned out to be tricky to remove the trap on hit, because it was removed before the renderer had a chance to play a sound effect or show an explosion animation. So I added a self destruct timer that removes the trap after a short period of time to give the renderer enough time to finish the animation. It's not the best solution, because you can see still see the trap for a little bit after it exploded, but it will have to do for now. I also noticed a funny bug in the new entity spawning system: if the entities were killed fast enough the spawning would never stop and there would be infinite entites in the wave, so I changed the counting system to make sure the correct number of entities would be spawned. Finally, I created an explosion sound effect in Audacity with a very deep drum preset and it turned out quite nicely.

Tuesday 04.06

In the morning I made a model for the explosion trap in Blender and added it to the game. Then I started with the back to main menu function, which is always a struggle. In theory it should be simple, just delete the game and show the main menu screen again, but in reality there are always problems. I started by only deleting the single player server to test what would happen if the connection to a real server would get lost. Luckily my client already has an onServerShutdown callback function and I only needed to implement it. I added a little notification popup window that shows an error that the connection to the server has been lost. However, when trying to quit the game after a connection lost the game got stuck in a thread dead lock. After some searching I found the error in the way the client shut itself down after a connection loss. While trying to find that bug I added a lot of debugging messages to the network lib log file and after I fixed the bug I found a new one in the logging function, which would happen when one program would be server and client at the same time, like in the case of the single player server. When the server was deleted it would close the log file and prevent the client from using it after that. It was a simple fix though, I only had to add an instance counter and only close the log file if the instance counter went back to zero. A lot of bug finding and fixing today, but improving libs that are used by more than one program always feels good.



Wednesday 05.06

I made another new tower model in Blender, this time for a Watermill. Similarly to the Engery Ball Tower the wheel of the Watermill is animated and rotates. I created the blueprint file for the Watermill, it has a fairly high attack speed and does water elemental damage. Then I looked into pseudo random number generation. So far I just used the normal rand function to generate the waves, choose the reward options, etc., but I want it to be seed based, so with the same seed the random number generator will always return the same number. Therefore it cannot be based on the random numbers generated before the call like the normal rand function is. I thought about creating my own generator with some arbitrarily chosen prime number modulos and division, but instead I decided to use the FNV hashing function ( #TODO LINK !!! ), implemented it from the wikipedia pseudo code and tried it for a little bit and the results looked good enough for my plans. The server now generates a random seed and sends it to the clients in the start game message.



Thursday 06.06

To add some items into the game I made 7 item images, one per elemental type, and added an item that adds +10 elemental damage of every type. I also added 7 items that add +5% elemental damage of every type, but these don't have images yet. While adding the items I changed the buff stacking once again to it's probably final form. First all additive buffs are applied (all additive buffs stack on top of each other) and then all multiplicative buffs are calculated from the sum of all additive buffs and then applied, which means they stack with the additive ones, but not with each other. As an example: A tower has 30 base water damage and an items adds 10 damage and an aura another 10, which results in 50 water damage. It also is affected by an item and an aura that both add +100% water damage (there probably won't be an item adding +100%, but 100% is easy to calculate in my head :D). The 100% are calculated from the sum of all additive buffs, so they add another 50 damage each, so the final result would be 150 damage. Then I added a new class which handles all the random number generation for the game, so it is all in one place, and everything that needs a random number just calls a function of this class. The first thing I changed to the new random numbers are the item rewards. In the evening I continued to work on the back to main menu functionality and returning to the main menu worked quite flawlessly, but starting another game didn't work. After some more bug searching I found the problem: I had forgotten to clear the list of already handled messages in the client, so when the new server sent a new message with the ID 1, the client would discard the message as already seen and handled. With that problem fixed, the new game started, but crashed immediately, but at 0:40am it will have to wait until tomorrow.

Friday 07.06

Using the nice weather I was working on the porch with my laptop and I couldn't continue to work on the back to menu stuff there, because I have no linux client project set up (that's a beast for another time). So instead I started to work on making the wave option generator algorithm produce actual result and not only completely random numbers. I created a scaling system to increase the difficulty of every wave by hopefully a good and fair amount. The HP of a mob in a wave depends on its speed, the number of total mobs in the wave, the hp target for the wave and a random difficulty factor. In combination with the elemental types this should give a good variation of options to choose from. In the afternoon I continued to work on the back to menu function and I think I have fixed most bugs with it now. It is possible to go back to the main menu and also start a new game without the game crashing, yay :)




by Christian - 09.06.2019 - 17:40


Comments

Social Media:  © pingpoli.de 2020 All rights reservedCookiesImpressum generated in 52 ms