Version
menu_open

Understanding the Sound Engine Integration into Cube

The following tasks were involved when integrating the Wwise sound engine into Cube:

Preparing Cube for Wwise

Cube, originally developed by Wouter van Oortmerssen, is an open-source single or multi-player first person shooter game that is readily available from the Cube web site (http://cube.sourceforge.net/). To accommodate the integration of Wwise, the following modifications were made to the version downloaded from the Cube website:

  • The existing sound code was rewritten to use the Wwise sound engine.

  • The audio content was moved into a Wwise project.

  • Dependencies on other libraries (SDL, SDL_image, libpng) were removed.

  • Extra audio (footsteps, for example) was added.

  • Some game config and content files were modified to accommodate the above changes.

Registering Game Objects

Two kinds of game objects were registered in the sound engine:

  • Pointers to the baseent struct. These are the moving entities of the game world: players, monsters, and projectiles.

  • Dummy game objects, numbered 64-127. These are used for 3D sounds that are not attached to a moving entity (for example, items spawning).

Integrating Audio

The core of the audio integration code is located in the <WwiseRoot>\Cube\cube_source\src folder in the following files:

  • Sound.cpp—includes all code that accesses the sound engine.

  • Sound section of Protos.h—includes the declared public functions.

The following types of sounds were involved in the integration process:

  • Monster Play Sounds:

    • Each character has associated pain, die, and footstep events. (See monstertypes[] in monster.cpp.)

    • Footstep events are posted from the monsterfootstep() function, which also sets the 'Material' Switch corresponding to the texture underneath the character to drive the footstep Switch Container.

    • Items have associated pickup events. (See itemstats[] in entities.cpp)

  • Magic Sounds:

    • Each type of magic has an associated event. (See guns[] in weapon.cpp)

    • Projectiles have a splashing event (S_FEXPLODE, S_RLHIT).

    • Throwing ice gems while quad damage is enabled also posts the event S_ITEMPUP.

  • Network Sounds:

    • Certain events also need to go to the server for network play; this is handled by snd_clientevent().

  • Miscellaneous Sounds:

    • To find all other sound events occurring during game play, search for snd_event() calls in the code base.

Adding New Scripting Commands

The following new sound-related commands were created to help you manage the sounds. These can be used in the .cfg script files:

  • akevent <string>: post an event (by name) on the local player game object (player1).

  • soundvol <int>: to set the sound volume (0-255).

  • musicvol <int>: to set the music volume (0-255).

  • voicevol <int>: to set the voice volume (0-255).

  • texturematerial <int> <string1> <string2>: this is essentially the same command as 'texture', but with an added parameter which is the associated material for footsteps.


Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise