Procedural generation is commonplace today, with pre-programmed algorithms randomly sculpting everything from enemies and items to full virtual environments. Less frequently explored, however, is the use of audio to power that algorithm.
It’s not a unique concept. Not only has the rhythm action genre grown from this design idea, titles such as puzzle racer Audiosurf have explored the potential of building a game from your own music collection. Foam Entertainment decided to take things a step further.
Founded in 2013, the studio is run by co-creative directors Phil Clandillon and Steve Milbourne, who began their careers in the music industry. Having impressed that market with their tech-led music projects, the two avid gamers turned their attention to our own industry with the aim of making games based on music technology. The result was Drive Any Track, later renamed to Riff Racer.
“We’d seen Audiosurf and the like and always thought: wouldn’t that be cool if you could really drive the track like an arcade racer, rather than a collect the block rhythm-type game?” Milbourne tells Develop. “So we started experimenting with game designs to see if we could create an enjoyable experience. It kind of went from there.”
As Milbourne says, the objective was to create a game unlike any audio-based racer that had come before by using the music to shape the track rather than populate it. To do so, he and his colleague had to take a closer look at the music itself.
“We decided to concentrate more on ‘moments’ in a song – a change from a verse to a chorus, or a big drop – rather than making a straightforward rhythm game,” Milbourne explains.
“We wanted to make the experience immersive and tap into music tribalism, so we designed cars to reflect music genres. A G-wagon type vehicle works for hip-hop, a muscle car for rock, an old fashioned car for classical and so on, and styled environments to the genre you’re playing too.
“Getting our analysis to accurately detect ‘sections’, such as a chorus, was a big challenge, though. A lot of analysis tools just detect things like BPM and go from there.”
Hip-hop songs tend to be more bouncy, whereas rock songs tend to have more big drifts.
At first, Milbourne and Clandillon used online API The Echonest to start its analysis and lay the foundation for Riff Racer’s music-generated tracks. However, when Spotify purchased Echonest and locked out public use, it was back to the drawing board.
“We had to build our own audio analysis solution, which in the end turned out to work a bit better and is all done on the user side,” Milbourne recalls.
“We originally prototyped the game in Unity. At the time the driving physics in there weren’t great, so we ended up using a specific driving engine from another company. That has had its pros and cons, but we’re satisfied that the end result drives well and is fun to play.”
As the duo honed the analysis tools that would study the music and derive the game’s environments from it, they had to regularly question how far they wanted to take the concept. Easy listening music might generate a track that players would effortlessly be able to handle, but throw in some heavy metal and the wild landscape that would result might deter players from continuing.
“It was a toss up between being safe so every track is ‘playable’ or going all out,” Milbourne confirms. “If you play an absolute crazy song, then you get an absolutely crazy track. It might be super difficult but someone will get the high score. We opted for the latter, but getting it right was tough.”
The fact that users can upload any audio track they choose also means there was no way Foam could fully predict what music might be thrown at the game. They certainly couldn’t build it in a way that would exclude anything – as Milbourne observes: “People get pretty passionate when it comes to their own music collections.
“We had to try and get the best balance possible.Ultimately the game is experimental, so some tracks might not make the best racing experience but that’s part of the journey. When you find one that just connects really well with the song, it’s a great feeling.
“We created different environments and colour schemes for different genres of music, and the gameplay often reflects the genre you’re playing. Hip-hop songs tend to be more bouncy, whereas rock songs tend to have more big drifts.”
Milbourne and his fellow dev even had fun with the vehicles players use to race along each track. In addition to pre-designed genre-specific ones, the team has snuck some vehicular easter eggs into the game. As an example – although one that has yet to make it into the game, Milbourne stresses – playing Huey Lewis and the News’ Power of Love would put you behind the wheel of a Back To The Future-style DeLorean.
“The idea came from the thought that driving and music go so well together, there are always songs associated with particular artists or types of music,” he says. “We just thought it would be fun to start throwing some of those in-game, a nice little surprise for experimenting. We can’t tell you what they are, though.”
There was one final technical hurdle the Foam team needed to overcome: not everyone one has exactly the same songs.
When a tune is first converted into a racetrack, the analysis is done locally on the user’s computer and the blueprint for the course is uploaded to Foam’s servers. That way, they can ensure everyone who plays that song afterwards does so on the same track, thus making the high scores comparable and fair.
However, there are countless audio formats for Riff Racer to decode, many at different sample rates. Equally, the music might come from different sources.
“Even if two players have the same song, there may be slight differences – if say one was ripped from a CD and the other was downloaded from iTunes. Detecting that and making sure the music syncs properly was a challenge.
“So far players have converted hundreds of thousands of songs into unique racetracks so we have a pretty hefty database of song analysis.”
We decided to concentrate more on ‘moments’ in a song rather than making a straightforward rhythm game.
Riff Racer originally launched through Steam’s Early Access program as Drive Any Track. While there is plenty of debate as to whether such initiatives help or hinder development – and potentially damage enthusiasm for the eventual launch – Foam offers nothing but praise.
“Early Access was an amazing experience for us – it really informed the development,” says Milbourne.
“When we put the first-ever build live, we got a ton of feedback about one aspect of the game that people didn’t enjoy. Because we’d been playing the game during development for around six months, we realised that we were playing it a particular way that wasn’t suited to a new user just jumping in.
“We changed the game design and it made the game a lot more enjoyable. If we hadn’t gone through that process and just launched it fully with that game design, it definitely would have failed.”
The team is now focused on updating the game wherever possible, with an iOS version rolling out this summer.