• Register
Post news RSS The mad chiptune melodies of Super Gravity Ball!!!

How I procedurally generate the platform melodies of Super Gravity Ball!!!

Posted by on

Alright, so I got the sudden urge to write about what I believe is the tiniest but coolest feature I built for Super Gravity Ball!!! Which is the randomly generated melodies that accompany each of the campaign's theme songs as the ball strikes different platforms during gameplay. (Forgive me but this article requires at least an elementary understanding of music theory when it comes to keys, chords, and tempo.)

So for those of you who aren't familiar with the game, it's essentially a physics based platformer where your only input is the direction of the gravitational force being applied to the ball. The goal is quite simply to maintain balance and control of the ball in order to prevent it from hitting obstacles and barriers. This means the ball does quite a lot of bouncin' around and I simply wouldn't of been able to live with myself if I subjected people to the same bounce sound effect continuously forever!

Upon realizing this, I came to the revelation that this is also a chance to play to my own particular strengths as a musician. I'd already taken a minimalist approach for the visuals of the game because I felt like it would give me more time to focus on gameplay as opposed to art but audio is a completely different story.

For each of the five campaigns, I then proceeded to write and record a song that I felt captured the general mood of the level. Each song was written in the key of A minor / C major with it's own unique chord progression. The instruments and tones may change through out each song but the chord progression repeats indefinitely. Using the same key for the entire soundtrack and knowing each unique chord progression is important for easily generating the melodies later on.

Anyways, once the music was in place I then wrote (for lack of a better term) a sound bank system. The sound bank system is responsible for randomly generating the melody. In order to do this it has audio clips of multiple instruments playing single pitches of every note in the key I chose, the chord progression of the current song, and a timer to keep track of which chord is actually being played at the moment. The simplest way to keep track of the chord progression is to translate the chord interval duration into seconds using the song's BPM. (Beat per minute) For example, 4 beats of C major at 60 BPM is literally 4 seconds. With this, I could directly trigger an appropriate pitch for any of the supported instruments at any time.

But how do you determine that appropriate pitch, you may ask?! Simple, just randomly choose an arpeggio note from the current chord! Yes, it really is that simple but could definitely be expanded upon to add more style. For example, if you want a more elaborate melody you could use sequences (random or not) built from the current chord or key with varying rhythms, tempos, and so on. (This is where your own musical flair comes into play)

In the end, I think the system came out pretty good for the little bit of time I put into it. It really has some groovy moments but can be a bit odd at other times. Really comes down to the player's movement, the struck platform's tone, and the mad jazz musician rockin' the random number generator. Also the most common platform in the game has a short bass chirp to it. I felt like this was appropriate since the platform doesn't have any special properties but at the same time it's tone doesn't quite do the music justice. (Still debating on changing it)

The only other thing I really struggled with was finding the right instruments. Super Gravity Ball!!! is a mobile game and I'd forgotten to take sound quality from phone speakers into account. However, this wasn't too big an issue and I think it helped coerce the soundtrack into having a bizarre chiptune vibe which I'm actually pretty happy with.

Anywho, thanks for reading this! Leave a comment if you have any questions. Also check out Super Gravity Ball!!! for Android on the Google Play Store. Full version is $2.99 but there is also a free demo available.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

News
Browse
News
New
Post news
Share
Related Games
Related Engines
Unity
Unity Commercial
Related Groups
Digital Inception Games
Digital Inception Games Developer & Publisher