Compressing Your Game: A Ren’Py Howto

Compressing Your Game: A Ren’Py Howto

The game’s script has been written, renders have been painstakingly crafted and you’ve lovingly plonked everything inside your favorite development framework. Just hit publish, right? Wrong.

WebP savings compared to the original PNG

Lots of developers throw the images they just rendered in DAZ3D into their game directory without considering whether that’s the best cause of action. DAZ3D for example, outputs uncompressed PNG images by default which are lossless, which is nice, but also take up a lot of disk space. Yes, your artwork deserves to be seen, but those pretty pictures don’t need to take up over 4MB per image. Compression and finding the right balance between quality and size are key in this case.

Converting the lossless images to lossy JPEGs is a good start and will shave off quite a few megabytes, but it will only work on images that don’t require transparency. However, there’s a better image format that’s supported by Ren’Py and it offers superior compression. WebP, developed by Google, offers the same advantages as PNG (mainly alpha-transparency), but due to its compression the resulting file-sizes are much smaller.

To create WebP versions of your existing images you have a couple of options. Google offers a command line application called cwebp and a Photoshop plugin. The popular open-source application GIMP has supported WebP since its 2.10 release.

You’ll probably want to convert your images in bulk and in that case a batch converter like XnConvert (freeware) is invaluable. The process is quite simple:

XnConvert’s interface
  • First, whatever you do, make sure you keep your originals, the compressed versions are *not* a replacement!
  • Install and open XnConvert.
  • Drag the files you want to convert (or add them using “Add files”).
  • In the “Output” tab select “WebP” from the “Format” list.
  • Click “Settings” underneath the “Format” list.
  • Drag the quality slider to a value between 95 and 100, this will ensure a good compression versus image quality ratio.
  • Hit “Convert” in the lower-hand corner of the application window.
  • Replace the converted WebP images with the old ones in your game directory.

And that’s it!

This article first appeared on lewdpixels.com. Leave a comment there or join their Discord server.