|
1 | 1 | # Adding Variations to Existing Songs
|
2 | 2 |
|
3 |
| -## TODO: Write this part. |
| 3 | +Through modding, it is possible to add new variations to existing songs. This is great for adding a new difficulty or remix to an existing song (even if that song is from another mod). |
| 4 | + |
| 5 | +## Obtaining Required Files |
| 6 | + |
| 7 | +The first step is to compose a new remix for the song. If you're making a playable character remix, the composer will have to manually make sure the original vocals line up if you want the option to use alternate instrumentals. |
| 8 | + |
| 9 | +You then have to chart this remix. When you're done, you should have an `Inst.ogg` file, two `Voices` OGG files, a `metadata.json` and a `chart.json`. |
| 10 | + |
| 11 | +## Placing the Files |
| 12 | + |
| 13 | +Next, place the assets in the correct spots in our mod folder! Rename each of the files, adding a variation ID of your choice to the end (so if you're making an erect remixes, rename `Inst.ogg` to `Inst-erect.ogg`): |
| 14 | + |
| 15 | +``` |
| 16 | +-mods |
| 17 | + |-myMod |
| 18 | + |-data |
| 19 | + |-songs |
| 20 | + |-mychart |
| 21 | + |-mychart-metadata-erect.json |
| 22 | + |-mychart-chart-erect.json |
| 23 | + |-songs |
| 24 | + |-mychart |
| 25 | + |-Inst-erect.ogg |
| 26 | + |-Voices-bf-erect.ogg |
| 27 | + |-Voices-pico-erect.ogg |
| 28 | + |-_polymod_metadata.json |
| 29 | +``` |
| 30 | + |
| 31 | +## Registering the Variation in the JSON Data |
| 32 | + |
| 33 | +Each chart includes a `songVariations` array, which lets the game know which variations the song has available so it can query their respective metadata files. In order to get the game to load your custom variation, you need to modify the `metadata.json` file for the song's chart, so the game knows that variation exists. |
| 34 | + |
| 35 | +### If the song is from your own mod |
| 36 | + |
| 37 | +If the base song you're adding the remix to is from your own mod, you can just add the variation to the `metadata.json` for your chart. |
| 38 | + |
| 39 | +Add your variation ID to the `playData.songVariations` array (creating the key if it doesn't exist). |
| 40 | + |
| 41 | +```json |
| 42 | +{ |
| 43 | + "playData": { |
| 44 | + "songVariations": ["erect"] // Add your new variation to this array. |
| 45 | + // ... |
| 46 | + } |
| 47 | + // ... |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +### If the song is from the base game, or a different mod |
| 52 | + |
| 53 | +If the base song you're adding to is from a different mod, you don't want to replace the underlying data in case it changes. You want to instead apply a JSON Patch to the file (which Polymod provides the ability to do). |
| 54 | + |
| 55 | +Create a `_merge` folder in your mod folder, then create a file within that directory whose path matches the one you want to patch, like so: |
| 56 | + |
| 57 | +``` |
| 58 | +-mods |
| 59 | + |-myMod |
| 60 | + |-_merge |
| 61 | + |-data |
| 62 | + |-songs |
| 63 | + |-mychart |
| 64 | + |-mychart-metadata.json |
| 65 | +``` |
| 66 | + |
| 67 | +Then we apply a simple patch, which adds a new value to the `playData.songVariations` array. Edit the JSON file and add these contents: |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + { "op": "add", "path": "/playData/songVariations/-", "value": "erect" }, // Add a new value erect to the end of the songVariations array. |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +The patching system is very flexible; it works on any JSON file (base game or provided by another mod) and has support for advanced behavior. See [Merging Files](10-appending-and-merging-files/10-02-merging-files.md) for more information. |
| 76 | + |
| 77 | +## Conclusion |
| 78 | + |
| 79 | +Now, when you start the game, your additional variation should be available in-game! |
| 80 | + |
| 81 | +If you created a character remix, make sure the player character for the remix is included in the `ownedCharacters` data for your custom playable character. See [Custom Playable Characters](05-custom-playable-characters/05-00-custom-playable-characters.md) for more info. |
0 commit comments