Standardizing the Lab Rats 2 Image Format (Patreon)
Content
If you've been following these blogs for the last couple of months you will be familiar with the ongoing Lab Rats 2 image file saga. This post is another, and hopefully last, in that story.
A quick recap: a couple of versions ago LR2's total file count surpassed 64k, almost all of these files being the individual images that are used to make up clothing images, clothing masks, ect. Android .APK files have a 64k limit for individual files, so the android build of Lab Rats 2 broke. For some time the android version contained a limited number of faces to sneak in under the 64k limit and I didn't add any new clothing items or patterns to avoid surpassing it again. Recently I implemented a new file format that stored all of the android versions into a pre-packaged .zip (which the .APK could treat as a single file).
Initially the .zip format was dramatically slower, but with this most recent update I was able to put time into optimizing it. My benchmarks now show the two methods as identical, with the .zip actually producing more consistent display times. Now I am replacing the old PC file structure entirely - all builds of Lab Rats 2 will make use of .zip files to store the character image files.
Changing the PC version over to the .zip file structure has a few major benefits. The first, and probably the most important, is maintainability. By uniting the similar-but-different systems I only have one section of code that needs to be updated if I need to make changes in the future, avoiding potential bugs. It also means that any performance optimizations I am able to make will be applicable to both PC and Android versions. Finally, packaging the files as .zip's makes it easier for modders and developers to grab the files and do whatever they want with them (subject to the Lab Rats 2 license, of course). The old PC based Ren'py archives were never secure, but opening them up took an extra unnecessary step for people who wanted to poke around.
I really hope this is the end of my blog posts about image files, .zip limitations, Ren'py build processes, and all the rest of it! With the Android limitations finally behind me I am starting up some new clothing items to be rendered for v0.35, with some additional features included that I'll talk about in another post!