Version

menu_open
Wwise SDK 2019.1.11
Integration Details - Game Objects

Game objects are entities to which such elements 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 to a game object. All Event Actions will be 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 will ignore the game object specified. If an Action should affect a single game object, but the game object specified in AK::SoundEngine::PostEvent() is not valid, the Action will not be executed.

For every game object, there may be 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 would have been 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 need to register them. When you no longer need the game objects, you should unregister them. While leaving them registered will not create an error, memory is wasted storing this information (3DPosition, RTPCs, Switches, and so on).

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

AK::SoundEngine::RegisterGameObj( AkGameObjectID in_gameObjectID );

and

AK::SoundEngine::RegisterGameObj( AkGameObjectID in_gameObjectID, const char * in_pszObjName );

The second version of the function is for monitoring purposes. Using it directs Wwise to display the real name associated with objects that are playing. In AK_OPTIMIZED mode, the second version ignores the object name.

Two functions allow game objects to be unregistered:

AK::SoundEngine::UnregisterGameObj( AkGameObjectID in_gameObjectID );

and

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

For an example of integrating game objects, refer to Game Object Example.

See also
AKSOUNDENGINE_API AKRESULT UnregisterAllGameObj()
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