Ren'Py Lost in code

coffeeaddicted

Well-Known Member
Apr 13, 2021
1,765
1,432
I wonder...

The longer the code gets, the harder it is to find parts i am looking for.
I really wished there was a better interface so you can navigate easier around the listing.
This is especially a problem if i need to change some aspects of the story.

What is the best practice to not getting lost in large listings of this sort?
(maybe i have to better learn how to use Atom)

As versatile RenPy is, it's easy to get lost in it. So when you have thousand's of lines, there is a problem if you need to find a piece you need to change.

Thanks
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
What is the best practice to not getting lost in large listings of this sort?
Split your code, always and in any possible way.

Split the code in short label, each one dedicated to a specific part/scene. And split your labels in files, each one dedicated to a character, kind of scene, location, day, whatever feel explicit for you.

The story come to a change (the player leave the room, a new character join the scene, etc.) ? Then it's a new label.
You make a story that will have parallels routes ? Each major variation of a scene should have its own label.
There's no definitive rules, but globally if your label have more than 300 lines (not counting comments and blank lines), then you're doing something wrong.

Also try to give specific names to your labels, it help to find them back. But it can be optional if you spread them on specific files and keep them in order of appearance. By example, whatever the name of the label for the fifth, out of ten, scene of the day 2, it will be the fifth label of the "day2.rpy" file, and more or less at the middle of the said file.

And don't underestimate the power of comments and blank lines.
A scene generally have different periods. Three consecutive blank lines to separate each, by example, will make you navigate faster among the code for this scene. Same for # ---- Introduction ---- or # ---- Girl do this ---- comments.
You don't have to read your code in order to know where you are in the scene. Either you read the comments or count the blocks. And once you know you're on the right part, you'll only have few dozen of lines to effectively read.
 
  • Like
Reactions: coffeeaddicted

coffeeaddicted

Well-Known Member
Apr 13, 2021
1,765
1,432
This is soooo helpful.

I did not know that RenPy just jumps to a different file like that.
Ok, that makes sense now.
That way i can just bring actually order in this system.
Thank you so much for sharing this.
It proofs again, there are no stupid questions. :)

This will make it much easier to be organized.
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,041
3,140
another tips:

is to make comments/notes like

########comment#####
### this label is for Anna's Blowjob ###
### $Anna_blowjob = True line 349###
### $Anna_blowjob = False line 350###
##########################

yeah it messy but renpy will ignore it just make sure you use #

when you are ready for final release just delete the comments or notes that you made or leaves it in
 
  • Like
Reactions: coffeeaddicted

coffeeaddicted

Well-Known Member
Apr 13, 2021
1,765
1,432
another tips:

is to make comments/notes like

########comment#####
### this label is for Anna's Blowjob ###
### $Anna_blowjob = True line 349###
### $Anna_blowjob = False line 350###
##########################

yeah it messy but renpy will ignore it just make sure you use #

when you are ready for final release just delete the comments or notes that you made or leaves it in
I feel i know not much about RenPy.

There are surely more things that make it more interesting.
Anyway, this tip was a big help.
Now i can actually (i think i should have a long time) separate the images as well. This is getting quite a mess with many renders.

And then i think off games that are much bigger and more advanced. That can not be only in one folder.

But i will take the tip seriously. Many times before you think you have everything but then you realize that there is something missing. So that is a good way to keep track if everything is in it. Or even as reminder for something else.

Thanks again
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
But i will take the tip seriously. Many times before you think you have everything but then you realize that there is something missing. So that is a good way to keep track if everything is in it. Or even as reminder for something else.
One more important point: Nothing is either absolute or universal.

I worked with tons of devs and, outside of big projects with strict conventions, I don't think I ever seen two of them doing exactly the same things in the same way. What is important is that you feel at ease with the way you do it. I gave you the main pointers, Rayminator added his, and some will perhaps do in the future. But in the end it's you who'll have to deal with the code and its organization, not us.
So don't hesitate to try this or that, and finally decide to change everything because it don't works for you. You'll perhaps loose some time reorganizing your code, but it will never be wasted time. In the end, it will help you works faster and, more important, feel more at ease while doing it.

I said it once, at works there's one guy who have everything arranged in alphabetical order in files named "A", "B", and so on. It lead most of us totally crazy, but I can't deny that he's pretty efficient at what he do. It works for him, and at the end of the day it's the only thing that matter.
So don't fear to be stupid because you're organizing your code this or that way. Whatever others, including me, would say about it, if it works for you, then it's the way it have to be done, period.
 
  • Like
Reactions: coffeeaddicted

coffeeaddicted

Well-Known Member
Apr 13, 2021
1,765
1,432
One more important point: Nothing is either absolute or universal.

I worked with tons of devs and, outside of big projects with strict conventions, I don't think I ever seen two of them doing exactly the same things in the same way. What is important is that you feel at ease with the way you do it. I gave you the main pointers, Rayminator added his, and some will perhaps do in the future. But in the end it's you who'll have to deal with the code and its organization, not us.
So don't hesitate to try this or that, and finally decide to change everything because it don't works for you. You'll perhaps loose some time reorganizing your code, but it will never be wasted time. In the end, it will help you works faster and, more important, feel more at ease while doing it.

I said it once, at works there's one guy who have everything arranged in alphabetical order in files named "A", "B", and so on. It lead most of us totally crazy, but I can't deny that he's pretty efficient at what he do. It works for him, and at the end of the day it's the only thing that matter.
So don't fear to be stupid because you're organizing your code this or that way. Whatever others, including me, would say about it, if it works for you, then it's the way it have to be done, period.
Absolutely.

I feel better if it's organized.
So even though there isn't a gold standard of sorts, it's still better to do it however you feel. But to have a very very long listing isn't really the way to go.
I was just not aware that you can do that.
So i am thankful for sharing that insight.

I am not a real programming geek of any kind. So this is all new to me but i won't be let down because of this fantastic community.
And that is all what matters.