Throwing a Loop Into Game Music

Imagine if Star Wars had opened up with a fanfare of kazoos and slide whistles instead of John William’s powerful and timeless masterpiece. Then try imagining if Nintendo had hired the punk band Screeching Weasel to do the score for Super Mario Bros. It might have worked. More likely than not it wouldn’t have. It just wouldn’t have been as fun, at least. Music can make a game or movie great, but it can also send it to the depths of obscurity if it’s bad enough.

Creating music for games takes time, like all good things do, and it is often done later in the process once the mood of the game has been set. You don’t want to be composing epic orchestral music for a game that turns out to be a comedy.

For our game Hexapod Defense Force, we asked our friend Glen Moyes to compose us some music. He played our game and got the idea for a techno soundtrack that would fit the alien invasion theme. The songs he made started off with a dark tone, which warned the player of an imminent alien attack and would shift again when the boss was about to appear. It really made the environment come to life, giving you this feeling that everything was falling apart but that there was still hope for mankind or alienkind or whateverkind. It also had funky dance beats that brought everyone out to the floor. Seriously. We took the game to a conference down in Salt Lake City and caught more than a few people grooving along to the vibes. Glen’s Doom vibes.

Who gets down to doom vibes anyway?

Crazy people.

Or awesome people. Maybe I’m just missing out on something.

By the way, you can check out Hexapod Defense Force at hdfgame.com.

Making Loops

One unique aspect of making music for games is making music that is able to loop for ever and ever. I tried doing this in Garageband at first, and it turned out to be a disaster because it exported all of my tracks at uneven lengths, and everything would just get out of sync when they were played in the game. I then turned to Audacity, which allowed me to specify how long I wanted each track to be, and I exported all of my tracks from there. It’s actually super easy once you figure out how to do it. Just reference the below picture:

trackLength

For a game that we are working on, we decided to use loops, making it so whenever a player went further in the game he or she would unlock more tracks to the loop. So you start the game and all you hear is a drum, and then as you progress, you get chimes, a piano, strings and so on. I had never seen anything like that done in a game before (please excuse my ignorance) and was super excited to see that it actually worked! You can check it out in our game BOCO (it’s current and hopefully last title, but that’s another post), which should be released soon.

Here you can listen to the menu music track that I created for BOCO, if you wish!

Loops are fun to make, especially after you learn how to make them work. They can be pretty frustrating up until that point. And like I mentioned before, Audacity is awesome when it comes to editing tracks. Try it out! It’s free on the internets:

http://audacity.sourceforge.net/download/ 

As for creating music, just go out and collect as many sounds as you can. For one of our songs, I tapped on a desk, put some reverb on it and made it into a loop. Then I played my acoustic guitar over it. Glen went out and bought an electric guitar and learned how to play it for the songs he made for us. One of my favorite bands sampled themselves hitting a baseball bat with drum sticks for one of their songs. It sounded awesome.

So go sample some egg sounds!

Crunch down on some peanuts!

Throw a bath sponge at the stove!

Just don’t break anything that’s not yours. And don’t throw anything at the TV. I’ve seen those destroyed before in the process and it’s just a little awkward when people come home and they can’t watch Cupcake Wars.

Make your music sound balanced and professional as well. Take time to master it so it doesn’t overpower everything else in the game. Making sure game sound effects don’t get lost in the soundtrack is also good. It takes a lot of trial and error work, but it makes a difference in the end.

Happy music making!

Catch the Coding Wave

When we first came up with the concept for Viking Escape, we drew up a sketch that included a little boat, some rocks, and water. The boat and the rocks would be simple enough to program, but the water was going to be tricky because it had to be interesting visually and had to use little memory, you know, to keep cell phones from exploding. That last part was an exaggeration. Anyway, what we drew looked something like this:

sketch1

The grand scheme we concocted included a rising water level to simulate a flooding cave that was supposed to look like it was going back and forth. I drew a water asset that took up the whole screen, thinking that Joseph could program it so that it would start below the screen, slowly rise and eventually consume the screen as the player reached the top. This worked, but it proved to take up too much memory which is bad when you want a game to run smoothly on a smaller device such as a cell phone or tablet. Having learned from experience on a previous game, we learned that it was easier to optimize everything as we went along instead of doing it after the fact.

To save memory we decided to crop all art assets as tightly as possible, because every pixel counts. So for the water asset, I chopped it down to this:

waterWaves

Joseph then programmed the game to take the color from the bottom of the water asset (the blue), and use it to fill the rest of the bottom of the screen. This proved to take up much less memory and made no difference visually. He then programmed the asset to move back and forth, and thus we had moving water. We celebrated by doing the Binary Cocoa victory yell and dance, which no one will ever see or should have to.

To make it look less stale, we decided to code the game so that it would duplicate the water asset three times, stacking them all one level above each other, and staggering the rates at which they moved back and forth. This created a neat sense of depth in the game that really brought the environment to life. You can see it in action here in this short video:

https://www.youtube.com/watch?v=tzBlaSYaubI&feature=youtu.be

(or you could just see what it looks like here in this screen shot)

Screen Shot 2014-07-22 at 12.45.14 AM

The water is just one of the many moving parts within the game, but it just comes to show how putting in a lot of small details can really enhance the game play experience. A couple months ago, Joseph and I watched a video game conference video where two programmers showed everyone how to spice up their games. They took a simplified version of Breakout (that looked painfully boring at first) and put flashing lights in, several bright colors, a techno soundtrack and fun sound effects that all of the sudden made the game look like something anybody would buy. I would post the video here, but it has copious amounts of toilet humor and I think I would just be doing everyone a disservice.

What I’m trying to say is that even the lamest game can catch people’s attention if it is flashy enough. At least for a while anyway. We do all of our stuff in Lua, which has been great because they have libraries upon libraries of game code that they just give to you for free. It’s so much easier to borrow a physics engine instead of banging your head against the wall trying to build one from the ground up. Check out some of the cool things they have to offer here:

https://love2d.org/wiki/love.physics

I suppose it’s time to conclude.

Our goal with Viking Escape is to give players a game that is fun to play as well as aesthetically pleasing. It can be somewhat challenging to accomplish for phones that have little memory, but we’re finding new methods to accommodate better graphics all the time. It’s all really exciting actually. Every time we make a new discovery, it’s like finding your favorite bucket of Oregon black cherry ice cream in the back of the icebox that isn’t freezer burned, or having a load of socks go through the wash and having all the pairs come back intact.

Compare it to what you will. I’m going to eat ice cream.