Friday 11 September 2015

Ren'py game filesize tips, how do you make your game smaller and Sleepy Agents Update

I've been meaning to write on this topic, and I'm sure I have, but only messily until now.

So you know a lot of people have poor internet connections, or not much hard drive space, and when they see a game available for download that's over 100mb they may stop to think twice. Also if you'd like to upload a game to the android play store that is easier when it's under 50mb as you don't need to worry about creating an expansion file (which isn't too bad, but can be an extra hurdle to some I'm sure). Edit: Google Play store now allows files up to 100mb without the need for an expansion file.

So these situations aren't exactly the only reason you'd want to make your games filesize smaller. It's generally considered good practice to trim unnecessary bloat (though on the subject of webdesign this article makes good points about keeping filesizes down http://www.html5rocks.com/en/tutorials/speed/img-compression/ which it's easy to draw parallels with in terms of games which are distributed over the internet - pretty much all games!).

First thing to consider is the engine will already need some megabytes before you start adding assets, in the case of Ren'Py we're talking around 25-30mb. (once compressed in a zip file or similar this gets reduced to aroun 10mb) Is it possible to build a long game in ren'py in under 50mb? Well yes, but if you want to include decent quality (resolution/bitrate) music and art then it would be pretty tight. Instead just aim to trim down files that are unnecessary to the finished product.

A very quick win is to remove the files from the game directory that you don't even use! Yes these will go into the build if they are in the folder, so if they aren't in the game then remove them! There is probably a handy tool for checking for these type of files... I'll see if I can find anything. But I just check manually myself.

Now onto filetypes. You will probably want to use OGG files for audio assets, as these are smaller than MP3s for pretty much the same result. I've listened to OGG files at 320kbps and 192kbps against the WAV originals and found the quality perfectly acceptable for my games, I'd urge you to do a A/B split test to see if your ears can tell the difference if you are concerned about reducing the quality of your audio assets. There are many places you can do further reading on audio filetypes and quality (here is one example: http://www.makeuseof.com/tag/a-look-at-the-different-file-formats-available-part-1-audio/ ) To convert to OGG I use an online converter - http://media.io/

For images I like to use gif with 8 or 16 colours if I'm really trying to get a small file. Obviously this only works for certain assets and aesthetics. I use the Photoshop "Save to Web" export to play with my filetypes, I don't know if this is the best way but I find it has what I need. I also try to save photo's as Jpegs (sliding the compression down to find a good balance between the quality and the filesize - often around 75-85 for me). If you can get your full size images down from around 1mb to around 300kb then you'll be able to have over 3 times the assets for the same filesize at a quality that looks fine to the eye (something I should do is split tests on images using different monitors to see how they compare).

That's about it.

1. Remove unnecessary files from the game directory
2. Use Ogg for audio
3. Compress your images to find a a balance between quality and filesize

I'm sure for longer VNs and games with lots of poses, expressions, etc. there would be much more to say about being logical and not making 10 medium size files when 1 medium size and 10 small ones would accomplish the same job, but that's not something I've got much experience with.

Let me know if you have any thoughts of useful links that I can add to this post :)

Edit: This site is for reducing png filesizes: https://tinypng.com/ - I'm yet to try it out. But thanks very much to @baiyu_dev on twitter for the tip :)

And a quick update on Sleepy Agents:
Thanks for all the downloads and plays of For Ambergris. I've seen a couple of lets plays on youtube which is really amazing, I didn't think that would happen! The game now has an accessible build for anyone wanting to use the ren'py self-voicing feature or the auto-advance feature you can grab that from itch.io - http://sleepyagents.itch.io/for-ambergris
And it is on the Google play store! My first game officially released on Android, which is something I've wanted to do for years now, it feels good to have done that. (the link can be found from the itch.io page too).

What's next? Well I'm re-scripting the pizza game and hopefully will make a drive to finish that over the next few months. I'm also doing some outlines for future games (I have 3 in my mind which are all very different to each other and may or may not be released as sleepy agents games!) So I will share more information about whichever project is going to be next once I have decided!