Wwise - Centralized Audio System
Wwise is used to manage and control all audio elements across enemies, the player, and NPCs in the project, providing a dynamic and adaptable soundscape.
Goals
The goal of this feature is to centralize audio functionality for all entities within the game, ensuring consistent and efficient management of sound effects (e.g., idle, charge, attack, death) through a unified audio system. By extending from BaseAudio.gd
, each entity (Player, Enemy, NPC) has customizable audio behaviors aligned with its unique actions, reducing redundancy and enhancing maintainability.
How it works
The BaseAudio.gd
script serves as the foundational audio manager, handling sound playback, stop functions, and real-time parameter controls (RTPC). Each specific entity (e.g., player, NPC, or enemy) inherits from BaseAudio and further defines its unique sounds, such as attack, hurt, or alert. The centralized BaseAudio manages audio events via Wwise, allowing smooth communication with Wwise functions such as post_event for sound playback and set_rtpc for real-time parameter changes.
Each entity-specific script (e.g., EnemyAudio.gd
, PlayerAudio.gd
, NPCAudio.gd
) extends BaseAudio and customizes sounds based on the entity's actions. For example:
- Enemies: The
EnemyAudio.gd
script defines sounds for various enemy actions (e.g., charge, hurt, death). - Player: The
PlayerAudio.gd
script manages unique player sounds, such as footstep sounds affected by terrain, weapon attack sounds, and environmental interactions. - NPCs: The
NPCAudio.gd
script has a basic setup to control general sounds for NPCs, such as idle or footstep sounds based on terrain.
Wwise ensures 2D positional tracking of sounds for spatial coherence and manages object-specific registration for each instance.
With what script it communicates
- Scripts: The
BaseAudio.gd
script communicates with each entity-specific audio script (EnemyAudio.gd
,PlayerAudio.gd
,NPCAudio.gd
). - Autoload: Utilizes Wwise as an autoload, allowing functions such as post_event, set_rtpc, and set_2d_position to be universally accessible within the project.
- Events: Sounds are triggered through Wwise event IDs. For example, the post_event method is called to play a sound, while stop_event halts the sound playback when required.
This centralized audio system ensures a modular and maintainable approach to sound management across all entities. Each entity's unique sounds and behaviors are implemented through inheritance from BaseAudio.gd
, centralizing functionality while allowing for customization.