Sector music playlist (for modding purposes)

Discuss and distribute tools and methods for modding. Moderator - Grognak
Koborover
Posts: 1
Joined: Thu Sep 27, 2012 12:00 am

Sector music playlist (for modding purposes)

Postby Koborover » Thu Sep 27, 2012 1:06 am

For music modding purposes, I looked into sector_data.xml to find out where the different music tracks play. Because this info is scattered across the xml, I thought it would be useful to share an organized list here.

Below is the list of sectors, followed by the names of the tracks that play there. Each of these tracks (except for LastStand) has an Explore and Battle variant for peaceful and combat situations. The TitleScreen track is excluded here, obviously this plays during the title screen and the end credits.

CIVILIAN SECTORS
    Civilian: Civil / Cosmos / MilkyWay
    Engi: Engi / Cosmos / Milkyway
    Zoltan: Zoltan / Cosmos
HOSTILE SECTORS
    Rebel: Colonial / Wasteland
    Pirate: Colonial / Void
    Mantis: Mantis / Debris / Void
    Rockmen: Rockmen / Wasteland
NEBULA SECTORS
    Nebula: Deepspace / Void
    Slug: Debris / Wasteland / Deepspace
HIDDEN SECTOR
    Crystal: Debris / Wasteland / Deepspace
FINAL SECTOR
    Last Stand: LastStand
superarmandbros
Posts: 27
Joined: Tue Aug 05, 2014 10:44 pm

Re: Sector music playlist (for modding purposes)

Postby superarmandbros » Sun Sep 07, 2014 12:37 am

Thank you. This is very helpful for me :)
Just wondering, but if you add a song to the game, does it have to have both the combat and exploration variants, or can it just be one track?
Image
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Sector music playlist (for modding purposes)

Postby Sleeper Service » Sun Sep 07, 2014 1:21 am

The thread is two year old. I seriously doubt the user is still around to receive your thanks. :roll:

Concerning your question:
Yep, that will work. LastStand actually has no battle theme for example.
superarmandbros
Posts: 27
Joined: Tue Aug 05, 2014 10:44 pm

Re: Sector music playlist (for modding purposes)

Postby superarmandbros » Sun Sep 07, 2014 4:03 pm

Sleeper Service wrote:The thread is two year old. I seriously doubt the user is still around to receive your thanks. :roll:

Concerning your question:
Yep, that will work. LastStand actually has no battle theme for example.


Thanks :)
I noticed that you made the CE Additional Music Addon, and I was wondering if you have any time, if you could explain to me how to add music to the game? I'm new to modding.
Image
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Sector music playlist (for modding purposes)

Postby Sleeper Service » Sun Sep 07, 2014 5:07 pm

For getting started it might be helpfull for you to read a general tutorial on how to mod the xmls, like the ones linked n the mod utility thread.

Once you got the idea how appending works, modding the music is relatively easy.

1. Create an audio folder, and create a music folder within it. Thats where you place the music you want to add. If you want to replace existing music you can do that by naming your new tracks like the original files.

2. Create a data folder in the same directory where you created your audio folder.

3. Create a sounds.xml.append text document within that folder. This document will tell the game how to handle the tracks you added. The game music is configured via a track list. For the CE Aditional Music Addon it looks like this:

Code: Select all

   <track>
      <name>deepspace</name>
      <explore>bp_MUS_DeepspaceEXPLORE.ogg</explore>
      <combat>bp_MUS_DeepspaceBATTLE.ogg</combat>
   </track>
   <track>
      <name>colonial</name>
      <explore>bp_MUS_ColonialEXPLORE.ogg</explore>
      <combat>bp_MUS_ColonialBATTLE.ogg</combat>
   </track>
   <track>
      <name>void</name>
      <explore>bp_MUS_VoidEXPLORE.ogg</explore>
      <combat>bp_MUS_VoidBATTLE.ogg</combat>
   </track>
   <track>
      <name>zoltan</name>
      <explore>bp_MUS_ZoltanEXPLORE.ogg</explore>
      <combat>bp_MUS_ZoltanBATTLE.ogg</combat>
   </track>
   <track>
      <name>cosmos</name>
      <explore>bp_MUS_CosmosEXPLORE.ogg</explore>
      <combat>bp_MUS_CosmosBATTLE.ogg</combat>
   </track>
   <track>
      <name>title</name>
      <explore>bp_MUS_TitleScreen.ogg</explore>
   </track>
   <track>
      <name>laststand</name>
      <explore>bp_MUS_LastStand.ogg</explore>
   </track>
   <track>
      <name>hyperspace</name>
      <explore>bp_MUS_HyperspaceEXPLORE.ogg</explore>
      <combat>bp_MUS_HyperspaceBATTLE.ogg</combat>
   </track>
   <track>
      <name>light</name>
      <explore>bp_MUS_LightEXPLORE.ogg</explore>
      <combat>bp_MUS_LightBATTLE.ogg</combat>
   </track>
   <track>
      <name>overpass</name>
      <explore>bp_MUS_OverpassEXPLORE.ogg</explore>
      <combat>bp_MUS_OverpassBATTLE.ogg</combat>
   </track>
   <track>
      <name>polimers</name>
      <explore>bp_MUS_PolymersEXPLORE.ogg</explore>
      <combat>bp_MUS_PolimersBATTLE.ogg</combat>
   </track>
   <track>
      <name>reality</name>
      <explore>bp_MUS_RealityEXPLORE.ogg</explore>
      <combat>bp_MUS_RealityBATTLE.ogg</combat>
   </track>
   <track>
      <name>zombie</name>
      <explore>bp_MUS_ZombieEXPLORE.ogg</explore>
      <combat>bp_MUS_ZombieBATTLE.ogg</combat>
   </track>
   <track>
      <name>cans</name>
      <explore>bp_MUS_CansEXPLORE.ogg</explore>
      <combat>bp_MUS_CansBATTLE.ogg</combat>
   </track>
</music>

As you can see it contains the original music and the tracks added by the addon. You list should contain the original music and your custom tracks. Coppy the vanilla tracklist into the append file. You can get it by extracting the game data, its stored in the orginal sounds.xml file.

4. Copy a <track> capsule and change the <name> tag to your liking.

5. change the <explore> and <combat> tags to the file names of the songs you added. If you remove the <combat> tag the track will simply play its <explore> variant all the time. (Note: <explore> and <combat> tracks must always have the same length in seconds to work correctly together.) Now the game knows that your music exists.

6. But it does not yet know when to play it. What music is played in which sector is handled via the sector_data.xml.append file. Create this file and put it into your data folder.

7. For demonstrations sake, I'll assume you want your tracks to be played in Rock controlled sectors. Copy the vanilla entry for the Rock controlled sector into your sector_data.xml.append.

Code: Select all

<sectorDescription name="ROCK_SECTOR" minSector="1" unique="false">   
   <nameList>
      <name>Rock Controlled Sector</name>
   </nameList>
   <trackList>
      <track>rock</track>
      <track>wasteland</track>
   </trackList>
   <rarityList>
      <blueprint name="engi" rarity="0"/>
      <blueprint name="mantis" rarity="0"/>
      <blueprint name="energy" rarity="3"/>
      <blueprint name="slug" rarity="0"/>
      <blueprint name="rock" rarity="1"/>
      <blueprint name="human" rarity="2"/>
      <blueprint name="BOMB_LOCK" rarity="4"/>
   </rarityList>
   <!--<event name="STORE" min="2" max="4"/>-->
   
   <startEvent>START_BEACON_ROCK</startEvent>
   <event name="STORE_ROCK" min="2" max="2"/>
   <event name="NOTHING_ROCK" min="2" max="3"/>
   <event name="DISTRESS_BEACON_ROCK" min="1" max="2"/>
   <event name="HOSTILE_ROCK" min="6" max="8"/>
   <event name="BOARDERS_ROCK" min="1" max="2"/>
   <event name="ITEMS" min="1" max="2"/>
   <event name="QUESTS_ROCK" min="0" max="1"/>
   <event name="NEUTRAL_ROCK" min="7" max="8"/>   
</sectorDescription>

The <trackList> capsule in the <sectorDescription> is what tells the game which music to play in this sector.

8. Add <track> with the name you used for your music in sounds.xml.append to the sectors where you want your music to be played. The tracks will be played in the order you put them in the <trackList>. Once all the songs are played the game will start from the beginning of the list again.

9. Compress your data and audio folders into a single file and rename the file ending to .ftl. Patch it in with SMM and your music should be played in the respective sectors. Done.

Some more hints:
- I tried to be comprehensive but it might also help to simply look at how other mods (for example the Aditional Music Addon) did this, by extracting the mod file and, well, looking at the files. :) I generally found that a lot of the xml stuff is to some degree self-explanatory.
- My example is very intrusive. For example it will completely overwrite any changes made to the Rock sector blueprint by other mods. That is bad for compatibility. The new SMM offers some advanced functionalities that probably would allow to inject the new tracks into the existing sector blueprint and into the generally music tracklist. I'm not an expert on this.

Hope that works for you. Happy modding.
superarmandbros
Posts: 27
Joined: Tue Aug 05, 2014 10:44 pm

Re: Sector music playlist (for modding purposes)

Postby superarmandbros » Sun Sep 07, 2014 6:46 pm

Sleeper Service wrote:For getting started it might be helpfull for you to read a general tutorial on how to mod the xmls, like the ones linked n the mod utility thread.

Once you got the idea how appending works, modding the music is relatively easy.

1. Create an audio folder, and create a music folder within it. Thats where you place the music you want to add. If you want to replace existing music you can do that by naming your new tracks like the original files.

2. Create a data folder in the same directory where you created your audio folder.

3. Create a sounds.xml.append text document within that folder. This document will tell the game how to handle the tracks you added. The game music is configured via a track list. For the CE Aditional Music Addon it looks like this:

Code: Select all

   <track>
      <name>deepspace</name>
      <explore>bp_MUS_DeepspaceEXPLORE.ogg</explore>
      <combat>bp_MUS_DeepspaceBATTLE.ogg</combat>
   </track>
   <track>
      <name>colonial</name>
      <explore>bp_MUS_ColonialEXPLORE.ogg</explore>
      <combat>bp_MUS_ColonialBATTLE.ogg</combat>
   </track>
   <track>
      <name>void</name>
      <explore>bp_MUS_VoidEXPLORE.ogg</explore>
      <combat>bp_MUS_VoidBATTLE.ogg</combat>
   </track>
   <track>
      <name>zoltan</name>
      <explore>bp_MUS_ZoltanEXPLORE.ogg</explore>
      <combat>bp_MUS_ZoltanBATTLE.ogg</combat>
   </track>
   <track>
      <name>cosmos</name>
      <explore>bp_MUS_CosmosEXPLORE.ogg</explore>
      <combat>bp_MUS_CosmosBATTLE.ogg</combat>
   </track>
   <track>
      <name>title</name>
      <explore>bp_MUS_TitleScreen.ogg</explore>
   </track>
   <track>
      <name>laststand</name>
      <explore>bp_MUS_LastStand.ogg</explore>
   </track>
   <track>
      <name>hyperspace</name>
      <explore>bp_MUS_HyperspaceEXPLORE.ogg</explore>
      <combat>bp_MUS_HyperspaceBATTLE.ogg</combat>
   </track>
   <track>
      <name>light</name>
      <explore>bp_MUS_LightEXPLORE.ogg</explore>
      <combat>bp_MUS_LightBATTLE.ogg</combat>
   </track>
   <track>
      <name>overpass</name>
      <explore>bp_MUS_OverpassEXPLORE.ogg</explore>
      <combat>bp_MUS_OverpassBATTLE.ogg</combat>
   </track>
   <track>
      <name>polimers</name>
      <explore>bp_MUS_PolymersEXPLORE.ogg</explore>
      <combat>bp_MUS_PolimersBATTLE.ogg</combat>
   </track>
   <track>
      <name>reality</name>
      <explore>bp_MUS_RealityEXPLORE.ogg</explore>
      <combat>bp_MUS_RealityBATTLE.ogg</combat>
   </track>
   <track>
      <name>zombie</name>
      <explore>bp_MUS_ZombieEXPLORE.ogg</explore>
      <combat>bp_MUS_ZombieBATTLE.ogg</combat>
   </track>
   <track>
      <name>cans</name>
      <explore>bp_MUS_CansEXPLORE.ogg</explore>
      <combat>bp_MUS_CansBATTLE.ogg</combat>
   </track>
</music>

As you can see it contains the original music and the tracks added by the addon. You list should contain the original music and your custom tracks. Coppy the vanilla tracklist into the append file. You can get it by extracting the game data, its stored in the orginal sounds.xml file.

4. Copy a <track> capsule and change the <name> tag to your liking.

5. change the <explore> and <combat> tags to the file names of the songs you added. If you remove the <combat> tag the track will simply play its <explore> variant all the time. (Note: <explore> and <combat> tracks must always have the same length in seconds to work correctly together.) Now the game knows that your music exists.

6. But it does not yet know when to play it. What music is played in which sector is handled via the sector_data.xml.append file. Create this file and put it into your data folder.

7. For demonstrations sake, I'll assume you want your tracks to be played in Rock controlled sectors. Copy the vanilla entry for the Rock controlled sector into your sector_data.xml.append.

Code: Select all

<sectorDescription name="ROCK_SECTOR" minSector="1" unique="false">   
   <nameList>
      <name>Rock Controlled Sector</name>
   </nameList>
   <trackList>
      <track>rock</track>
      <track>wasteland</track>
   </trackList>
   <rarityList>
      <blueprint name="engi" rarity="0"/>
      <blueprint name="mantis" rarity="0"/>
      <blueprint name="energy" rarity="3"/>
      <blueprint name="slug" rarity="0"/>
      <blueprint name="rock" rarity="1"/>
      <blueprint name="human" rarity="2"/>
      <blueprint name="BOMB_LOCK" rarity="4"/>
   </rarityList>
   <!--<event name="STORE" min="2" max="4"/>-->
   
   <startEvent>START_BEACON_ROCK</startEvent>
   <event name="STORE_ROCK" min="2" max="2"/>
   <event name="NOTHING_ROCK" min="2" max="3"/>
   <event name="DISTRESS_BEACON_ROCK" min="1" max="2"/>
   <event name="HOSTILE_ROCK" min="6" max="8"/>
   <event name="BOARDERS_ROCK" min="1" max="2"/>
   <event name="ITEMS" min="1" max="2"/>
   <event name="QUESTS_ROCK" min="0" max="1"/>
   <event name="NEUTRAL_ROCK" min="7" max="8"/>   
</sectorDescription>

The <trackList> capsule in the <sectorDescription> is what tells the game which music to play in this sector.

8. Add <track> with the name you used for your music in sounds.xml.append to the sectors where you want your music to be played. The tracks will be played in the order you put them in the <trackList>. Once all the songs are played the game will start from the beginning of the list again.

9. Compress your data and audio folders into a single file and rename the file ending to .ftl. Patch it in with SMM and your music should be played in the respective sectors. Done.

Some more hints:
- I tried to be comprehensive but it might also help to simply look at how other mods (for example the Aditional Music Addon) did this, by extracting the mod file and, well, looking at the files. :) I generally found that a lot of the xml stuff is to some degree self-explanatory.
- My example is very intrusive. For example it will completely overwrite any changes made to the Rock sector blueprint by other mods. That is bad for compatibility. The new SMM offers some advanced functionalities that probably would allow to inject the new tracks into the existing sector blueprint and into the generally music tracklist. I'm not an expert on this.

Hope that works for you. Happy modding.


Thank you so much! You have no idea how helpful this is to me! :D :D :D

But there is only one problem.

When I patch it into the game, SMM says this:

Code: Select all

Patching failed: org.jdom2.JDOMException: While processing "more music.ftl:data/sector_data.xml.append (wrapped)", strict parsing failed, then sloppy parsing failed: Error on line 6: At line 6, column 24: Unexpected characters.


I'll send the file for you to see, because I really don't know what is wrong.

https://www.dropbox.com/s/xb3jpfd7roiurwh/more%20music.ftl?dl=0

I've tripple checked the files and it should all work.
Image
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Sector music playlist (for modding purposes)

Postby Sleeper Service » Sun Sep 07, 2014 7:43 pm

Kraftwerk? Thats some serious old-school stuff you modded in there. :D

I'm not entirely sure what causes the problem, but here is some stuff I noticed:
- The zip contains a _MACOSX folder, not sure what that is doing there and if it causes problem, but it just might
- I think vanilla <name> tags never contain upper case letters. FTL is sometimes finicky about that.
- Its generally better to immediate vanilla naming conventions as close as possible, just to be save. Your file names might need to contain the stuff like bp_MUS_ and EXPLORE and so on...
- STANDARD_SPACE is not a great place to test stuff cause the game is rather incoherent about how it uses that sector blueprints. Consider putting the track into another sector first (not civilian, that one acts weird too). Modifying STANDARD_SPACE might cause the crash.
- You also copied the entire sound.xml into your .append file. That is not necessary, you can delete everything other than the <music> capsule

/Edit:
Sorry I just read that the error was caused when patching the sector data. And it even tells you that there is an unexpected character at line 6 collum 24. That is exactly where your the uppercase D of your track name is located, so its probably the upper case letters that cause the problem. Consider changing the track name to lower case.
Abs
Posts: 82
Joined: Tue Aug 05, 2014 10:01 am

Re: Sector music playlist (for modding purposes)

Postby Abs » Sun Sep 07, 2014 8:15 pm

Sleeper Service wrote:Note: <explore> and <combat> tracks must always have the same length in seconds to work correctly together.


Hey...I already have custom music in-game, but can you expand upon your note a bit further, please? What happens if they're not the same length?

Thanks,

Abs
Image
Click to go to the mod's facebook page for the latest updates!
superarmandbros
Posts: 27
Joined: Tue Aug 05, 2014 10:44 pm

Re: Sector music playlist (for modding purposes)

Postby superarmandbros » Sun Sep 07, 2014 8:37 pm

Sleeper Service wrote:Kraftwerk? Thats some serious old-school stuff you modded in there. :D

I'm not entirely sure what causes the problem, but here is some stuff I noticed:
- The zip contains a _MACOSX folder, not sure what that is doing there and if it causes problem, but it just might
- I think vanilla <name> tags never contain upper case letters. FTL is sometimes finicky about that.
- Its generally better to immediate vanilla naming conventions as close as possible, just to be save. Your file names might need to contain the stuff like bp_MUS_ and EXPLORE and so on...
- STANDARD_SPACE is not a great place to test stuff cause the game is rather incoherent about how it uses that sector blueprints. Consider putting the track into another sector first (not civilian, that one acts weird too). Modifying STANDARD_SPACE might cause the crash.
- You also copied the entire sound.xml into your .append file. That is not necessary, you can delete everything other than the <music> capsule

/Edit:
Sorry I just read that the error was caused when patching the sector data. And it even tells you that there is an unexpected character at line 6 collum 24. That is exactly where your the uppercase D of your track name is located, so its probably the upper case letters that cause the problem. Consider changing the track name to lower case.




Okay, first of all, I need to tell you something. I have zero skill level at composing music, which is why I'm using Autobahn. I think that song fits perfectly for the ambience of FTL. Also, this is more of an experimental mod (as you can tell with my poor music editing), so I can see how modding music works (who knows, if I get permission from Kraftwerk and I do a better job at editing, it might be released ;) ).

Now there is good news and bad news.

The good news is that I did all the changes and now SMM has no problem patching my mod into the game. The only thing I didn't do was change the sector from CIVILIAN to something else. You see, I don't like the songs in that sector (and maybe that's the reason for the bad news...)

The bad news is that my song doesn't play at all. I had to painfully stare at my ship for 15 minutes listening to the music, in the hopes that the next song would be mine. All that happened was that the music tracklist went back to the beginning.

The reason why there is a MAC OSX folder is because I use a Mac. I don't think that affects the mod though.

Anyways, I really don't want to be a pest having to ask you each time to 'correct' my work. All I want to say is thank you ever so much for helping me get this far in modding music and for getting back to me in such short notice.

PS: I'm surprised you managed to find out it was Kraftwerk. Not that many people know about them. :)
PPS:The file is different but the download link is the same.
https://www.dropbox.com/s/xb3jpfd7roiurwh/more%20music.ftl?dl=0
Image
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Sector music playlist (for modding purposes)

Postby Sleeper Service » Sun Sep 07, 2014 10:32 pm

superarmandbros wrote:The bad news is that my song doesn't play at all. I had to painfully stare at my ship for 15 minutes listening to the music, in the hopes that the next song would be mine. All that happened was that the music tracklist went back to the beginning.

To clarify: The first sector will defy modification to some extend and it might be possible that modding the music there simply does not work. I hit a wall there several times myself, for example the sector does not accept any custom sector names. It is also not clear if STANDARD_SPACE actually is the blueprint that is used for the first sector. All I know for sure about the first sector is that it uses the same event lists as the civilian sector (but not its name lists.) Bottom line: Adding music for new sectors and vanilla faction sectors works; but some stuff might just not work when attempted with the first sector.