XaiJu
vrengames
vrengames

patreon


Cropping Optimizations Complete!

It took a couple more days than I was expecting, but I've finished the image optimizations that will be appearing in v0.30! The tl;dr is that image displays are now much faster, especially if animations are disabled.

The core problem that I was addressing was this: All character and clothing images for Lab Rats 2 were stored as images that were as large as the base character. This made compositing a character simple, all the images were just stacked on top of each other, but it resulted in Ren'py assigning a lot of memory to images that were often a fraction of the screen. In some cases items were occluded by a characters body entirely, but were still being drawn as full (entirely transparent) image. Early on this was fine, but as the clothing display code started making use of more image modifiers and masks the extra work was starting to show.

The concept for the solution is simple: crop all of the images so they only contain the interesting parts, store the offset to the top right of the cropped area, and place the cropped image at that point in the overall image when a character image is created. In practice there were a bunch of moving parts that had to be put together to get this working. A new GIMP script I've written produces the bounding box data and hands it over to the image cropping script I had written a long time ago. The image cropping script crops all of the images (wow) to their correct size and records their offset. I then take those offset records and add them to the clothing entries in Ren'py. When a clothing item is drawn it is placed at that offset.

The result of all that work is that it now takes a very minor amount of time to generate each character displayable. When playing with animations disabled the game flows smoothly, character menus are more responsive, and there is no hitching after selecting an option that requires a character redraw. With animations enabled there is a noticeably shorter pause whenever a character is drawn, although it is still present. Now that the image generation is much faster I think I can optimize the animation by displaying a static image initially and building the animated image in a separate thread, which should avoid blocking interaction.

Animation optimization is going to have to wait though. I've got some ideas for new content for v0.30 that I need to get working on! More on that in a couple of days!


Comments

A list of events can be found if you search Vren's patreon page for "LR2 Events" or scroll down a couple of posts. Not sure what tier it is locked behind, if any.

Report after report it becomes more and more obvious that you're a very skilled programmer/dev :) can't wait for you to push (even) more content tho :D

Minimoy

also why can’t I employ people I meet in the stores or downtown?

philip ash

I really like this game, I wish there was some sort of event guide, I’m sure there’s stuff I haven’t seen

philip ash


More Creators