Introduction
A great way to learn a new tool is to try and break the rules of how to use it. You never know what might come out of it when you push the boundaries, especially when the tool is as expansive as Wwise—a complex piece of software used to implement interactive audio into game engines. But can it be used as a game engine itself? Can you make a game inside of Wwise?
That was the task I had set for myself, eager to explore further. Creating games in non-game engines is not unusual for me, and in general, my passion comes from exploring wacky projects such as composing music for comic books or making a game inside Reaper with randomly generated levels.
Wwise has a fantastic set of opportunities, and I read with great interest about every time it has been used for purposes other than games, like live theater performances or art installations. Previously, I have explored creating a self-driving mechanism in Wwise for serialism music, such as Steve Reich or Arvo Pärt. Especially when I was figuring out how to program Arvo Pärt’s compositions, Spiegel Im Spiegel, inside of Wwise, I built a self-running mechanism heavily based on Event cues. I won't go into too much detail about that project, since it still needs some polishing and tweaking, but the essence is that there are several pseudo switch playlists that don't play any sounds but their only purpose is to set certain Switches, trigger Events that activate other playlists or set RTPC values. These Switches can be translated into the playback order of the playlists, and the RTPCs can be routed into transposing MIDI for the sampler instruments, built in the Actor-Mixer Hierarchy. The whole project consists of only one Play Event that then triggers and activates several other Events scattered all over the Actor-Mixer and Interactive Music hierarchies.
Image 01. Spiegel Im Spiegel in Wwise
Wwise as a game engine
Having the deterministic mindset from building games in Reaper and the tools for a self-evolving mechanism from the previous Wwise project, I was curious to see if it was possible to build an actual game in Wwise. For a long time, I didn't think it would be possible at all. The main issue I couldn't resolve was how to actually display the game information. This led me on a hunt to locate a place to function as my game display. What Wwise lacks in joyful colors and a playful interface, it makes up for it with its vast amount of editor windows and profiler views. So the obvious choice to display game information would be the profiler. But which information to show and which profiler?
My first idea for a game in Wwise was actually to create a game focused on resource management, using the Soundcaster as the controller and the Voice Graph in the Advanced Profiler as the main display. Messing around with the Voice Graph, I was first annoyed that there was a lot of information being shown at once. Events, devices, target, virtual voices, volume, LPF, HPF, and Effects. Everything seemed like a cluttered mess of information where it was hard to know what to focus on, but I quickly decided to use that to my advantage. The naming of audio busses and audio devices actually gave a pretty good indication of gameplay. For instance, naming one Audio Device GreatCountryOfDenmark and the other SadCountryOfSweden suddenly laid the premise of an epic rivalry of the two arch enemies, Denmark and Sweden.
The basic goal for this game was simply to generate more citizens than Sweden in a Cookie Clicker game combined with resource management. Click an Event and it generates a Dane that lives for three to four seconds. An "AI" was created for Sweden with a Music Playlist running on a simple loop with a single Music Segment every three seconds, triggering a new Swede being born every three seconds. Great, now we have a game and Denmark will finally outgrow its reputation of being the little brother of Sweden. So let's see how it looks in the profiler.
Image 02. The rivalry of Denmark vs. Sweden in the voice profiler
Well... not super clear, is it? Still a tangled mess with the Voices Graph making it really hard to see what's going on. I decided to scrap that idea since it turned out to be too complicated. If anyone wants to develop this game further, then be my gæst and make a game out of it!
Learning from these attempts, I finally cracked the code of how to make a game using the voice graph displaying fairly simple information and an easily played but challenging game controller.
Figuring out the game mechanics
I think we all know the classic carnival game called whack-a-mole, at least to some degree. Equipped with a hammer, the player's task is to hit the moles that pop up at random from four to six possible holes. The player must act quickly to hit the mole or it will disappear down the hole again. The player gets a point every time they hit a mole, where variations of the game also reward fast reflexes and give higher scores, depending on how fast the player reacts.
This turned out to be the perfect premise for creating a game in Wwise using the Profiler and the Soundcaster. We might not have a physical hammer or actual moles, but nevertheless, we can still recreate Wwack-A-Mole inside of Wwise. In order to get the game to work, several systems must be created and interconnected.
Let's start with building a MoleGenerator that pops up moles at a random interval. The first step is fairly easy and consists of creating a Music Playlist Container that is set to play at Random Continuous. The playlist will either play one of the four mole-sound files or will play NoMole, which is empty and therefore won't get sent to an audio bus. Just as we saw in my experiments with the resource management game, but more on that later.
By keeping the length of NoMole short and duplicating it in the playlist, it is possible to randomize the timing of how long a mole is hiding before popping up again. The mole numbers 01-04 are intentionally weighed lower than 50, while the NoMoles all have a weight above 50 to ensure there will always be a pause between each mole. How long that pause is depends on how many times NoMole gets played.
Image 03. The Mole Generator
The numbers 01-04 are identical in length. They all have an empty Music Segment that doesn't serve any purpose other than being shown in the Audio bus. But before we go into depth with that, let's take a look at how Event cues are being used. If you don't have experience with Event cues, they are basically programmable markers that can trigger Events from a certain position in a Music Segment. In a typical game project, they can be used to trigger a musical Stinger, play an SFX on just the right beat, or even to mute ambience during the most critical combat music. In this case, their usage is to set a Switch indicating whether the mole is up or down and telling the system which mole is being handled. The Event MoleUp is triggered at the beginning of the Music Segment and MoleDown at the end.
Image 04. Event cues telling the system if the mole is up or down
Now that we’ve got the moles popping up and down, let's take a look at the hammer mechanism. The logic behind the hammer is fairly easy to grasp. A Switch controls whether the hammer misses or hits. After fumbling around, I found that the least buggy solution was to create four Switches for each mole-hole in the game. Each of the hammer-switches is triggered by its own Event. When the player presses the Event Wack01 it plays the Switch Hammer01 as shown below. Below there are only two possible outcomes: hit or miss, which are replicated for each of the other hammers. We can see in the path section that there's actually only one possible outcome for getting a hit, while there are different kinds of opportunities for getting a miss. If the player hits a mole, a sound effect is being played indicating a win, and if they miss, a simple swoosh is heard.
Later on I added Event cues for hit or miss with the intention of building a score system and life so we could have a fail state and win state for the whole game. The Event Score_1up is triggered for a hit and Life_1down for a miss.
Image 05. Hit or Miss is implemented with Music Switch Container
This concludes the essential features of Wwack-A-Mole. With all these game mechanics working as intended, we can now take a peek at how the Soundcaster and profiler are used to display the game.
Using Soundcaster as a joystick and Profiler as a monitor
The gamepad consists of four buttons, Wack01, 02, 03, and 04, that activate the Music Playlist described in the previous section. The Events are color-coded corresponding to the moles, so they are easily identified. If you see a green mole on the screen, hit the green Wack button.
Next to the gamepad, there are two buttons related to the game state. The StartGame button basically just plays a Music Segment with the well-known circus music. From there, the rest of the game is triggered. In the intro section of the music, several blank Event cues are triggered that are being sent to an audio bus called Readme. I found out that I was able to create a text-tutorial to be shown in the Soundcaster by simply renaming audio files and playing them in order from Event cues. By giving them a length of approximately two seconds each, they fit perfectly with the tempo of the music. The full intro is as follows:
"Welcome // to Wwack a Mole // SMASH those events // and hit the moles // They will pop up randomly // and disappear quickly // So get ready //"
The last Event cue in the screenshot is MoleGenerator, which activates when the intro has ended and the music begins. In the Soundcaster you'll see a button called SkipTutorial. What that does is to seek the audio file of the music, so it skips the intro and plays right before the MoleGenerator Event gets shot. What dawned on me afterward was that the thing I spent absolutely the least time on was the music, resulting in a non-interactive soundtrack with a simple WAV file being played from A to B. I guess I really learned a lesson about game development here!
Image 06. Event cues displaying tutorial texts
In order to display the game most optimally, the idea was to filter out unwanted objects in the Voice Graph in the Advanced Profiler tab (F6). So if the Work Unit in the Master-Mixer- Hierarchy called WwackAMole is selected in the Object Filter, it will only display the audio busses called Readme (Game tutorials), Enjoy and Listen (the music) and Wack it! The last one consists of game objects that the player should react to. There's also an audio bus called InvisibleProfiler intended for uncategorized sounds that should be hidden from the profiler. That can be game systems but can also include samplers, SFX, or ambiences.
The Soundcaster also provides another set of information that can be taken advantage of. The Switches section shows if a mole is up or down and which mole is active. So in theory, the system could fully function without the Voice Profiler as display, but only using the Soundcaster. When working on the project at a later stage, I started to add difficulties, Lives, and Scores. I tried to keep all the global game systems relevant to the player to States and then use Switches for local game mechanics that the player doesn't really need to see. I will not go further into the mechanics of how I built Lives and Scores, since they are still under development and not completely fine tuned.
TLDR;
In summary, the game works by pressing the StartGame Event that activates the Music Playlist with the game music. That music travels to the audio bus called Enjoy And Listen.
In the intro section of the music file, several Event cues trigger silent audio files in the Actor-Mixer Hierarchy. Their purpose is simply to display a piece of text in the Voice Profiler, corresponding to the filename. Those text files are directed to the bus called Readme. Examples of text could be "Welcome to Wwac-A-Mole" or "Get ready".
After the last tutorial text has been shown on the screen, a final Event cue is triggered from the Music Segment. That Event cue is called "MoleGenerator", which triggers a Music Playlist that spawns Mole01, Mole02, Mole03, Mole04, or silence segments with random lengths. The Mole-Events tell the system which mole is activated and whether the status is MoleUp or MoleDown. That lays the foundation for the Hit or Miss systems. The Mole-Events are displayed in the audio bus called Wack It!
Four buttons are visible in the Soundcaster: Wack01, Wack02, Wack03, and Wack04. They play a corresponding Music Switch Container called Hammer01, Hammer02, Hammer03, or Hammer04. The Hammer Switches check if the Mole is up or down to play a Hit or Miss Event. The only way to activate a Hit for Mole01 is to have it visible in the Voice Profiler and press the Wack01 at the same time. If Wack02, 03, or 04 is pressed, it results in a miss, and if the player hits the Wack01 too late or too early when Mole01 is down, it likewise results in a miss. A *Ding-*sound is heard when it's a hit and a Wwoosh when it's a miss.
The game loop is to hit the right mole at the right time. If you miss, you try again or play until you get tired of it. Experimental features involve Game Over States and *Win-*States that are built on States with scores and lives. Adding a score point every time you get it right, and losing a life if you miss three times in a row. If you manage to complete the song length without missing any moles, you win the game.
Wwhat's next?
That's basically how you build a game in Wwise. Pretty straightforward, huh? Well, maybe not exactly, but I hope it made sense nevertheless, and you at least got some inspiration to do your own wweird stuff in Wwise and try to push its boundaries like I did. In the end, that's what it's all about: testing your own skill limits and trying to achieve the impossible in the field. That's what I loved about doing the game project and the Spiegel Im Spiegel in Wwise; it really helped me think creatively and achieve things I couldn't do before.
Speaking of thinking outside the box with Wwise, I want to give a massive shoutout to Ressa Schwarzwald who is a well-known face in the Audiokinetic community. Without her initial ideas and love for crazy projects, I wouldn’t have created something as silly as a game in Wwise. Being the conductor of a robotic orchestra, she of course had to take it one step further when she played the game. She came up with the idea of playing the game with TouchOSC on iPad. I tried to convince her to use a hammer on her iPad, but strangely enough, that idea wasn’t a hit. Nevertheless, I think she nailed it.
Wwack-A-Mole has also proven to be a fun party game at game audio gatherings. I brought it along as entertainment for a game audio Christmas party in Copenhagen where it turned out to be great fun. It was a good opportunity to playtest the game and get feedback from core users. Some people said that they could see my core idea, but were not sure how to play the game and had general confusion about the concept. One person at the party, a legend inside the industry who shall remain anonymous, found the speed of the moles way too fast for him to hit, so we implemented a senior mode with plenty of hammer-hitting time, which resulted in him actually winning the game!
There’s a bunch of possibilities to continue to expand on the game and the vast opportunities for additional features are only limited by the imagination. Like all other games constrained by a time limit and practical obligations, Wwack-A-Mole isn’t finished; it’s merely delivered. There are a ton of features I could imagine for the game that could heighten the experience. Let’s start with the soundtrack. Ironically being a composer and sound designer, I put the least effort into guaranteeing a fulfilling musical experience. Being busy with game design and “coding” in Wwise, I postponed the music to the end of the pipeline, making a quick ‘n’ dirty solution in the final hours before the deadline. Surely a situation many composers and sound designers can recognize. I dream of a fully MIDI-generated soundtrack that’s fully adaptive to the gameplay with tempo variations, sample-built instruments, and layers of interactivity. I can’t think of any software better to craft an adaptive soundtrack than Wwise, so it’s extra ironic and a pain to my heart that I didn’t implement that yet. With this project, I want to make it as open source and collaborative as possible, inviting you to participate in the game-making process. The game Wwise project is fully available on Github, where you are heartily welcome to modify and improve the project as you see fit. Wanna make a soundtrack or design sound effects? Great, go ahead! Do you want to help build a high-score system or continue on my story mode that’s only one-quarter finished? Be my guest; it would be a joy to see the game audio community coming together to crowdsource a game like this.
Just one more thing...
Now that I built a game inside Wwise, I can wwrap it up and call it a day...right? Well, actually I have made another game in Wwise inspired by the popular Netflix show at the time, Squid Game. Contestants on the show have to run to the finish line before the timer ends, but can only move while the scary-looking robot is not looking at them, otherwise, she will shoot. Scary stuff.
I will not go into all the details here, but the game mechanics were rather simple compared to Wwack-A-Mole. The engine of the game lives in the Interactive Music Hierarchy in the same way as Wwack-A-Mole. It includes the sophisticated use of switch tracks to determine whether the robot is looking away and it’s safe for you to run, or if the robot is scanning the level, making it unsafe for the player to press the walk button in the Soundcaster. For every five times that you press the Walk button in the Soundcaster, the player moves one distance and you need to move 20 meters before the timer runs out, both of which are run on a state switch with 20 and 60 children. Every time the song restarts, it is sped up slightly, making it more stressful each time.
Try it for yourself by downloading the project on Github at https://github.com/Gminorscale/Wwack-A-Mole/wiki
With these projects, I humbly hope to inspire you to build some wwacky experiments in Wwise and I would love to see what kind of crazy projects you come up with. It sure has opened up my creativity in Wwise and let me explore its features from a different angle than what I’m used to. As sound designers and audio technicians, we are often limited by the functionality of the programs we are using and often we have to write custom code or use additional add-on software to achieve our goals. With this project I wanted to see how far I could go, staying in Wwise without using any additional tools outside of Wwise.
Feel free to shoot me a message on Twitter if you have additional questions or just want to exchange ideas. Thanks for reading this post, and have a wwonderful day.
댓글