Version

menu_open
Wwise SDK 2023.1.8
Integration Details - Game Objects

Game objects are entities to which elements such as interfaces, sounds, and triggers can be attached.

A game object is defined as an AkGameObjectID (an unsigned 64-bit field). You can choose any ID ranging from 0 to 0x‭FFFFFFFFFFFFFFDF‬ (which is -33 as a signed integer). The game object ID range 0x‭FFFFFFFFFFFFFFE0‬ (-32) to 0x‭FFFFFFFFFFFFFFFF‬ (-1) is reserved for internal use. The transport game object, which is registered by the authoring tool, now uses game object ID 0x‭FFFFFFFFFFFFFFFE‬ (-2).

Game Object Associations

Every Event triggered in the sound engine is associated with a game object. All Event Actions are associated with the game object passed as a parameter of the AK::SoundEngine::PostEvent() function, if they target a specific game object. If Event Actions do not target a game object, they ignore the game object specified. If an Action affects a single game object, but the game object specified in AK::SoundEngine::PostEvent() is not valid, the Action is not executed.

Every game object can have an associated 3D position, a Switch for every existing Switch Group, an RTPC value for each RTPC, and multiple values (for example, a volume) that can be set on a specific item (Sound SFX, Actor-Mixer, bus, and so on) for a specific game object. The sound engine stores this information until the game object associated with these values is unregistered.

Registering Game Objects

Before you can use game objects, you must register them. When you no longer need the game objects, unregister them. If you leave them registered, the memory used to store this information (3DPosition, RTPCs, Switches, and so on) is wasted.

Two versions of the AK::SoundEngine::RegisterGameObj() function exist:

and

The second version of the function is for monitoring purposes. It displays the real name associated with objects that are playing. In AK_OPTIMIZED mode, the second version ignores the object name.

You can use either of the following two functions to unregister game objects:

and

AK::SoundEngine::UnregisterAllGameObj() performs a complete clean-up of all parameters currently set for every game object and removes all game object associations. UnregisterGameObj() does the same thing but only for a single game object. After a game object is unregistered, you must register it again before you can reuse it.

Note: Reusing game object IDs can lead to unreliable associations between game objects and names in the Wwise Profiler (see Profiling) because the Profiler only displays the most recently used name when the view is refreshed.

For an example of game object integration, refer to Game Object Example.

See also
AKSOUNDENGINE_API AKRESULT UnregisterAllGameObj()
AkUInt64 AkGameObjectID
Game object ID.
Definition: AkTypes.h:60
AKSOUNDENGINE_API AKRESULT RegisterGameObj(AkGameObjectID in_gameObjectID)
AKSOUNDENGINE_API AKRESULT UnregisterGameObj(AkGameObjectID in_gameObjectID)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise