Adding music to menus in Ryzom Core is a fairly simple exercise. You can define the loading music via the configuration file and you can define music to be played within the UI based upon conditions using action handlers.
There are a number of places where loading music is performed.
The default loading music is defined in the configuration file as SoundOutGameMusic and the default file name is "Main Menu Loop.ogg" You can simply replace this file or change the configuration file.
The SoundOutGameMusic configuration variable is a DEV variable - meaning it cannot be overridden when the client is in FINAL_VERSION.
Within the net_manager.cpp file the teleport loading music is determined via the loading background:
- TeleportKamiBackground == "Kami Teleport.ogg"
- TeleportKaravanBackground == "Karavan Teleport.ogg"
- ResurectKamiBackground or ResurectKaravanBackground == no music.
- Default == "Loading Music Loop.ogg"
While not strictly "loading music" the music that is played when a player dies is always "death.ogg".
- Ensure that your music is in Ogg format and available in the Ryzom path for lookup. Typically you would bundle them up in the sound BNPs but that isn't a requirement just a best practice.
- Create a new action tag with a handler of play_music_outgame.
- Set your conditions accordingly.
- Set the params attribute with a pipe-delimited value set:
- name = the filename of the song
- async = 0 or 1, signally the audio mixer whether to stream the song (1) or load the whole song into memory first (0)
<!-- SELECT SPECIE -->
<!-- ... snipped out a lot of UI config -->
<!-- Music playing -->
<action handler="play_music_outgame" cond="eq(@UI:TEMP:CHAR3D:PEOPLE,0)" params="name=Character Creation Fyros.ogg|async=1" />
<action handler="play_music_outgame" cond="eq(@UI:TEMP:CHAR3D:PEOPLE,1)" params="name=Character Creation Matis.ogg|async=1" />
<action handler="play_music_outgame" cond="eq(@UI:TEMP:CHAR3D:PEOPLE,2)" params="name=Character Creation Trykers.ogg|async=1" />
<action handler="play_music_outgame" cond="eq(@UI:TEMP:CHAR3D:PEOPLE,3)" params="name=Character Creation Zorai.ogg|async=1" />
You can also play using using NeL commands defined within the client. The music command takes three arguments:
- file name
- loop (0 or 1)
- fade time (in ms)