So, I've never programmed in Renpy, but I use Python frequently. What is the gist of what your script is doing? Do you mainly write the dialog and the choices in a specific format so that Python will recognize it, and your script turns it all into Renpy friendly format?
I am sure it does a lot more, since you mentioned the word "massive". Do you mind letting us know gist of what it does? Just because I am always interested in unique programming challenges. (What can I say, I am a complete nerd).
Basically yes to the first part. It's just a string manipulation script that opens each txt file I export and converts specific keywords into Renpy code.
So in my script I may have a line that looks like this:
Code:
[@]new cassie floating
‘I had to position myself strategically because the sight of her stretched out on that mat was very appealing.’
And the script identifies the [@] notation and the 'new' keyword and replaces that line with:
Code:
scene ch0305 02 cassie floating with dissolve
'I had to position myself strategically because the sight of her stretched out on that mat was very appealing.'
And it will automatically create a companion file with all my images definitions. So based on that original [@] symbol, it also writes:
Code:
layeredimage ch0305 02 cassie floating:
if "nude" in scribe._game_mode_status.keys() and scribe._game_mode_status["nude"] and renpy.loadable("alt game modes/nude/nude ch0305 02 cassie floating.webp"):
"alt game modes/nude/nude ch0305 02 cassie floating.webp"
elif "lingerie" in scribe._game_mode_status.keys() and scribe._game_mode_status["lingerie"] and renpy.loadable("alt game modes/lingerie/lingerie ch0305 02 cassie floating.webp"):
"alt game modes/lingerie/lingerie ch0305 02 cassie floating.webp"
elif(ch.current_mood.lower() == "blue"):
"images/cassie/chapter03/scene05/blue ch0305 02 cassie floating.webp"
else:
"images/cassie/chapter03/scene05/red ch0305 02 cassie floating.webp"
And it writes all of that from scratch just based on the [@] sign. The rest it gets from the file name itself. So if the txt file is "ch0305", it knows that it's a Cassie Chapter. That it's Chapter 03 and Scene 05 and builds out the directories and creates links to the images. The important part of all this is that for all the above code, all I had to write was "[@]new cassie floating". The script handles the rest and puts everything where it belongs.
This example is just what it does with the images. I have other symbols and keywords for adding music, dialogue options, choices, recording choices, adding sound effects, jumping chapters. Pretty much everything I need to custom code now has a tag and a script tied to it.
I'm going into my third month and 12th playtest using this script and so far no errors as a result of the script have been reported. So it works pretty good.
----------
The part of the job that was massive though was reorganizing Renpy's directories into a more logical structure. I'm sure for some developers the way Renpy is set up by default makes sense, but it quickly got old having to sift through several files trying to find the parameter or screen that I wanted to change.
So I stripped out all of the directories and default renpy files that I would be changing on a regular basis and reorganized them so that I can drill down to what I need faster.
By default Renpy's Screens File is about 1500 lines long and has every screen definition located in a single file. The gui file is another 500 lines. And sometimes you change one thing and accidently cascade that change to four or five other things without intending to or realizing it.
I got tired of digging through two or more files to alter my interface. So I took those 1500 lines and broke them up into individual files and directories based on the components that a given file actually defines. Each Element has it's own directory, the code that defines it, and any images that it uses. Sure, I now have twenty files in place of a single one. But each file only has a handful of lines and I can see immediately what it defines and can confidently alter things without worrying about accidentally changing something else.
I'm trading efficiency for cleanliness of code and simplicity of manipulation. Anyone should be able to open my "Gui" directory in the game and immediately see where everything is stored and what should be changed to alter this or that. It's more intuitive and less prone to accidental alterations.
My system also leads to some duplication of code and image files, but that duplication adds an irrelevantly small size to the game over all. But the upside is that I have everything compartmentalized and stored safely by itself.
So today when it came time to add a whole new option to the game menu with the Pregnancy Percentage, it took me less than ten minutes to update my gui and it fired of perfectly the first time. I knew where to store the images, and which file to update. I opened the file and in a few lines was quickly refreshed on how it was producing the results and updated them accordingly.
I didn't do anything particularly revolutionary or clever. I just spent a lot of time breaking things apart and putting them back together in a way that would allow me personally to work faster, more efficiently, and with less possible errors than before.