버전
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.


이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요