Imported from Zwaliebaba/InterstellarOutpost.dx12 (
.claude/skills/add-sound/SKILL.md). Install upstream withnpx skills add Zwaliebaba/InterstellarOutpost.dx12 --skill add-sound. Copyright stays with the author.
Add New Sound: $ARGUMENTS
Add a new sound effect to InterstellarOutpost.
Steps
-
Understand the audio system — Read
NeuronClient/soundsystem.h/soundsystem.cppfor the top-level audio manager. For 3D positional audio readNeuronClient/sound_library_3d.hand the XAudio2 backendsound_library_3d_xaudio.h. For 2D/UI sounds readNeuronClient/sound_library_2d.h. CheckNeuronClient/sound_instance.handsound_parameter.hfor how individual sound instances and parameters are managed. -
Add the audio asset:
- Place the
.wav/.oggfile inInterstellarOutpost/Assets/sounds/(or the existing asset sub-folder convention) - For streaming music, ensure the
sound_stream_decodercan handle the format
- Place the
-
Register the sound:
- Add a string ID or enum constant for the new sound in
soundsystem.h(or wherever existing sound names are declared) - Register the asset path in the sound system initialisation (
soundsystem.cpp)
- Add a string ID or enum constant for the new sound in
-
Play the sound:
- For 3D positional sounds: call the appropriate
sound_library_3dplay function, passing a world-spacevector3position. Hook this call from the entity or event that triggers it (e.g., inInterstellarOutpost/entity update orGameRenderer/effect code). - For 2D / UI sounds: call the
sound_library_2dplay function from the UI event handler inGameLogic/orNeuronClient/eclipse.cpp. - Use
sound_parameterto set volume, pitch, and loop flags as needed.
- For 3D positional sounds: call the appropriate
-
Apply sound filtering if needed — For reverb or environmental effects, consult
NeuronClient/sound_filter.h. -
Test with sample cache — If the sound will be played frequently, ensure it is pre-loaded into
NeuronClient/sample_cache.hto avoid runtime stalls.
Conventions
- Keep audio assets at appropriate sample rates (44100 Hz preferred)
- 3D sounds must be short enough to not overlap badly when many instances play simultaneously — set a max-instance limit in the sound registration
- UI sounds should be 2D (non-positional) so they are unaffected by listener position
