In my previous post, I talked about adding some sounds to Goblin Rules Football (GRF). I’ve never really done sound in games before, so it is all pretty rough right now. I’m borrowing most sounds from the GameAudioGDC sound archive on Sonniss.
One thing I had mentioned in the previous post was that I hadn’t gotten footstep sounds to sound right, particularly when a goblin moves over a different surface like a glue trap. I wanted to alert the player they had stepped on a “bad” surface by playing different footstep sounds.
First, though, I had to add footstep sounds to begin with. Initially I was just looping the sound while the player was moving. This wasn’t working too well, so I eventually did what I had assumed I would need to do but didn’t want to out of laziness: Use animation events to play the footsteps. Basically, for each “step” in your run/walk animation, you need an event that calls a function in an attached script on the object. The function will then play a sound. The screenshot below is trying to show that when the goblinigrenadier’s foot is down on this frame, the “FootstepSFX1” function is called. This will play the first (of two) footstep sounds.

To then play a different sound when walking on a different surface, I just had a bool variable set on the goblin when they entered the different surface. When the FootstepSFX1 function runs, it will check the surface bool values to determine what sound to play.
Below is the code for setting the bool value on the goblin during the collision (and unsetting when they exit the collision:
[ServerCallback]
private void OnTriggerStay2D(Collider2D collision)
{
Debug.Log("OnTriggerStay2D for ObstacleObject: " + this.name);
if (collision.tag == "Goblin")
{
if (!isTripObject)
{
Debug.Log("ObstacleObject: still colliding with goblin named: " + collision.transform.name);
collision.transform.gameObject.GetComponent<GoblinScript>().SlowDownObstacleEffect(true);
if (isSlowObject)
{
collision.transform.gameObject.GetComponent<GoblinScript>().onWaterSlowDown = this.isWater;
collision.transform.gameObject.GetComponent<GoblinScript>().onBrushSlowDown = this.isBrush;
collision.transform.gameObject.GetComponent<GoblinScript>().onGlueSlowDown = this.isGlue;
}
}
}
}
private void OnTriggerExit2D(Collider2D collision)
{
Debug.Log("OnTriggerStay2D for ObstacleObject: " + this.name);
if (collision.tag == "Goblin")
{
if (!isTripObject)
{
Debug.Log("ObstacleObject: still colliding with goblin named: " + collision.transform.name);
collision.transform.gameObject.GetComponent<GoblinScript>().SlowDownObstacleEffect(false);
if (isSlowObject)
{
collision.transform.gameObject.GetComponent<GoblinScript>().onWaterSlowDown = false;
collision.transform.gameObject.GetComponent<GoblinScript>().onBrushSlowDown = false;
collision.transform.gameObject.GetComponent<GoblinScript>().onGlueSlowDown = false;
}
}
}
}

So, the different surface will be a prefab with the isWater/Brush/Glue value set. When a goblin enters into a collision with the object, those corresponding values are set on the goblin.
Then, the code to play the sounds is fairly straightforward. Just check the surface bool values, and pick from there:
public void FootstepSFX1()
{
if (!isGoblinOnScreen())
return;
float volume = 0.7f;
if (this.hasAuthority && this.isCharacterSelected)
volume = 0.7f;
else
volume = 0.45f;
string footstepType = GetFootstepSFXType(true);
SoundManager.instance.PlaySound(footstepType, volume);
}
public void FootstepSFX2()
{
if (!isGoblinOnScreen())
return;
float volume = 0.7f;
if (this.hasAuthority && this.isCharacterSelected)
volume = 0.7f;
else
volume = 0.35f;
string footstepType = GetFootstepSFXType(false);
SoundManager.instance.PlaySound(footstepType, volume);
}
public string GetFootstepSFXType(bool step1)
{
string stepType = "";
if (onGlueSlowDown)
stepType = "glue-footstep";
else if(onWaterSlowDown)
stepType = "water-footstep";
else if (onBrushSlowDown)
stepType = "brush-footstep";
else
stepType = "footstep";
if (step1)
stepType = stepType + "-1";
else
stepType = stepType + "-2";
return stepType;
}

I should probably change this so there aren’t two different “footstep” functions, and instead there’s just one and the individual goblin keeps track of which step was “last” and play the correct of the two sounds. Oh well!
So, after that, I just had to add animation events to all three goblins, for all of their run animations, on each different goblin “color”, and that’s why I was hoping to avoid it…
Anyway, here’s a video of the footsteps in action?
So, the sound does change when an animation step occurs on a different surface. Right now, though, it is possible to pass through a small section of a different surface, have your speed slowed down because you are on a slow object, but you won’t hear the sound because your run animation didn’t have a “step” while still in collision with the surface. The easiest way to “skip” the sound is to run straight up and down through a thin object like the brush/weeds while sprinting. So, not perfect, but getting somewhere…
Other Sounds
At the end of the above video, you can hear the “yeehaw” sound from the cowboy. I kept the old StalksStalksStalks yeehaw sound with some modifications. I do want to create my own sounds for stuff like that, and tried using my own voice. I didn’t like my voice for the yeehaw (yet), and I’m guessing that is partly due to not being comfortable/used to hearing my own voice played back to me.
I did, however, use my own voice for touch down/kick after announcer sounds. I modified the pitch and EQ of my voice in audacity. It was recorded using a really bad and cheap microphone. Maybe someday I will get “better” equipment, or just try more, or whatever. Anyway, here’s a video of some of the sounds?
Another sound you can hear in that video is the “kicked football” thump sound, an the thump-thump of the ball bouncing on the ground. Those “small” sounds have been tricky to find the right sound for, but I do think they add a lot to the experience, particularly the football thump. Here is a list of most of the sounds I have done so far:
- Combat sounds (punches)
- bomb timer/explosion
- powerup pickup
- ball changing possession (cheer for you, boo for opposing team)
- cheering for touchdowns and kick after attempts
- the slow down sounds
- running footsteps
- UI “clicks” during the heads/tails kick/receive choices
- announcer for touchdown and kick after
- goblin sliding sound (needs work though…)
- Yeehaw (need to have as my own voice at some point)
I think that’s everything?
Next Steps…
More sounds still. I want each powerup to have some sort of sound played when they are used to go along with the particle effects to let players know what powerup was just used (or maybe just have a generic “opponent user powerup” and “you/your team used powerup” sounds). I also want to fix the footstepsfx1/fooststepsfx2 so it’s just one function thing. Then, uh, idk, more content??? Not sure really
Smell ya later nerds…