GameDev 2019 Week 12: Sounds
Immunities, Levels, Sounds23.03.2019 - 17:29
The first feature I worked on this week were tower levels or tower veterancy. Towers can level up every 10 kills up to 3 times. Every additional level will grant them a 10% damage boost. To get this working towers would need to be able to track their own kills, direct kills were easy to implement, but kills from debuffs required some refactoring. After this I added entity immunities into the game. They can be declared in the wave data files and basically declare an entity immune to certain debuffs like slow immune, fire immune or even immune to all debuffs, adding another difficulty option to the game, because entities that cannot be slowed or stunned are a lot harder to kill. In the evening I made 2 environment models in Blender that will be used in future maps.
At the end of last week I created and added the fireball tower. However, it wasn't shooting fireballs. So I used my software particle renderer from a few weeks ago and tried a bunch of settings until I had a decent looking fireball animation, which was then added to the game and the fireball tower finally shoots fireballs :). While adding the fireball projectile I noticed that the particle projectile class was rather inefficient. I created the model projectile class after it and found a better way of updating the projectiles in there so I also changed the particle projectile to use the same method. I also realized a bug in the network protocol, when the client killed a mob of a wave before the second one spawned it declared itself done with the wave, so I added an additional check whether the wave is done spawning before notifying the server.
Traps can crit! Big surprise, I know, but they couldn't before^^ Anyway, today I implemented the no RNG game rule that I have mentioned before as a concept. Basically, rand() isn't called anymore when the game rule is active. The damage, which is normally a random value between the minimum and maximum damage, is now always the averge damage between them. Critical hits will happen every n attack depending on the crit chance, e.g. if a tower has a crit chance of 25% it will crit every 4 hits. The same thing for on hit effects with a chance, they will also happen every n attacks.
Then I added a new on hit effect into the game: area of effect damage on hit, if an entity gets hit, all entities within a range also get damaged. I made a new icon for the effect and while working on icons I also made icons for all the different immunities and changed the entity type icons from white to black borders, because everything else uses black borders and the white ones looked out of place. Here an image of the wave browser with random immunities, just randomized them to have all icons in there, real maps would use a lot less I imagine:
Then I threw coins and bricks on the floor to create some sound effects, I rarely ever work on sound, it's not really my specialty, but it's always fun to throw or hit random things and figure out what the resulting sound could be used for.
As mentioned, I don't work with sound that often. Therefore my sound engine was due for an overhaul. I reused some of the OpenAL code, but designed the complete code structure and the interface from scratch. It now runs in its own thread, supports 3D sounds and has a very minimal, mostly static API ( there can only be one listener, so the main class has a static pointer to itself, so I don't need to carry the object through to every place where functions need to be called ) and it finally supports 3D sounds. By the evening it was in a state where it could be tested and normal ( non 3D ) sounds still worked, but 3D ones didn't. After some reading I found out why though, 3D sounds can only be mono, stereo sound are already a mix of a left and right channel so OpenAL gets confused and doesn't know how to divide them to left and right based on their 3D position relative to the listener. So, after deleting the second channel, the sounds also worked in 3D :)
Yesterday I basically rewrote most of my sound engine from scratch and in the evening it was able to play sounds, you would think that would be most of the work on it done. Unfortunately there were still a lot of features missing, so I had to put a few more hours into it: sounds can now have fade out distances, a distance where the sound is played at max volume and a distance where the sound is no hearable at all and gets faded out between them, sound sources can be deleted individually and are also automatically deleted on program shutdown, it is possible to play sounds in an interval, and, because I am 100% going to forget about the mono thing, a warning gets shown when trying to play a stereo sound in 3D ^^ Then I made weird sounds with my mouth to create more sound effects :D Some of them were actually usable after a little bit of audacity filtering and were added to the game: Towers now play a sound when launching a projectile and traps make a sound when triggered. However, my ears started to fall off, so I added a master volume setting to the sound engine to turn it down. There is no ui for it yet, and there are also no sound categories, like music, sounds, voice, etc, that's gotta get implemented too.
Anyway here's a screenshot of the new sounds:
oh, wait ...
by Christian - 23.03.2019 - 17:29