Reunite long lost socks in this physics platformer. Swap their positions to use momentum in unique ways to overcome obstacles in the name of love.
Made for the "Duality" Global Game Jam 2022.
I created an audio handler that allows for simple and consistent audio playback, with the ability to modify sounds to give each sock a unique "voice".
One of the issues I ran into while putting sounds into this game was with how Godot (the game engine we used) handles playing sound files. Naively, I assumed that the AudioStreamPlayer could be passed a sound file whenever you wanted to play a sound. I soon discovered that while you can do that, it can only handle a single sound at a time, and if it was already playing a sound, the file would cut off to play the new one.
Making an AudioStreamPlayer for each possible sound effect would be cumbersome for adding new sounds, and still ran the risk that a sound would not be done playing when it was called again.
My solution to this problem was to create a function that we could easily call to play sound effects, so that all audio playback could be handled in one place.
The function play_SE(player, noise) plays the sound effect associated with the "noise" argument, and shifts the pitch of the sound up or down slightly depending on the "player" argument. Shifting the sound effects like this creates a "voice-like" effect, giving each sock a unique voice and personality, while also creating clarity on the origin of each sound.
The audio handler walks through a list of AudioStreamPlayers to find one that is not playing a file, and then shifts the chosen AudioStreamPlayer's pitch up or down, depending on the player associated with the sound, and finally it plays the audio.
For the case of the walking sound, to prevent the handler from having multiples of that sound playing at once, I used a dedicated AudioStreamPlayer for each sock. When a walking sound effect is requested, the handler checks if the player's walking AudioStreamPlayer is playing a file, and does nothing if it is, or plays the file if it isn't.
Overall, this made it very simple to make large changes to all of the audio in the game, and made handling the game audio simple and and easy.