GameDev Blog: Goblin Rules Football #3: Sounds and Other Things

Welcome to GameDev blog #3! I have added a few new things to GRF since my last post. Not much, but still, it’s something! The new things are:

  • Stamina PowerUp
  • Sounds!

The stamina powerup is pretty straightforward and just some new content I’ve been meaning to add.

The sounds, well, the sounds are a brand new thing for the game! Up until now, GRF had been completely silent. I’ve never really done anything with sound in game before, at least not to any significant extent beyond just have a “ding” play at certain game events, so this will be a challenge and learning experience!

Anyway, to the blog…

Stamina PowerUp

The new powerup is meant to replenish your goblin’s stamina as well as any other goblin’s on your team. Stamina is used to sprint in the game, and when you deplete your stamina, you become fatigued and run much slower. The Stamina PowerUp is here to make all that easier! Use it when you are sprinting and about to run out of stamina, or if you are fatigued, use it to remove your fatigue and instantly gain back a full stamina bar!

The new powerup appears as a little battery icon:

When a player uses the powerup, a particle effect is started with little battery sprites. This is to indicate to all players that the powerup was used.

I also added some visual indicators for when a goblin becomes fatigued. First, the goblin will flash yellow:

The flash only happens once for a brief moment. While the goblin is fatigued, a little sweat drop shows up near their head:

So, now, both the player controlling the goblin and any other player in the game should have a clear idea of when a goblin has become fatigued and is now slower and more vulnerable!

The flashing effect is done using a modified version of this SimpleFlash.cs script you can find here on GitHub. Attach it to whatever object you want to flash. Create a new material that sets the object to one solid color, and then call the “Flash” function from SimpleFlash.cs to make it flash. I changed it so I can flash any color provided to the function, and can flash more than one time if specified. You can find a YouTube video tutorial on how the script works and how to modify it here.

Sounds!

So, I have just started to add some sounds to the game. For right now, it’s just some “combat” sounds so something plays when a Goblin hits another Goblin. I’m still really trying to figure out how to do sounds in games, so it’s all still a bit rough right now.

Here’s a video testing out some new sounds. You can hear:

  • Glass shattering for the bottles breaking
  • PowerUp pickup
  • Bomb timer ticking (yes I know it should be a fuse burning sound but I couldn’t find/make a good one)
  • Bomb blowing up

Wow! Whoa!

All of the sounds used in that clip come from the Game Developers Conference sound library, which you can find here. There are a lot of sounds files there. Each year is several gigs worth of sound files. I’ve only looked through 2 years (2018 and 2019, for whatever reason) for my sound tests. Anyone can use the sounds files, even in commercial products, royalty free! Wow!

To add sound/audio to the game, I just copied what Brackeys does in their “Introduction to AUDIO in Unity” tutorial. If you need 3d sound the audiomanager solution may not work since everything would be coming from one gameobject/location in the world, but for my dumb little 2d game where that isn’t an issue, it seems to work fine. I do make checks when an object is supposed to make a sound to see if it is onscreen for the player before telling the AudioManager to play the clip.

Next Steps…

More sounds! That’s the main thing I want to work on for the game right now. I do at some point want to make my own sounds, but my mic kind of sucks when I’ve tried that before, and also it seems pretty hard. It’s worth a try though! I could learn something and then it will be easy!

The main thing I want to add next is footstep sounds, especially footstep sounds when a player is running through a slowdown obstacle. A “plop plop plop” sound when they run through the water obstacles, a brush sounds when they run through the bushes/weeds, and a “glurp” type sounds when running through the glue obstacle. I tried to implement them already, but the sound was “off” and not working the way I wanted to. Hopefully it works next time!