Lumberyard Sound Tutorial 04 - Adding Collision Sounds

Report 16 Downloads 50 Views
Tutorial: Adding Collision Sounds This tutorial will introduce you to adding physics collision sounds via Material Effects and will teach you some more advanced ways of implementing sounds into Lumberyard. By the end of this tutorial, you will have sounds playing for cannon projectile impacts and for boxes colliding. You will learn how to do the following: 1. Add Material Effects 2. Update Collision.xml 3. Add Material to Physics Ball Object

Step-by-step guide 1. Repeat the same steps from previous tutorials to import Wwise Controls for impacts (Play_box_impact and Play_cannonball_wall_impact) using the Audio Controls Editor in a new folder named collisions under the tutorial_controls folder. 2. Find what entity is called for the cannonball projectile. a. Normally, bullet projectiles, ones that disappear from the game world when they impact something, use bulletimpacts.xml to define their effects. b. In this example, the cannonball projectile is created in the Level Flowgraph and doesn't disappear, but becomes a physics object. Open the Level Flowgraph named FlowgraphEntity1 to find the name of the object.

c. Follow the logic for the Spawn Ball section to find the string used for name of the Archetype that is spawned: GSArchetype.Physics.Ball.

3. Open Database View to search for entity. You'll see that the Model is gs_sphere.cgf.

4. Open Material Editor and search for gs_sphere. a. You'll see that the Surface Type for this has been set to rubber.

5. Open materialeffects.xml spreadsheet a. This document is located at: \dev\SamplesProject\libs\materialeffects\materialeffects.xml b. This document requires Microsoft Excel to edit, but you can preview it any software that opens that format.

c. View the “mat_rubber” column, you will see entries in the format :<effect_name>. d. In this case, most of the effects for rubber material will use the “rubber_default” effect when rubber collides with various other surface types. 6. Open \dev\SamplesProject\libs\MaterialEffects\FXLibs\Collisions.xml for edit. a. Define which Audio Trigger plays when the “rubber_default” effect is triggered. Add the following text between the START and END markers for mat_rubber: <Effect name="rubber_default"> b. This basically says that when rubber_default effect is triggered, execute the Play_cannonball_wall_impact audio trigger.

7. Follow the same steps to find the materials for the boxes stacked near the end of the road.

8. Create collision definitions for the various wood impacts. When you are finished, collisions.xml should look like this: Note: Must restart Lumberyard to apply the xml changes

9. Enable and set Pitch Randomization for the CannonballWallImpact sound: a. By default, the randomizer not active:

b. Right-click Pitch and Enable Randomizer:

c. Set the Pitch Random properties. The values are in cents.

10. Next, right-click Volume and Enable Randomizer. Edit the Volume Randomizer properties.

11. Next, edit the Attenuation Curve. a. A Log Base 3 Attenuation Curve might feel more natural than a linear curve.

12. Control over advanced settings such as voice playback limits requires upgrading to the full version of Wwise.

13. Save the Wwise project and click Generate Soundbank. Switch back to Lumberyard, refresh the sound banks by clicking Audio -> Refresh Audio from the menu. Finally, type Ctrl+G to test the collision sounds. a. Navigate the robot to the cannon. When the camera view changes, fire the cannon at the boxes. b. You should hear the sound of the cannon hitting the boxes and the sound of the boxes colliding with each other and the ground.

Related tasks and tutorials We’d love to hear from you! Head to our Tutorial Discussion forum to share any feedback you have, including what you do or don’t like about our tutorials or new content you’d like to see in the near future.