Excluding certain RPY files to speed up game launch/reload?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
User avatar
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA

Excluding certain RPY files to speed up game launch/reload?

#1 Post by SleepKirby » Fri Apr 12, 2019 5:15 pm

I'm trying to reduce the time it takes to reload my game (with Shift+R) to make testing code a little less tedious.

After experimenting with removing/commenting various .rpy files in the game, the biggest reload-time factor I've found is the combined size of the story script files. We generally have one .rpy file per scene in the game's story, with a total of 118 story .rpy files adding up to 2.5 MB (Lint reports close to 300k words). If I remove 99% of this story content, the reload time goes down by about 1/3, from roughly 13.5 seconds to 9 seconds. (For comparison, the Tutorial takes 6.5 seconds and The Question takes 4 seconds. I typically throttle my CPU power usage so the fan runs quiet.)

So, what I can do is move most of the story files out of the /game folder when I'm just working on a single scene (as I am most of the time). Then when it's time to commit to version control, or test the game as a whole, I'd move those story files back into the /game folder.

This isn't too bad to do, but is there a more convenient or less error-prone way to, essentially, tell Renpy not to load certain .rpy files when loading the game? Ideas I've tried / thought of:

1. I tried config.loadable_callback, but it doesn't seem to apply to .rpy files (only stuff like .py and .png), and it can only include additional files rather than exclude normally-included ones. I guess the first part isn't too surprising, because specifying .rpy files to exclude using an .rpy-defined config value would kinda present a chicken-and-egg problem.

2. I could write a batch/shell script to automate the processes of moving .rpy files back and forth, taking one argument to indicate the story file patterns that I AM working on. This is probably what I'll do if I get sick of moving files manually. I'm not sure if my team members would find this super-easy to use, though.

Post Reply

Who is online

Users browsing this forum: No registered users