- For reducing the size of the game.droid file and game memory usage.
- Note: Doing this won't guarantee your game will start working in YoYo Loader.
You Will Need:
- UndertaleModTool: https://github.com/krzys-h/UndertaleModTool
- Archive extractor. Example: 7zip: https://www.7-zip.org/
- ffmpeg package/executable https://ffmpeg.org/download.html
- Game files of your GMS game.
Setup:
- Extract UndertaleModTool to a directory on your PC.
- Extract ffmpeg to a directory on your PC.
- Move your data.win/game.droid and any audiogroup.dat files to a new directory.
- Make a backup of the directory containing the data.win/game.droid and audiogroup.dat files.
Step 1: Externalise embedded audio files
- Open the game.droid file of your GMS game in UndertaleModTool.
- Navigate to the "Scripts>Run Community Scripts" tab and find "ExternalizeAllOGGs.csx" and click to run it.
- Click yes to both pop ups. (first confirms you made a backup of your files, second splits the exported files by audiogroup).
- A folder will be created in the same directory called "Exported_Sounds" containing all embedded audio files.
- Save your game.droid file. It should be smaller in size.
Step 2: Converting exported .WAV files to .OGG format
- Within the "Exported_Sounds" folder you will find one or more subfolders containing .WAVs and .OGGs audio files.
- Locate the "ffmpeg.exe" in your ffmpeg directory and copy and paste it into the "Exported_Sounds" folder.
- Open a Powershell Console window.
- In the script below, edit the
$filepath
varaible with the path to your "Exported_Sounds" folder. - Now run the script in Powershell.
$filepath = 'C:\[YourFilepathToTheSubFolder]\Exported_Sounds'
Get-ChildItem $filepath -recurse -include *.wav |
Foreach-Object {
$nameNoExt = $_.BaseName
Set-Location -Path $_.Directory
$ArgumentList = "-i `"$nameNoExt.wav`" `"$nameNoExt.ogg`""
Start-Process -FilePath $filepath\ffmpeg.exe -ArgumentList $ArgumentList -Wait -NoNewWindow
Remove-Item -Path $_
}
- This script will use "ffmpeg.exe" to convert all .WAVs to .OGGs in all the subfolder within "Exported_Sounds".
- The script will also delete all .WAV files.
- Once the conversion is complete, delete the "ffmpeg.exe".
Step 3: Correcting audiogroup references in game.droid
- If you only have one subfolder in "Exported_Sounds" (audiogroup_default), skip to Step 4.
- If you have 2 or more subfolders, you will need to correct the audiogroup references within game.droid.
- Warning: This can be a time consuming manual process, depending on how many audiogroups there are.
- Open the game.droid file of your GMS game in UndertaleModTool.
- Navigate to the "Audio groups" drop down in the project browser (left) and expand it.
- Navigate to the "Sounds" drop down in the project browser and expand it.
- Double click one of the "Sounds" entries to open it and observe the "Audio group" field.
- Drag one of the entries under the "Audio groups" drop down and drop it onto the Sound file "Audio group" field.
- Observe how the "Audio group” reference is repalced.
- Using this "Drag and Drop" method and cross-checking against the named subfolders of your externalised .OGGs.
- You must ensure all externalised sound files have the correct audiogroup reference.
- Once completed, save your game.droid file.
Step 4: Repacking the assets
- You can now drop the game.droid, audiogroup.dat files and "Exported_Sounds" folder back into your APK.
- Ensure to add the .OGG files to the APK as "store". This is explained in Step 4 of the Asset Swap tutorial.