This is important, and the default SDK code only has this to some degree.
1. 'Commander' VO:
Meaning: Captured CP, lost CP, Losing game, etc. Not spoken by any trooper on the Battlefield.
This would need no 3D effect (as in decreasing volume when further away) and no syncing over the net. It doesn't even need to be triggered by the server because all the clients will know when a CP is lost anyways.
Possibilities for implementation:
- 'Global' class with ScriptBind, Lua calls whenever some important gameplay event happens.
- A member of the player class, still Lua would call.
- A Lua class (maybe an entity which just does the VO?), Lua can play sounds, too.
In both cases, for managing the sounds we can have them in a table in Lua somewhere and Lua calls with the appropriate sound name,
OR we have them in a .xml file and the C++ class gets them from there.
2. Soldier VO:
Soldiers yelling stuff, should be synced via clients. Especially if we want to have something like calling for help/medic/etc.
The default SDK code seems to play sounds via C++ most of the time. All item sounds and most of the player movement sounds (like swimming, running etc) are played in the C++ class. Some sounds (like hurt/death) seem to be played in Lua.
Possibilities for implementation:
- In the soldier/player Lua class.
- Part of/in the Soldier/Player C++ class.
For storing the sounds, either Lua or XML again.