miskatonicstudio / intrepid

90 stars 8 forks source link

Convert music files to OGG to save disk usage #1

Open akien-mga opened 5 years ago

akien-mga commented 5 years ago

Hi Paweł,

I'm looking into packaging Intrepid for my Linux distro Mageia, and it seems to work well even with Godot 3.1.1.

The source tarball and exported .pck are both pretty heavy, and it seems like there are some low hanging fruits to reduce this disk usage and bandwidth requirement on install.

$ du SOURCES/intrepid-1.0.4.tar.xz 
833M    SOURCES/intrepid-1.0.4.tar.xz
$ du RPMS/noarch/intrepid-1.0.4-1.mga7.noarch.rpm 
188M    RPMS/noarch/intrepid-1.0.4-1.mga7.noarch.rpm

A first thing is that all sounds are in .wav format, while the music tracks could likely work just as well in .ogg with decent enough quality:

$ du sounds/*.wav | grep M
27M     sounds/credits.wav
1,5M    sounds/escape_door.wav
3,5M    sounds/exit_music_reverse.wav
15M     sounds/game_outro_music.wav
7,0M    sounds/intro.wav
87M     sounds/main_music_loop.wav
4,3M    sounds/rumble_mono_1.wav

In the .pck, the .wav files are recompressed to Godot's proprietary .sample format, but the size difference is not big (60M for main_music_loop.wav-40af629615e14c1e1b8d4b2a30d791c4.sample).

After converting the ones which seem to be music tracks to me, I get:

$ du sounds/*.ogg
832K    sounds/credits.ogg
188K    sounds/exit_music_reverse.ogg
1,2M    sounds/game_outro_music.ogg
240K    sounds/intro.ogg
4,0rM    sounds/main_music_loop.ogg

With these changes I go from:

$ du sounds/
148M    sounds/

to:

$ du sounds/
17M     sounds/

In the tarball, I save 104 MB:

$ du ../intrepid-1.0.4.tar.xz 
729M    ../intrepid-1.0.4.tar.xz

I played the main menu music, credits and intro, I don't notice much quality loss, though I'm not a very experienced audio person :)

I did changes locally, so I can PR them if you're interested.

akien-mga commented 5 years ago

I did changes locally, so I can PR them if you're interested.

Changes are in https://github.com/akien-mga/intrepid/tree/music-ogg if you want to test.

akien-mga commented 5 years ago

BTW, final package size (which contains only the .pck + some stuff like README, .desktop file and launch script):

$ du RPMS/noarch/intrepid-1.0.4-1.mga7.noarch.rpm 
129M    RPMS/noarch/intrepid-1.0.4-1.mga7.noarch.rpm

So 59M saved in the final distribution.

One would expect that the 700M worth of textures would make up more of the final package, but I assume they're exported compressed and end up much smaller than their 2k PNG originals.

Size difference on the .pck itself:

$ du -s /usr/share/games/intrepid/intrepid.pck 
417M    /usr/share/games/intrepid/intrepid.pck
$ du -s /media/data/Games/Steam/steamapps/common/Intrepid/Intrepid.pck 
499M    /media/data/Games/Steam/steamapps/common/Intrepid/Intrepid.pck

(Interesting to see how much RPM can reduce the package size, I wouldn't expect .pck to be so compressible.)

akien-mga commented 5 years ago

Unrelated, but one thing I missed in the game or README so far is the attribution/copyright notice for Godot Engine itself as per the MIT license: https://github.com/godotengine/godot/blob/master/LICENSE.txt

Including the legalese in the game is a bit boring, so what I recommend usually is to put a statement that the game is developed with Godot Engine somewhere with a link to https://godotengine.org/license.

akien-mga commented 5 years ago

I'm looking into packaging Intrepid for my Linux distro Mageia, and it seems to work well even with Godot 3.1.1.

I spoke a bit too fast here, the door of the first room doesn't open on 3.1.1. I'll see if I can fix that while preserving compat with 3.0.6.

miskatonicstudio commented 4 years ago

@akien-mga Godot Engine's license has been added to README, sorry it took me so long ;)