Any thoughts for an "introduction to RenPy" style tutorial?

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,537
I really appreciate the effort here to help newbies, of which I definitely classify. I have just mostly read the Renpy documentation so far. However, my best resource so far has been taking about five of my favorite games that seem really polished and stylistically similar in certain ways of what I might want to make and then just opening them up and reading their code very carefully. Like just today, I read another code to figure out how to zoom and pan an image and how the coder sized their pic larger to make the image work better. I learned almost all of the basics just reading their code and piece by piece (slowly) figuring out how to do things. Still so new and baffled everywhere but I feel some progress. I think the most helpful thing to me personally would be showing an actual game with code to look at next to each other so you can see how the code directly translates in game, etc.
 
  • Like
Reactions: expoexpo

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,376
15,289
I think the most helpful thing to me personally would be showing an actual game with code to look at next to each other so you can see how the code directly translates in game, etc.
I'm not a fan. Theoretically you are right, but practically even with a language, relatively speaking, as simple as Ren'py, there side effects that can give you a false perception of why it works, or hide the important point.

From my point of view, it's better to stuck to stand alone examples. By example, to show the behavior of objects declared in an init block, this would always be better than any complete code :
You don't have permission to view the spoiler content. Log in or register now.

And, by being a stand alone code, it ensure that the reader can make all the changes he want to test his understanding. This without the risk to break something else later in the code.
 

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,537
I'm not a fan. Theoretically you are right, but practically even with a language, relatively speaking, as simple as Ren'py, there side effects that can give you a false perception of why it works, or hide the important point.

From my point of view, it's better to stuck to stand alone examples. By example, to show the behavior of objects declared in an init block, this would always be better than any complete code :
You don't have permission to view the spoiler content. Log in or register now.

And, by being a stand alone code, it ensure that the reader can make all the changes he want to test his understanding. This without the risk to break something else later in the code.
I see your point and that might be true for a lot of people, but I think for me personally I would learn better a different way. Of course, I am not a coder at all, so I could end up completely wrong. For me, when I look at that style, it feels like how a technical person that is already inclined to be a coder naturally might put together something or more precisely someone who likes to piecemeal details one by one to learn like building a puzzle.

My boyfriend is quite a detailed and technical person (IP attorney), and he even learned a foreign language completely differently than me. (probably not the same analogy but an interesting difference in learning style) He read dozens of books and practiced things piece by piece over and over gaining mastery one piece at a time. I never opened a textbook once but listened to audio and practiced speaking while never writing anything down but was much more about integration and the big picture and I needed real world examples for everything I did for context and the big picture. We are both fluent enough to have people impressed by us overseas but came to this fluency in completely different ways.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,376
15,289
I see your point and that might be true for a lot of people, but I think for me personally I would learn better a different way.
This is totally your right, as well as the reason why I explicitly said that it was from my point of view, which is obviously just one among many.


Of course, I am not a coder at all, so I could end up completely wrong.
It's not a question of right/wrong, all depend of what you (or in this particular case, 79flavors ) want to achieve. If what you want is just to know how to do "this", which is totally legit and your right, (should it be said ?), then a global code can do it, yes.
But, according to my experience, which worth only what it worth, if what you want is to understand how to do "this", and therefore be able to do it by yourself if the context is totally different, or to correct some possibles errors, then a short snippet is way better.
This said, there's no good or bad approach, it all depend of you.


[...] (probably not the same analogy but an interesting difference in learning style) [...]
It's a perfectly adapted analogy, because it show that learning isn't something frozen, even on a single person. As you said, you learned a foreign language by practicing (like me with English ; I'm ashamed when I look at some of the first posts I wrote here).
But when it come to codding, it's the opposite, you have a more theoretical approach. Because, despite what it can look like, it's what mean a whole global code ; theoretically it will works like this... if you adapt all the dependence to other part of the code and have your variables named like that.

In the game I am (more slowly than a sloth) working on, I have three kind of menus, and among them there's one that only show icons instead of text lines, and that looks exactly like this (so 100% pure behavior of the menu statement) :
Code:
    menu ( screen="choiceIcon" ):
        "Oh, looks like my totally unrelated elder female roommate is taking a shower."
        "Look":
            "I don't care if other think that it's taboo, I would totally bang her."
            jump IamAPerv
        "Forget":
            "She's my totally unrelated elder female roommate, it would be gross to see her naked !"
            jump whyAreYouPlayingThis
[Note: if you get the reference, you've good taste.]
By chance, you were precisely in search of something like that. Looking at the code, you understand that you have to copy the "choiceIcon" screen. But still it will not works for you because, hidden behind the scene, there's a menu filter, located in another file on another directory, that is referenced neither in the menu, nor in the screen. And the filter itself actually (it can change) depend of a system that handle constant values, and some gui configuration variables.
If, at the opposite, it was a practical example, and so only this menu, it would have everything in the same file, and there would be no use of external code ; starting by the filter, which exist only because there's more than one kind of menu. You could copy/paste the code, and it would works fine without any change needed.


But, once again, I don't try to force you or 79flavors to do "like this", I express a point of view that is just mine, and explain why I have it. After, it's up to you to find it better or not, depending of what you are searching to achieve and how you can achieve it the more easily.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
My simple approach is that if you want someone to explain why planes fly to a 4yr old... ask me. If you want someone to explain why that yellow indicator marked "J72B" on the space shuttle's main console just came on... ask anne O'nymous. We'll both aim to help, neither of us will be right all the time - but we'll both give it a try.

It's good that people can give their own opinion... because... who else's are you going to give?
There is no right or wrong when it comes to learning... there is only what works for you.

Literal hundreds of people have coded RenPy games on this site alone. And at least 25% of those games, I look at the code, throw my hands up in the air and wonder what the hell they were thinking. Then hope to bejeebus that nobody trying to learn how to write their own game ever looks at the same thing I'm looking at.

Greatest thing about the internet: You can find people who agree with you.
Worst thing about the internet: You can find people who agree with you.
It's all perspective. :love:(y)

Anyway, back to watching "I am not okay with this" before procrastinating some more about writing my guide.
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,276
22,425
I've never heard of the _("translate me") stuff as well, and this is actually something I find quite important. If I had known about it, I'd have used it from the start, so maybe it would be a good idea to include it.
Let me be honest, I've seen so many questions that people could have get an answer for by just playing the renpy tutorial game that is included in every renpy package, or questions for which the anser pops up at the first place when you type it in google search... if people can't even bring themself do that little bit of effort, then even the most simple tutorial won't help them.

"She's my totally unrelated elder female roommate, it would be gross to see her naked !"
:WutFace:Ewwww!
 
Last edited:

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,537
This is totally your right, as well as the reason why I explicitly said that it was from my point of view, which is obviously just one among many.




It's not a question of right/wrong, all depend of what you (or in this particular case, 79flavors ) want to achieve. If what you want is just to know how to do "this", which is totally legit and your right, (should it be said ?), then a global code can do it, yes.
But, according to my experience, which worth only what it worth, if what you want is to understand how to do "this", and therefore be able to do it by yourself if the context is totally different, or to correct some possibles errors, then a short snippet is way better.
This said, there's no good or bad approach, it all depend of you.




It's a perfectly adapted analogy, because it show that learning isn't something frozen, even on a single person. As you said, you learned a foreign language by practicing (like me with English ; I'm ashamed when I look at some of the first posts I wrote here).
But when it come to codding, it's the opposite, you have a more theoretical approach. Because, despite what it can look like, it's what mean a whole global code ; theoretically it will works like this... if you adapt all the dependence to other part of the code and have your variables named like that.

In the game I am (more slowly than a sloth) working on, I have three kind of menus, and among them there's one that only show icons instead of text lines, and that looks exactly like this (so 100% pure behavior of the menu statement) :
Code:
    menu ( screen="choiceIcon" ):
        "Oh, looks like my totally unrelated elder female roommate is taking a shower."
        "Look":
            "I don't care if other think that it's taboo, I would totally bang her."
            jump IamAPerv
        "Forget":
            "She's my totally unrelated elder female roommate, it would be gross to see her naked !"
            jump whyAreYouPlayingThis
[Note: if you get the reference, you've good taste.]
By chance, you were precisely in search of something like that. Looking at the code, you understand that you have to copy the "choiceIcon" screen. But still it will not works for you because, hidden behind the scene, there's a menu filter, located in another file on another directory, that is referenced neither in the menu, nor in the screen. And the filter itself actually (it can change) depend of a system that handle constant values, and some gui configuration variables.
If, at the opposite, it was a practical example, and so only this menu, it would have everything in the same file, and there would be no use of external code ; starting by the filter, which exist only because there's more than one kind of menu. You could copy/paste the code, and it would works fine without any change needed.


But, once again, I don't try to force you or 79flavors to do "like this", I express a point of view that is just mine, and explain why I have it. After, it's up to you to find it better or not, depending of what you are searching to achieve and how you can achieve it the more easily.
Thanks for everything here, it's good information to ponder, and I am quite adaptable if need be so it's helpful. Future experience may prove the need for me to change it up although I will probably keep it quite simple at first. I'm probably never going to get super interested in the complexity and depth of the full power of the code unless it directly impacts something I care about, but it's a lot of fun right now looking at everything.

The VN by far I have learned the most from - especially little technical details and how code in one location relates to a completely different dependency somewhere else - is Being a DIK but stylistically Estate Dominate is a little better match for me as a reasonable first attempt at coding a game. However, the latter tends to go a bit long on prose and I suffer this same problem as I write a lot and very fast so I have to cut and cut words as a habit and spend a lot of time editing. Laughingly, I wrote about 3,000 dialogue blocks as a rough draft for a single episode so to speak in only two days but I took longer than that to code and render 15 images which is only one scene. At least it's fun :)
 

TessSadist

Well-Known Member
Donor
Game Developer
Aug 4, 2019
1,298
5,537
My simple approach is that if you want someone to explain why planes fly to a 4yr old... ask me. If you want someone to explain why that yellow indicator marked "J72B" on the space shuttle's main console just came on... ask anne O'nymous. We'll both aim to help, neither of us will be right all the time - but we'll both give it a try.

It's good that people can give their own opinion... because... who else's are you going to give?
There is no right or wrong when it comes to learning... there is only what works for you.

Literal hundreds of people have coded RenPy games on this site alone. And at least 25% of those games, I look at the code, throw my hands up in the air and wonder what the hell they were thinking. Then hope to bejeebus that nobody trying to learn how to write their own game ever looks at the same thing I'm looking at.

Greatest thing about the internet: You can find people who agree with you.
Worst thing about the internet: You can find people who agree with you.
It's all perspective. :love:(y)

Anyway, back to watching "I am not okay with this" before procrastinating some more about writing my guide.
I'm very curious if there are good and bad examples that are very obvious :)
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
I'm very curious if there are good and bad examples that are very obvious :)
On specifics... yes. Off the top of my head...

I'm going to avoid calling out individuals, since these are personal viewpoints. The examples I'm going to give... the games run and run well, the stories (from what I remember) are mostly above average and in all other aspects are well worth a player's time. Except when you look under the the hood...

One game, before setting a Boolean variable to a value - the dev checks the current value to see if it's worth changing (as if it matters). This isn't a single odd case... it's throughout the whole game.

Python:
default my_variable = False

label start:
    menu:
        "Change variable to True?":
            if my_variable == False:
                $ my_variable = True

    return

Another game (and there are more than one example of these...), the dev clearly came across the pass statement somewhere and figured it needed to be used everywhere.

Python:
label start:
    menu:
        "Option A":
            "You picked option A"
            "Well done"
            pass

        "Option B":
            "You picked option B"
            "That might have been a mistake"
            pass

    return

Neither do any harm, realistically. But both make my eyes bleed.

Another game, the dev must have seen call somewhere, but failed to understand that each called label eventually needed a corresponding return statement. They treated it like jump around half the time, with the other half used it correctly. The game actually worked, because when the game did encounter a return statement - it was used correctly. However the internal call stack was so screwed up within a few chapters that by the time the game was completed, the game had to force itself back to the main menu at the end of the game because the return you'd normally expect to work - actually just returned to a seemingly random point within the gameplay.

Hell. I'm far from perfect. I've written code both commercially and in RenPy that I look back on with horror. But the nature of RenPy devs are that they borrow code and ideas from other games, sometimes somewhat blindly. When you copy a good example (or better still UNDERSTAND why it's a good example)... great. When you copy a bad example, without really knowing how it could be done better... that just perpetuates the flaw.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,376
15,289
I'm going to avoid calling out individuals, since these are personal viewpoints.
I don't like doing it either, since behind each "bad" code, there's someone who at least tried. But for once I'll make an exception, the reason for this will be self-explanatory once you'll be done reading : Dreaming of Dana.

Among the other things, when you look at this game, you'll see this :
Code:
default Danavar1 = False
[...]
default Danavar100 = False
default Danastvar1 = 0 # bad marks with dana
[...]
default Danastvar10 = 0
By itself, the presence of 100 flags and 10 variables for a single character, isn't necessarily bad. No, the problem here, is their anonymity.
You'll use one to store the result of a decision made by the player in the update 3. Then, you'll have to refer to this decision in the update 6, so generally three months later. I'm sure that few would remember that the variable used at this time was Danavar14.
Therefore, either you were provident and have some references notes somew... oh ! no, you weren't. If you understood from the start that this anonymity would be a problem, you wouldn't have used it. Well, you now have to browse your code, in search of the part where the decision was made, to find which flag was used to store its result.
And you'll have to do this every single time you need to refer to a previously used flag. Can you imagine the time lost because of this ? Ten minutes past searching a variable name, each time you need it. How many days does it make when the game is finally finished ?

Because the game was finished, it was even a hit at its time. Ptolemy even started other games, he stopped neither his game, nor his career. Simply because having a "bad" code don't prevent the result to be good and interesting, and it don't prevent the author to go to the end of his project, nor to start a new one.
But it still do something ; what was initially a pleasure, slowly transform into a burden. In this particular case, the game slowly shifted from an interactive story, to a pure kinetic novel. And it's not a too wild guess to say that it's surely linked to this "bad" codding.

In this kind of case, there's always a time when you reach a point where you only have two choice. Either you quit making a game, or you quit your initial idea and go to something as simple as possible. Some devs, that I'll not name, have made a specialty to choose a third way, restarting from crash... It can works only if they learned from their errors.
By itself, a bad code isn't necessarily a problem for the game itself. There some in this case, but they stay an invisible minority. No, it's a problem for the author itself, it make his task way harder, and make him lost more time that the time he would have past to learn the basis.


There another example, that I'll not name partly because I don't remember the name. And this one is real bad codding. The author had near to 100 screens, all having two/three lines, all displayed by groups. Each time he had to show a stats screen, he had to show near to 10 screens, and to hide all the others, just in case.
To this, he added an misunderstanding of how scene works, hiding the previous image before showing the next one.
He'd quit long ago, after the second update of his game, and it's understandable. I made the count once, and it was so amazing that I'll probably never totally forgot it... Among the 10000ish lines of his code, only 2000ish was necessary. Can you imagine that ? 80% of the code was useless lines.
80%... This is the price of his bad code, the price that he had to pay. For every needed line, there were four useless ones. And because of the way he worked with the screens, in this particular case it was more like : every now and then, he had to repeat a hundred lines that could have been just one single line.
His code was the bad of the bad. He could have used a called label for the "hide all screens" part, one for the "show all those screens that could have been one". But no, he copy/pasted them, which mean that he first had to find the right combination of lines.

Even if you make your game by passion, how can someone not quit in this conditions ? "Ok, now I need to show this screens combination... Ah, fuck, it mean that I'll have again to write all those lines... Where was the last time I needed this particular screens combination ? Well, I'll search."

It consume your passion at first, then start to consume you...
There's code that make me frown, or make my eyes bleed, but mostly it's my problem. The example you gave, are part of this. It's "bad", but except the check before assignation, it don't really change the life of the author.
And there's the code that make me cry out of empathy. I look at it, and I wonder how the person who write this can not want to hang himself. Not because his code is bad, but because it's such a burden to deal with it, to maintain it.

Writing a game as indie dev should be a pleasure and only a pleasure. There's day where you have to force yourself, but when come the day to release the update, you should thing, "yes ! I made it", not, "at least I made it". And for this, the code you write should be "not this much bad".