What if a game made you both player and remixer/composer? What if that music plugged into your gameplay brain just like the interactive elements? This week, we get another try at just that – and find out how the whole thing works behind the scenes, with free software you can use, too.
If you’re like me, you’ve loved the soaring, gaslight-style music soundtrack, as it makes its sweep across a film, swelling at just the right moments. Or you’ve closed your eyes and enjoyed the frozen narrative of a great score or great record as it washes over you. But surely, these are something different from a game; they’re defined by the (pleasurable) linear flow from beginning to middle to end. A game, if it’s to be just as musically expressive, has to somehow compose in the moments of play as they unfold, interwoven with what makes something challenging and addictive. As such, they’re an enormous opportunity.
Bad Hotel is described by its developers as “an insane hybrid of a tower defense game and a procedural music toy,” with game play and art direction that “work seamlessly together with a generative music system, which creates original music depending on the player’s actions and decisions. The player becomes a composer, creating complex musical structures to defend their hotel. A vast variety of music can be generated, from delicate beach chillout to country banjo techno.”
The game is on sale now. I asked Yann Seznec, who’s shown us into developer Lucky Frame’s games in the past (the last time, involving adorable dogs), to explain the genesis of the game and its unique musical engine, powered by the free and open source engine libpd.
And this being CDM, we have patch images.
Bad Hotel is all really focused on the hotel structure. You can only build on your hotel, extending it into a giant warren with crazy branches that stretch out into the sky (or into the ground).
The origin of this is in Jon’s [Jonathan Brodsky’s] original concept for the game, which was created in a 48 hour ludum dare weekend. You can still play it!
His approach was to ask the question, “what if there was a tower defense game where you had to actually defend a tower?”
We ended up looking at this prototype and realizing that it had some really interesting musical potential, because you were basically building a sort of tree. If each little node can branch off in a number of different directions, there is instantly a huge amount of variation – particularly if things are not fixed to a grid (which was a decision we took pretty early on in the design phase).
So with that as the starting point from a musical perspective, we had to figure out how sounds would get triggered using these structures. It made most sense to turn the hotel into a rhythmic sequencer, with a loop running through the set of nodes – in some ways similar to something like NodeBeat.
Every level starts with the pulsing of the core hotel building. This is usually triggering some sort of bass drum sound (the sound banks change per world of levels). When you add one room to the structure, a step is added to the loop. The core hotel actually lasts 2 beats, so adding one room turns it into a pattern that is in 3. Adding rooms to that branch will lengthen the loop length by one step each time – so it’s really easy to set up a loop in any number of regular or irregular time signatures.
That’s something that really appealed to me on a musical level – I get really bored by generative sound structures that are always regular, I wanted to make something that was constantly changing rhythmically, partially because it can sound cool and also because it’s a good way of giving the player something that is really tangibly changing in the music – hopefully driving home the effect that their decisions are having on the audio.
The longest branch of the hotel therefore dictates the loop length. Other branches will play simultaneously, which all of the pulses emanating outwards from the central hotel. You can see it pretty clearly in these two videos showing some really early prototypes:
You can also tell that in these prototypes different rooms trigger different sounds, creating a multivoice polyphonic sequencer out of building blocks. Making those early prototypes was pretty fun, I was just chucking all sorts of random sound banks in to see how they sounded!
The sound engine in those videos is actually really close to the one that ended up in the final version of Bad Hotel – though it is missing is the sound of the enemies, the weapons firing, explosions, and lots of other things which give the generative music depth.
Speaking of which: I tried to give virtually everything that happens in the game some sort of musical spice. I ended up cutting back a little bit, because it started sounding a bit busy, but I left in as much as possible. For example, when a flying enemy is spawned, it triggers a portamento synth glide that is tuned to the scale of the level. Explosions are each tuned, to avoid repetition and mickey mousing. And if an enemy manages to latch onto your building it will generate some percussive clicking with a beat-repeat style S&H sound.
With five main room types, with variations on each and five different worlds, along with all of the rhythmic variation and spice, there is a pretty big sonic palette within which to work! That’s the basis of the audio/music design.
The level design, of course, impinges heavily on the sonic characteristic of the gameplay. Each level has an ingrained BPM – this is important not only for the music triggering, but it also effects how quickly you earn money (since a rentable room makes you money every time it is triggered in the sequence) and also how quickly the enemies are released. So faster levels are more frantic, but you can also build much faster! Additionally, the key and the mode are set on a per-world basis (similar to Pugs Luv Beats), along with the sound library, so each world and level will sound fundamentally different.
And finally, when you first play any level the rooms you are able to build are restricted. Sean, our artist, was in charge of all of the level design and a fundamental aspect of the level design was picking which rooms a player would have access to – so some levels are brutally difficult because you have no guns, or too many guns! As a fun little Easter egg, though, we put in a room selector feature, which lets people choose what rooms they can use on a level (once they have beaten it). This means that players can make the levels easier for themselves (or harder!), and also turns the level into a fun remixing tool, where you can choose which sound libraries to trigger.
In terms of Pd, as I mentioned earlier, this is definitely an extension of our work on Pugs Luv Beats. In the early days of development, I tried to do all of the sound generation using synthesis, but it became too hard to get enough variation (possibly just because I’m not very good with synthesis), so we moved instead towards a system of triggering sound banks based on which world you are playing. Some vestigial synth areas remain, though, such as the mine rooms (see screenshot), which uses tabosc~, switching the wavetable per world, and the gulls arriving sound, which uses a simple subtractive method. Overall I found it much more CPU efficient to trigger samples than use synthesis anyway – this could be for any number of reasons, so your mileage may vary.
Another fun little musical Easter Egg is the generative audio in the menus. What started as a totally impulsive thing when I didn’t have a button press sound ended up adding a whole level of interactivity. You’ll notice, when pressing the buttons, that the note changes on every pulse. It’s actually a synth stepping through a 16- note sequence (see screenshot), which is reset every time you play a level. The mode that this sequence is played in is determined by which world you have selected – so you’ll notice it change scale when you go into a new world. When you enter a world, a semi-random smattering of sounds from that world’s soundbank is played as well, giving a hint at the sound of those levels, and adding another layer to the musical navigation.
That kind of semi-randomized interaction was really easy to do in Pd, so a snap decision I made — connect the buttonpress message to a random number box to a synth I had already built — resulted in a really gorgeous little musical interaction. I think it really adds something to the overall experience.
Thanks, Yann. It’s also worth noting that this unusual title is the latest of three to get support from support from Channel 4 and Creative Scotland. I think it’s unique to have an investment in this way in development innovation; traditional game development models don’t always support this kind of adventurous innovation.
For the Pd geeks out there:
And a non-game/non-mobile project by Yann: Matthew Herbert’s One Pig, On Tour, and the Making of a Sty Harp