CreatorsOk
vrengames
vrengames

patreon


Optimization Victory!

I normally like to space out my Patreon posts by two or three days, but I felt like the post I put up yesterday deserved some closure. If you didn't get a chance to read through that post the tl;dr is that I'm hunting for the cause of the roughly minute and a half delay when starting up Lab Rats 2. After a lot of documentation, searching, and a few false starts I was starting to lose hope that I could figure out an elegent solution.

Well I have good news: I've solved the problem! After my post yesterday I found I couldn't just let the problem go and I dove into the Ren'py source code to see if I could find the cause. I had the init phase figured out and knew it would be related to image loading or indexing in some way, so I took some educated guesses and one of them paid off.

Inside of 00images.rpy there is a section of code that takes a given directory and performs some sort of pre-processing for them. Of particular note was a reference to config.images_directory, which seemed to be a list of the folders that should be searched for images that matched the pattern *.png or *.jpg (with * being the wildcard operator meaning "any word"). I had looked the documentation for the different config variables up and down a dozen times during my search and images_directory wasn't mentioned anywhere in it. By setting config.images_directory to None this preprocessing step was avoided entirely and load times were instantly and dramatically improved without any noticable impact to normal character loading!

How dramatically? While testing over the last two days I have been measuring startup times. The average was about 1:20, with some trials loading as fast as 1:05 or as slow as 1:35. Loading the game with images_directory set to None takes a grand total of 10 seconds. That's an increase in loading speed of 900%! This will be particularly nice for new players who might otherwise not bother to wait for the game to start up the first time and move on.

In the end this whole hunt took about 10 hours of dedicated work to figure out, but it was absolutely time well spent. Beyond improving the players enjoyment of the game it will almost certainly save me time in the long run! While developing new features I, as you might expect, start and restart Lab Rats 2 a lot. As a very rough estimate, if we assume I do some dev work every day and start/restart the game 5 times (some nights are much higher, others 0 or 1 start-ups) I will be saving 80*5 seconds per day, or just over 6 minutes. Every month I'm saving 3 hours and 20 minutes of work and in three months I've made back all the time I spent fixing this issue. Because it was proportional to the number of images used in the game and that was likely to only go up the time savings are even better! Of course, there's a relevant xkcd for this.

I also wanted to acknowledge some of the commenters on my previous post who had some clever ideas on how to circumvent the problem. In particular user Thanny found that the problem could be sidestepped if you changed the extensions of all of the image files (notice above how only *.png and *.jpg were looked for?). Had I not found the config option inside of the Ren'py code that likely would have been the approach I ended up taking. You guys are great!

That's all for tonight! There has been some work done on setting up character titles but that I want to talk about but it will have to wait for a future post!

Comments

Hey guys, I have updated and released my content mod to version 15.1, matching the current game version from Vren. You can find the details and a download here: <a href="https://f95zone.to/threads/lab-rats-2-v0-15-1-vren.7260/page-75#post-1801517" rel="nofollow noopener" target="_blank">HERE</a> Version 15.0 to 15.1 includes the following: -Improved Starbuck! You can now invest in her shop! AFter investing, you have the opportunity to help her with some advertising material. Scenes get better if Starbuck as higher sluttiness and love stats. -Jennifer can now be given the Anal Fetish! Once the anal serum advances far enough, it replaces the usual Friday cash begging with a new event where she strips and rides you anally. -With anal role, you can now fuck Jennifer anally in the kitchen. Similar to the vaginal fetish event. -Lily can now be given the Anal Fetish! Once advanced far enough, Lily calls you and ask you meet her at the mall for shopping trip at the sex shop. -New sex option after you've given Lily the anal fetish when she is in her room. -One new general sex position, cunnilingus. This position is designed to help bridge the gap between kissing and missionary. -A couple of special written sex positions, Cowgirl Anal and Doggy Double Penetration -Refactored Vaginal fetish files. Streamlined the function calls and improved the continuity when able. -Added some fetish content to all of the content mod's custom sex positions. -Improved the working weekend event. Low sluttiness characters have the option for a significant sluttiness increase. -Fixed some bugs from the previous version (Thanks again ParadigmShift) -Fixed Starbuck's hair color overwriting other character's hair color.

Well you had a weeks time to figure it out, and seems to me you figured it out in about half a week. That's efficiency! ;) btw, can we get a quick patch so it starts saving our time too sooner than later :D You should really setup a git or SVN repository where you push all the public stuff so we can get the patches and new versions as soon as they are done without needing to download all the existing assets again :p If anything, it would be dope for us users who use their PC's for other stuff than catpics on facebook and TikTok videos ;)

waffel

Wow, I'm going through my entire Renpy games library and changing that variable.

Franka Scy

Congrats on solving the problem. I hope that fix also helps the 10 minutes loading scteen on the mobile port

Nicolas

Have to say I love the game as a whole... But the new serum building jargon makes it very difficult to understand what is happening/going to happen. Also its in very small font... Any way to make it larger and less wordy?

InTheNine

dude, well done and thanks!

Some Idiot


More Models and Creators