top of page

Devlog 3 - Sfx and Ambiences

Sounds made the game definitely more alive! I collected and applied hundreds of sound effects for the different events and ambiences present in the game. Definitely there are other sounds to be integrated (for the UI, for resources and so on), but I can be satisfied with the work done so far. Here I share some details for who is interested.

I created 4 main modules that manage all the audio of the game:

  • HabitatMan: plays looping ambience sounds chosen according to the habitat present in the area currently pointed by the camera. For example, if the camera shows a beach, then this module plays the sounds of waves of the ocean. In order to prevent the frequent passage from an ambience sound to another, this modules periodically checks the habitat at the corners borders of 2 rectangles of different size and positioned at the center of the screen. And only if the most of the points have an habitat different from the habitat that is playing the ambience sound, then this module plays the sound of the new habitat.

  • AmbienceMan: this modules periodically plays non-looping sounds related to the current habitat (determined by HabitatMan). The sounds played by this module mostly consist of the verses of birds but includes also other animals, wood creaking and so on. The sounds played by this module are randomly chosen from a collection and contribute to rend the ambience more alive and a little more real.

  • MusicMan: plays the music of the game. It tries to minimize repetitions by dividing the playlist in two parts and by shuffling them every time the playlist has been fully played.

  • SoundMan: manages all the sound effects non-related to ambience and music. That means all the sounds of actions and events such as combat, jobs, impacts, fire and so on. For each event, this module defines a collection of sounds to be played randomly, defines the maximum number of sounds of the same event that can be played at a given moment, the max zoom at which the sound can be played and other parameters to control the volume, the pitch of the sound.

Now some details to share with who like me works with the Godot engine.

While HabitatMan, AmbienceMan and MusicMan are AudioPlayerStream modules, the SoundMan is a normal node that receives requests from the AudioPlayerStream2D nodes present in the scenes defining the objects of the game. For example, in the Omin scene I employ 3 AudioPlayerStream2D, each of which play certain types of sounds: ActionsSFX, VoiceSFX and ObjSFX. These nodes use the name of the event to request the corresponding sound to the SoundMan that provides also all the parameters described above.

I use 7 audio buses in my project: objects, voices, habitat, UI, music, ambience, SFX. The volume of some buses is modified according to the current zoom of the camera.

The main issue I had to put in place this system was the use of the AudioPlayerStream2D that was not working at the beginning until I figured out that this was due to the fact that the Camera is not located in the main viewport of the game. So I had to enable the audio listener 2D in the viewport where the camera is located.

There still is something I don't understand with the AudioPlayerStream2D. It is possible to define the max distance from the screen center at which sounds are hearable and the attenuation to be applied according to the distance. But I cannot find in the Godot documentation how the distance is defined and if it is calculated taking account of the current zoom of the camera. Moreover, it is not very clear for me how the attenuation is applied according to the distance from the center of the screen. I am going to update this post if I figure out these elements.

44 views0 comments


bottom of page