Ren'Py [SOLVED] Best scripts for study?

Aug 20, 2018
217
109
Howdy,

can I get some recommendations for a script of a specific game,
if I want to see as a beginner, how a script is roughly written?
(showing images, defining names etc.)

I'm already writing mine (watching tutorials etc.), but I want to see some examples...

Any non-complicated games to check?

Thanks!
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,269
can I get some recommendations for a script of a specific game,
if I want to see as a beginner, how a script is roughly written?
All ? None ?

There isn't games that can be said as "this one is doing it right from start to stop" ; even mine wouldn't. The only possible advice is to look at (at least few) games that do what you want to do, and inspire from those that do it in a way you understand and that don't have bugs.
 
Aug 20, 2018
217
109
decompile that one imo :

https://f95zone.to/threads/light-of-my-life-ch-4-v0-5-2-naughtyroad.29628/

Not the best render ever, just good flow and maitrise.
To be honest Light of my life was the game that led me to make my own game. :giggle: Because I believe Loml is a great example of how an adult VN should look like... Recently I was thinking about to check its script because to me it looks like a stable game.

I'm not really a fan of supernatural and paranormal bullshit, it seems to me that devs ran out of real believable stories? :unsure:

And all these super hot looking milfs... Nah. I know there is a demand for them because most of the players I believe are ''teenagers'', but come on, let's make something ''real''. Hopefully ill be able to produce some nice material.

Anyways, I appreciate your help.

All of you. Thanks a lot!
 
Aug 20, 2018
217
109
P.s.

Yesterday I've checked the script of the RenPy's built-in VN, and I believe it is one of the most useful examples for beginners.
 

Deleted member 1121028

Well-Known Member
Dec 28, 2018
1,716
3,295
To be honest Light of my life was the game that led me to make my own game. :giggle: Because I believe Loml is a great example of how an adult VN should look like... Recently I was thinking about to check its script because to me it looks like a stable game.

I'm not really a fan of supernatural and paranormal bullshit, it seems to me that devs ran out of real believable stories? :unsure:

And all these super hot looking milfs... Nah. I know there is a demand for them because most of the players I believe are ''teenagers'', but come on, let's make something ''real''. Hopefully ill be able to produce some nice material.

Anyways, I appreciate your help.

All of you. Thanks a lot!
P.s.

Yesterday I've checked the script of the RenPy's built-in VN, and I believe it is one of the most useful examples for beginners.
It's also well planned in terms of renders. One of the best use of layers I've seen, I'm not even sure bedroom scenes are not 2 layers with a shadow catcher :unsure:. I'm torn on using composite image with renpy at that point, as rendering another layer/pose/facial expression should be faster than wrote the code for it (but I'm a terrible coder lol). Also I stole a bit of it's relationship code and adapted to mine :whistle:.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,490
7,035
There isn't games that can be said as "this one is doing it right from start to stop" ; even mine wouldn't. The only possible advice is to look at (at least few) games that do what you want to do, and inspire from those that do it in a way you understand and that don't have bugs.
Yes, that!

First off, what is "right" for me may not be "right" for you. Part of programming is about style - coding in a way so that you understand the code and what it's doing. That can lead to very different implementations by different people.

Second, the "style" of code used for a visual novel is completely different from that used by a sandbox game. I'm sort of assuming that you'll be starting with a VN - trying to do a sandbox game first is probably a lesson in how to flatten your head against the keyboard.

As anne O'nymous suggested, for "general style," look at a variety of games, and see which game's code is the most readable to you. As just a very small example, Light of my Life breaks up the dialog portions of the code into relatively small chunks, nested into a hierarchy of subfolders based on when that sequence occurs. Obviously, that made sense to the developer. Some other games use one giant "script.rpy" file. I might suggest that the optimum is maybe somewhere in between, but that's completely up to you.

Different developers have different naming conventions. Adopting a naming convention is a good thing, because it can help you keep track of what's what and where's where.

Some developers put the "default" statement for variables at the top of the file in which the variable is introduced. Others put all their variables in a single "variables.rpy" file. Neither is "right" or "best" - it's what organization makes the most sense for you.

I did a lot of the "decompile every game you play" early on. The "compare and contrast different coding styles" helped me refine my own non-Ren'py programming "style" into the one I sort-of use right now for Ren'py. (And that's still evolving, to be frank.) What I find myself doing now is saying, "hey, that's a really neat effect - how'd he do that" and digging into the code to see what Ren'py wizardry was used. ("Creativity is the art of hiding your sources.") Sometimes there are 2-3 (or 17) different ways of accomplishing something, so it's always interesting to see what people come up with.

There are a variety of "best practices," of course. "default" your variables. Follow the "standard" indentation model. Keep track of choices that the player makes, even if you're not sure you need it - you might later. Put comments in your code to remind you six months from now what you were trying to do today. Stuff like that.

But, at the end of the day, the "best" code is the code you understand, can follow, and can maintain.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,269
Different developers have different naming conventions. Adopting a naming convention is a good thing, because it can help you keep track of what's what and where's where.
I'll go further on that. Adopting a naming convention will also help to prevent bugs.
Lets say that your naming convention is "day_location_characters_scene", when branching to a given label, you'll limit the risk to misspell the name of the label ; if you suddenly write "day_location_scene_characters", it will immediately feel wrong for you.


[...] my own non-Ren'py programming "style" into the one I sort-of use right now for Ren'py. (And that's still evolving, to be frank.)
Like there's nothing as "the right way to do", there's also nothing as "it's the way to do for me".
I past around 35 years of my life coding, and I surely changed my own coding style more than 100 times during those years. Simply because it depend of so many things. There's the obvious, "this language don't works like that one, I need to adapt", but it's in fact the less frequent reason.
The coding style depend of what you're doing. Like you said, Rich, you don't code a sandbox like a VN, and because of this you also don't use the same coding style ; even if the differences are small, they still exist.
And it also depend of your knowledge. The more you know, the more you found other ways to do, ways that sometimes imply a change in the style. If by example you pass from hard coded event handler :
Code:
label whatever:
    if condition == whatever:
        jump there
    elif condition == somethingElse:
        jump thisPlace
    [...]
    else:
        jump rest
to a more dynamic approach :
Code:
define event = [ ( "condition == whatever", "there" ), ( "condition == somethingElse", "thisPlace" ) ]
init python:

    def eventHandler():
        for e in event:
            if eval( e[0] ): return e[1]
        return "rest"

label whatever:
    jump expression eventHandler()
It will obviously have a consequence on your whole coding style. Simply because you past from a rigid linear approach, to one that is way more unstructured.


Sometimes there are 2-3 (or 17) different ways of accomplishing something, so it's always interesting to see what people come up with.
And it can give you some ideas.


But, at the end of the day, the "best" code is the code you understand, can follow, and can maintain.
quoted for emphasis.
 
Aug 20, 2018
217
109
Code:
label whatever:
if condition == whatever:
jump there
elif condition == somethingElse:
jump thisPlace
[...]
else:
jump rest
to a more dynamic approach :
Code:
define event = [ ( "condition == whatever", "there" ), ( "condition == somethingElse", "thisPlace" ) ]
init python:

def eventHandler():
for e in event:
if eval( e[0] ): return e[1]
return "rest"

label whatever:
jump expression eventHandler()



I have no idea what are you trying to say with this. It is still like rocket science to me :HideThePain:

I never did any coding nor writing a story before. Not even "graphic design". :D
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,269
I have no idea what are you trying to say with this.
Don't worry about this, it was just a raw example used to illustrate what I said. You just need to remember that "coding style" isn't something definitive.
It's not because you found a way to do that feel right for you, that you have to definitively stick to it. If you start to do something else, and your coding style suddenly stop to feel right, just adapt.



I never did any coding nor writing a story before. Not even "graphic design". :D
It can seem surprising, but it's the case for at least half of the dev behind the games you can find here. So, don't let this stop you.
 
Aug 20, 2018
217
109
So, don't let this stop you.
Oh, sure it won't! :sneaky:

It is just too much information to process.

However, I am really happy for all your effort guys.

Renders are 95% done, writing goes smoothly, the coding... I always need to check tutorials and how to's...

It's very time consuming, but as my boss (senior IT engineer) said when I asked him if it isn't too late to start coding...

as much time you spend with coding, as good you get.

And he recommended, to not make a complex "game" at the beginning.

Therefore I decided to demonstrate/try-out my skills in a short Prequel for the main game.