Week 19 - Blood and Sound


This week we've got a reduced build size, tons of audio improvements, a new spider model, and most importantly blood effects!

Blood Visual Effects

I've been waiting... okay about 18 weeks... to put this feature in. Blood particle effects and armor spark effects add SO MUCH to the battles. I know its a bit fuzzy, but this slow motion gif really illustrates the point. Fairly soon we'll also have blood effects on the ground, as well as some body parts from fallen units.


Reduced Build Size

Okay, so the build size has been creeping up over the last few weeks and was getting to 882MB in a compressed zip. So, I had to do something about that. You can use the unity editor log to figure out where your heavy files are.  As you can see, almost everything is 4,000 x 4000 pixel images (which is what happens when you get 3rd party assets from an asset store).

I used a photoshop macro to reduce the file size to 1024x1024 for all image formats. This was really quick and reduced the build size drastically.  We went from 882MB compressed to 297MB compressed. Also, setting unity'd compression to LZ4HC helped too.  You can find some info on that photoshop macro here: 

https://www.digitalartsonline.co.uk/tutorials/photoshop/how-resize-multiple-imag...


Audio Improvements

Alright, so I got deep into the weeds with this during the middle of the week. I started adding sound effects to the new spider model, and realized that the old way I was doing sound effects wasn't going to work. Previously, I had a variety of sound effects for each unit (attack, grunt, die, etc), and every time a unit hit or got hit, we rolled the dice, and then played a sound effect if the dice roll worked. For example, there's a 10% chance when you get hit to make a grunt sound. 

Now, this works for 30 units on 30 units. However, when you bring the fight down to just 1v1, its incredibly quiet and theres a lot of animations with no sounds. 

So the solution was to create priorities for all the sound emitters, have them emit all the time, and just let the audio mixer do the limiting for us. 

Also, did you know that Unity's logarithmic falloff curve terminates at 0.02? Which isn't zero. Which means even when I'm 10000 units away from something, I can still hear it. The solution here was to write my own logarithmic falloff curve that terminated with a zero volume at the tail.


Walls and Towers

Oh right, I forgot to mention I added towers and walls. The towers shoot flaming arrows at nearby enemies. I'll soon be adding a restriction so that you can build too many towers too close together; i want these to be an aid to the dwarves, not turn this into a tower defense game. 


New Spider Model

Its the medium sized spider variant. We'll have small, medium, and giant spiders, all with different stats and abilities. I had to re-texture the model to match the small spider, and set up the prefab. Can you believe I actually spent $50 on spider sound effects because there's almost nothing available out there?


Unit Push

Okay, so, units really like to clump up in tight spaces. This makes battles kind of messy and its hard to see whats going on. So, the way my unit push script works is like this: each unit has two colliders, one soft, and one hard. The hard collider is just a regular collider. However, the soft collider is the same as the hard collider, except slightly wider, and its a trigger instead of being a physics collider. When something touches the soft collider, we have a chance to push it back with a certain amount of force, in a certain direction. This lets units push each other away to create room and helps allies get to their targets as well as keeping enemies from pushing through your formation.

In the below gif, you can see the spider in the middle top which is trying to move south. As he move south, he is being pushed by the spider on his left (who has no room), to the right, and subsequently pushes the spider on the right, further down and to the right. This kind of stuff is huge for an RTS game and makes it possible for units to engage enemies in a way that feels right.


Its nice when it all comes together. Shame I have to use gifs smaller than 3MB on itch.io. 



See you again soon, lots more to do next week. Hoping to get some gameplay with audio up soon!

-Max

Files

Beneath the Mountain v1.0.5.zip 290 MB
May 28, 2021

Leave a comment

Log in with itch.io to leave a comment.