- This line was added.
- This line was removed.
- Formatting was changed.
Since our Chinese Garden is a relatively small level, it doesn't make sense to create multiple global ambiences between which the level would switch as the player moves through it. Rather, it seems best to create a single global ambience containing different layers corresponding to:
- Water sounds within the level,
- Forest sounds that surround the level,
- Sounds for the marketplace area situated on one end of the level.
These layers would grow louder as the player drew close, and fade as they moved farther away. The sounds for each of these are included in the chapter_04 → loop folder of your chosen middleware implementation, located within the Audio Showcase assets' installation directory, as:
|l_cg_amb_water_a_01 - 03.wav||l_cg_amb_water_a_01 - 03.wav||Play_l_cg_amb_water_a.ogg||First water body.|
|l_cg_amb_water_b_01 - 03.wav||l_cg_amb_water_b_01 - 03.wav||Play_l_cg_amb_water_b.ogg||Second water body.|
l_cg_amb_forest_01 - 03.wav
l_cg_amb_forest_01 - 03.wav
|l_cg_amb_marketplace_01 - 03.wav||l_cg_amb_marketplace_01 - 03.wav||Play_l_cg_amb_marketplace.ogg||Marketplace.|
|l_cg_amb_global_base_01 - 03.wav||l_cg_amb_global_base_01 - 03.wav||Play_l_cg_amb_global_base.ogg||Global ambience.|
l_cg_amb_global_day_01 - 03.wav
l_cg_amb_global_day_01 - 03.wav
|Play_l_cg_amb_loop_day.ogg||Day sounds for global ambience.|
l_cg_amb_global_night_01 - 03.wav
l_cg_amb_global_night_01 - 03.wav
|Play_l_cg_amb_loop_night.ogg||Night sounds for global ambience.|
We begin by defining a global area box, before creating area shapes for each of the required layers.
Dynamic ambience overview
FMOD Video Tutorial
The FMOD workflow of this chapter is also covered in the following video:
Defining a Global Area Box
With our Chinese Garden level loaded on CRYENGINE's Sandbox, create a new folder called audio within the Level Explorer (located at the bottom left-corner of the Editor, by default) by right-clicking a blank space, and selecting the New Folder option from the context menu. Within it, create a new layer called area shape and double click it to make it the active layer.
This means that all entities created henceforth will be added to this layer by default.
Located above the Level Explorer is the Create Object tool, which is used to create/add entities and objects to a scene. Select the Area → Box option within it to begin creating our Area Box. At this point, you should be able to see the Area Box's properties listed within the Properties panel situated on the right of your Editor window.
Area box properties
You may set the width, length and height of the Area Box to the values used in the image above, or your own values, provided the Area Box is big enough to fully surround the entire level. Once its size has been set, click within the Viewport to place the Area Box in the level. Also:
- Give the Area Box a custom name using the Name field, located under the General tab of the Properties panel. We've named our Area Box AB_Global_Exterior for the sake of this tutorial.
- Set the Area Box's Group Id and Priority to 1 and 5 respectively, under the Area box tab of the Properties panel. The significance of these values will be made clear further on.
Creating the Global Ambience
The idea behind creating the global ambience in this section is to have a static background layer that isn't triggered from a specific position, and a set of one shots that are positioned around the player as part of the 3D environment. Both are combined to create a rich ambience with a relatively simple setup.
Switch back to your FMOD project, and create a new sub-folder called loop within the Ambience folder of your FMOD Events tab and Audio Bin.
This Event requires two more audio tracks, for day and night variations of the global ambience.
Once the three multi-instruments have been created, add a loop region for the entire Play_l_cg_amb_global Event, as described in the previous chapter. Also,
Finally, add the Play_l_cg_amb_global Event to your Ambience Soundbank. Rebuild all Soundbanks and save the FMOD project.
Rather than import every audio file from the _Audio_Assets/Wwise/chapter_04/loop folder into the Ambience Actor-Mixer we created in Chapter 01, it's better to use Wwise's Import Folder function.
Recall that the global ambience that we're creating must contain three different layers that play simultaneously; the Base layer which contains background cricket noise, the Day layer with bird calls, and a Night layer with more cricket and frog sounds.
Our l_cg_amb_global Blend Container contains two sub-containers: the l_cg_amb_global_base Random Container which corresponds to the base layer, and the l_cg_amb_global_timeofday Blend Container which contains the day/night layers as Random Containers.
Set the l_cg_amb_global_base, l_cg_amb_global_day and l_cg_amb_global_night Random Containers to loop, as we did to the fire particle in the previous chapter, and set their Transition Type values to Xfade (power). Use the GIF below for reference.
Finally, create a new Play Event for the l_cg_amb_global Blend Container, create a new folder called Loop within the Ambience folder in the Events tab, and add the Play_l_cg_amb_global event to it. Also remember to Generate All SoundBanks and save your project.
Copy the Play_l_cg_amb_loop_base.ogg file from _Audio_Assets/SDL Mixer/chapter_04/ folder of your Audio Showcase Level installation into the Assets/Audio/SDL_Mixer/assets directory of your project.
Connecting The Global Ambience To The Area Box
Switch back to the ACE on CRYENGINE and create the folder loop within the library Ambience that we created in Chapter 01.
Drag and drop Play_l_cg_amb_global from the Middleware Data panel into the loop folder in the Audio System Controls panel, creating a trigger of the same name.
If using SDL Mixer, activate Infinite Loop and deactivate the Enable Attenuation and Enable Panning properties of the Play_l_cg_amb_global audio trigger in the Properties panel. Also, create a parameter for the Play_l_cg_amb_global audio Trigger in the Ambience folder of the Audio System Controls panel:
- Right-click within the Ambience folder and select the Add → Parameter option. Name it Param_Play_l_cg_amb_global.
- Connect the corresponding sound file to the parameter, by selecting the Parameter, dragging and dropping the Play_l_cg_amb_loop_base.ogg file from the Middleware Data panel into the Connections section of the ACE's Properties panel.
The created parameter is used in a custom FlowGraph script included within the Audio Showcase Level that changes the volume of ambience sounds based on the time of day.
- Save the library and reload the audio engine.
On CRYENGINE, Audio Area Ambience is an Entity that permits the implementation of a simple ambience within a level, without having to define its functionality in Flow Graph. It needs to be linked to an Area Shape, Area Box, Area Sphere or Area Solid to function.
In the Level Explorer, create a new layer called audio_area_ambience within the audio folder we created at the beginning of this chapter; double-click the audio_area_ambience layer to make it the active layer. Since we need to create an Audio Area Ambience Entity to implement our Play_l_cg_amb_global ambience:
- In the Create Object tool, select the Audio → Audio Area Ambience option.
- Click anywhere within the Viewport to place the Audio Area Ambience Entity. We'll call it AAA_Global_Exterior for the rest of this tutorial.
- Attach the Play_l_cg_amb_global trigger to the AAA_Global_Exterior Entity via its PlayTrigger property field in the Properties panel.
Recall that the Audio Area Ambience Entity now needs to be connected to the AB_Global_Exterior Area Box we created at the beginning of this section.
- Select the AB_Global_Exterior Area Box to display its properties in the Properties panel.
- Under the Area tab of the Properties panel, click the Pick button, then select the AAA_Global_Exterior Entity from the Viewport.
You should now be able to hear the global ambience, however only when the default camera of the Perspective Viewport is situated inside the Area Box. On FMOD and Wwise, the global ambience can be made to fade as the Viewport camera draws farther away, by creating a Parameter.
If you're unable to hear the global ambience within the Area Box, move the Viewport camera outside the Area Box and reenter it again to trigger the sound.
Fading The Global Ambience
SDL Mixer users can skip this section of the tutorial.
Open the Preset Browser in FMOD Studio and create a User: Continuous parameter with the name area_fade_distance. Let its range be between 0 and 1.
To now add an automation to the Event, as shown in the GIF above, such that the Play_l_cg_amb_global ambience is fully audible when the area_fade_distance Parameter reaches 1, and inaudible when 0:
Save the FMOD project and remember to rebuild all Soundbanks. Back in the ACE, the area_fade_distance parameter should be listed under the Parameters folder of the Middleware Data panel. Drag and drop it into the Ambience folder in the Audio System Controls panel to create a parameter in the Audio System of the same name.
Navigate to the Game Syncs tab in the Project Explorer and create a parameter with the name area_fade_distance as follows:
We now need to link this parameter to the l_cg_amb_global Blend Container.
The default curve that is now displayed in the Property Editor indicates that the Play_l_cg_amb_global's Event will be muted when the area_fade_distance parameter reaches to 0, and will be fully audible when the game Engine sets the parameter to 1.
Save your Wwise project after generating all SoundBanks. Back in the ACE, the area_fade_distance parameter should be listed under the Game Parameters folder of the Middleware Data panel. Drag and drop this parameter into a new library called Parameter in the Audio System Controls panel, to create a parameter in the Audio System of the same name.
If set up correctly, you'll find that the global ambience sound now fades out as the Viewport camera moves away from the global ambience box.
Setting Up The Remaining Ambience Layers
Now that we have our global ambience working, it's time to add the remaining layers of ambience for the forest, marketplace area and water bodies as shown in the following image.
Showcase Audio Ambience
Create 2D events for all remaining sounds contained in the _Audio_Assets/FMod Studio/chapter_04/loop folder of your project as follows:
Save the project, rebuild Soundbanks, and create triggers for each of the Events in the ACE.
Since we've already imported the audio files corresponding to the remaining ambience layers in the Creating The Global Ambience section of this chapter, all we need to do is make the l_cg_amb_forest, l_cg_amb_marketplace, l_cg_amb_water_a and l_cg_amb_water_b Random Containers loop.
Finally, we need to add the area_fade_distance parameter curve to each of the Random Containers.
Now create a new Event for each of the Random Containers, and add them to the Ambience → Loop Event folder. Save your project, generate all SoundBanks, and create Triggers for each of the Events in the ACE.
Copy the following files from the _Audio_Assets/SDL Mixer/chapter_04/ folder of your Audio Showcase Level installation, into the Assets/Audio/SDL_Mixer/assets directory of your project.
Create audio Triggers for each of the files in the ACE; also activate their Infinite Loop properties, and deactivate the Enable Panning and Enable Attenuation properties for each.
Adding Area Shapes To The Level
Recall that the Audio Area Ambience Entity is used to implement simple ambiences within a level, which in turn must be linked to an Area Shape to function. We begin then by creating Area Shapes for each of the Events created in the previous section.
- Create a new layer area_shape in the Level Explorer.
- In the Create Object tool, select the Area → Shape option to create an Area Shape.
Although we'd previously used the Area Box in creating the global ambience, the area shapes of the forest, marketplace and water bodies need to be more precise, for which reason we're creating Area Shapes for each.
Click on the edges of one of the two water surfaces, being as accurate as possible, to start creating its Area Shape. Whenever you choose to stop/finish creating the Shape, double-click while placing a point; finally, name the created Shape according to the Showcase_Audio ambience image above (AS_Water_a or AS_Water_b, for example).
Make sure the Closed property is activated in the Properties panel when creating the Area Shape, to ensure that a closed Shape is created.
- Set the value of the Height property of the created Shape to any easy-to-read value between 10 and 50 in the Properties panel.
- Similarly, create Area Shapes for the remaining water bodies, the marketplace, forest, and the two pagodas (House_a and House_b), respectively.
We now need to set the Group ID and Priority values for each of the Area Shapes, as we did for the Global Area Box earlier on in this section. Group ID's along with Priority help define how the ambient sounds of Area Shapes are processed, such that when two or more Shapes share the same Group ID, the Shape with the highest Priority is processed first.
This is useful when Area Shapes are nested within each other; an Audio Area Ambience that is attached to an Area Shape will stop playing when the listener enters an inner Area Shape, if the priority of the inner Shape is higher than the outer. If the Group ID and the Priority values of two or more Shapes are equal, the Shapes have no influence over each other.
Use the following Group ID and Priority setup for the Area Shapes created.
|AS / AB Properties||Global||AS_Water_a||AS_Water_b||Forest||Marketplace||House_a||House_b|
|Inner Fade Distance||0||0||0||0||0||7.5||4|
The Inner Fade Distance property determines how far the ambience of an Area Shape blends into another Shape of higher priority. You'll notice that both pagodas have a higher priority in comparison to the other shapes; the goal is to have the global ambience fade out as the listener enters into one of the pagodas.
It is for this reason that the Inner Fade Distance property values for House_01 and House_02 have been set to 7.5 and 4 respectively
Activating the Display Sound Info checkbox in the Property panels of the House_01 and House_02 Area Shapes reveals Sound Obstruction options for the Shapes' sides. Ticking a checkbox flags that side for obstruction; the distance of the player from an Area Shape is not calculated from the obstructed sides.
Since we don't require the ambience to fade with respect to player distance at the floor/roof of the pagodas, the sides corresponding to the floors/roofs can be deactivated. The obstructed sides of an Area Shape are marked in red.
Creating AAA Entities for all Area Shapes
With the Area Shapes created for the forest, marketplace, two water bodies and two pagodas in the previous section, we now need to create Audio Area Ambience Entities for each of the Area Shapes, except for those of the pagodas (House_a and House_b). When doing so, make sure to set the audio_area_ambience layer as the active layer.
After creating the Audio Ambience Entities, set the values of their Play Trigger, Rtpc and Rtpc Distance fields to the following values.
Feel free to experiment with your own Rtpc Distance values; recall that the Rtpc Distance property defines the distance over which parameter fades from 1 to 0.
Finally, remember to attach the Audio Area Ambience Entities to their corresponding Area Shapes using the Pick button, located under the Operators tab of the Area Shapes' Properties panel. You can then go ahead and listen to the outcome in Game Mode. If you'd like, you could even design custom ambiences for each of the pagodas, although the absence of sound often has a greater impact on the listener.
One Shots For Bird Calls
What we've created at this stage, is a dynamic ambience with five different layers. To further improve its realism, let's add in a few random one shots to the global ambience using Audio Trigger Spot (ATS) Entities.
Located in the _Audio_Assets/FMod Studio/chapter_04/Oneshot folder of your project directory are 11 different bird calls, named Play_l_cg_amb_one_shot_bird_a/b/c/d/e_0X.wav. Drag these into your Audio Bin to create five Events as follows:
Since we'd like to hear the bird calls across the entire level, we'll set the Max attenuation distance of each event to 100 meters within the Spatializer plugin. Add the Events to the Ambience Soundbank, rebuild all Soundbanks, and switch back to the ACE to create audio triggers for each of them.
Using the Import Folder function like we did while creating the Global Ambience, add the Oneshots folder included in the _Audio_Assets/Wwise/chapter_04/ directory of your project, to the Ambience Actor Mixer. Remember to set the Object Type/Action of the Oneshots folder to Actor-Mixer.
Included in the Oneshots folder are 11 different bird calls, named l_cg_amb_one_shot_bird_a/b/c/d/e_0X.wav. Create five Random Containers for these bird calls as follows:
Create a new Attenuation Share-Set on the Oneshots Actor-Mixer similar to the one used on the campfire particle audio. However since we'd like to hear the bird calls across the entire level, set the Max distance of the Attenuation Share-Set to 100m. Name it Attenuation_100m.
Finally, create Events for each of the bird-call Random Containers, add them to a new Oneshots Events folder, and generate all SoundBanks. Save your project, before switching back to the ACE to create audio triggers for each of them.
The bird call one shots are included within the _Audio_Assets/SDL Mixer/chapter_04/ folder of your Audio Showcase Level as Play_l_cg_amb_one_shot_bird_a.ogg, Play_l_cg_amb_one_shot_bird_b.ogg, Play_l_cg_amb_one_shot_bird_c.ogg and Play_l_cg_amb_one_shot_bird_d.ogg. Copy these into the Assets/Audio/sdlmixer/assets directory of your project and create audio Triggers for each.
Also create parameters with the name Param_<filename> for each created audio Trigger.
After the bird call Events have been created using your choice of middleware, create a new layer called one_shots within the Level Explorer, and double-click it to make it the active layer.
- Create five Audio Trigger Spots, corresponding to each of the bird call events Play_l_cg_amb_one_shot_bird a/b/c.d.
- Place these in four different positions above the Garden wall.
- Shift-click the first and last of the five Audio Trigger Spots to activate the multi-update option; activate the DrawRandomizationArea Debug property from the Properties panel, which displays a box around the area where randomization of the ATS Entity is applied.
Now tweak the values of the RandomizationArea property, which determines the dimensions of the area boxes made visible in the previous step. The sound of the trigger linked to an Audio Trigger Spot is randomly positioned within its area box.
Even though SDL Mixer doesn't provide any form of audio randomization, its sound attenuation feature can be used as a means to randomize sound volume. This can be done by giving the RandomizationArea of an area box a high depth value, such that sounds will appear high in volume when they're triggered close to the player, and lower in volume when triggered farther away.
Bird call area boxes
Finally, connect the bird call audio triggers created at the beginning of this section to the Audio Trigger Spots, using the Play Trigger property from the ATS Entities' Properties panel. We'll also set the Behavior property of each ATS to Trigger Rate and its Max Delay value to 100,000; this causes the audio triggers to execute every 'x' seconds after the previous trigger instance is done, where 'x' is a random value between their Min Delay and Max Delay values.
Forest One Shots
To wrap up, we'll add a few one shots to the forest ambience through FMOD/Wwise.
The implementation of forest one shots requires the use of a Scatterer Instrument (FMOD) or Random Container (Wwise); since SDL Mixer lacks a system to achieve similar effects, the implementation of forest one shots via SDL Mixer has been omitted in this tutorial. Users can still create a setup similar to the bird one shots for the forest one shots; however, this would be tedious to implement.
Go back to your FMOD project, and open the Play_l_cg_amb_forest ambience we created earlier in this section.
The playlist of a Scatterer Instrument displays all audio assets that can be triggered by it; make sure to enlarge the Scatterer Instrument to the exact length of the defined loop region.
Repeat the above steps to create another audio track using the l_cg_amb_forest_oneshot_creak_01 - 05 .wav files from your project's _Audio_Assets/FMod Studio/chapter_04/Oneshot folder.
In the Audio tab of Wwise's Project Explorer, create a parent Blend Container for the l_cg_amb_forest Random Container; name the Blend Container l_cg_amb_forest as well.
It'd also be appropriate for the one shot to play at random positions, rather than in a 2D space around the player.
Click the Automation... button to open the 3D Automation window. Create a new automation path and set the Random Range to the values used in the image below; also activate the Pick new Path when sound starts toggle to force a new automation path to be used every time the sound is triggered.
Repeat the above setup for the l_cg_amb_forest_oneshot_creak_01 - 05 audio files, to create a l_cg_amb_forest_oneshot_creak Random Container within the l_cg_amb_forest Blend Container.
Before generating all SoundBanks, make sure to update the Play_l_cg_amb_forest Event.
Save the project, generate all SoundBanks and try all your changes in Sandbox.
Changing the Global Ambience With Time of Day
Now that we have finished setting up our ambience, we'd like to have it change based on the level's time of day. This is relatively easy to do, as most of the information is automatically given to the ACE by default..
SDL Mixer handles parameters in a way that is unsuitable for a time of day based implementation of the ambience. A time of day setup similar to FMOD and Wwise can be achieved in combination with Flow Graph scripts, which is beyond the scope of this tutorial; it has hence been omitted for the SDL Mixer implementation of this tutorial.
You can now save your project, rebuild Soundbanks and switch back to CRYENGINE.
In the Game Syncs tab of Wwise, create a new parameter called time_of_day with a range of 0 - 24, and set its default value to 12 via the Property Editor.
We now have to add a blend track to the l_cg_amb_global_timeofday Blend Container.
The created Blend Track is displayed under the Blend Tracks section of the Content Editor.
Compare the outcome to the GIF below; changes can be previewed by pressing the spacebar, and moving the time_of_day cursor over the Blend Track in the Blend Track Editor.
Save your project, generate all SoundBanks and switch back to CRYENGINE. Reload the audio engine, drag and drop the time_of_day parameter from the Middleware Data panel into the Parameter Library in the Audio Systems Control panel.
Reload the audio engine, and open the Environment Editor tool using the Tools → Environment Editor option from the Sandbox's Main Menu.
- First, create a new Environment preset by selecting the New option from the Environment Editor's menu.
- From this window, you can now customize different properties of the level's day-night cycle. Set the speed of the day-night cycle to 1, using the Speed field at the bottom of the window.
- Jump into Game Mode to try out your changes.
If the global ambience fails to play, exit Game Mode and move the Viewport camera far outside the global ambience area box before bringing it back in again to re-trigger the ambience.
|Feel free to tweak all the Parameters we've created up to this point to achieve different results. You could, for example, deactivate bird calls at night time with the help of the time_of_day parameter, or possibly increase the volume of the forest ambience at night time to emphasize darkness outside the Garden.|
Congratulations, you've made it to the end of the Audio Showcase Tutorial using CRYENGINE V. We've put together a few suggestions at the bottom of this section, to ensure you're getting the most out of your middleware implementation on CRYENGINE.
On This Page
|Table of Contents|