Any Open Renpy Games I can learn from?

Fuku95

Newbie
Jul 27, 2023
55
23
I've played Ren'py games here and there. Since I'm interested in game development, does anyone know of any Renpy games that have their files open so I can learn from them? Having numerous ones with different play styles will help me out. Almost all the games I come across frome Renpy are encrypted.

So far I only came across one that wasn't. Summer with Brina. However I need more to learn from.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,376
15,289
Just a warning, learning from other games also imply that you'll possibly learn stupid things. There's (alas) still a lot of developer who have no idea about what they are doing, and write ugly broken code.

This mean that you should focus on learning the logic behind the mechanism you want to use, more than on learning the code to implement that logic.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,223
General rule of thumb:

Avoid learning from any game that starts with something that looks like:

Python:
init:
    $ myvariable1 = 0
    $ myvariable2 = 0
    $ myvariable3 = 0
    $ myvariable4 = 0
    $ li1_love = 0
    $ li1_hate = 0
    $ li1_corruption = 0
    $ li2_love = 0
    $ li2_hate = 0
    $ li2_corruption = 0
    $ li3_love = 0
    $ li3_hate = 0
    $ li3_corruption = 0

-or-

Python:
init python:
    myvariable1 = 0
    myvariable2 = 0
    myvariable3 = 0
    myvariable4 = 0
    li1_love = 0
    li1_hate = 0
    li1_corruption = 0
    li2_love = 0
    li2_hate = 0
    li2_corruption = 0
    li3_love = 0
    li3_hate = 0
    li3_corruption = 0

Look for games that would code it like:

Python:
default myvariable1 = 0
default myvariable2 = 0
default myvariable3 = 0
default myvariable4 = 0
default li1_love = 0
default li1_hate = 0
default li1_corruption = 0
default li2_love = 0
default li2_hate = 0
default li2_corruption = 0
default li3_love = 0
default li3_hate = 0
default li3_corruption = 0

It's a tiny thing, but to my mind it is a good way of spotting games written by those developers who just copy/paste code from some other game without really understanding WHY things are coded like they are.

As I understand it, default was added as a solution to developers who didn't really understand when variables would and wouldn't be included in the save files. Developers would "fix" something in an earlier release and break their entire game. It's one of the reasons why you'd see "This version is not compatible with saves from version x.y and older".

This thing is, by that point - there were a lot of big title games already out there, using the "old" style of coding variables. And because those games were successful (although not very well written in some cases), people would "borrow" code from them or at least try to use them to understand what they should be doing. It was the blind leading the blind.

Anyway, whilst default doesn't guarantee a well written or structured game, it does at least show someone understood one of the basics of writing RenPy code.
 
  • Like
Reactions: anne O'nymous

aereton

Digital Hedonist Games
Game Developer
Mar 9, 2018
434
855
The previous tips are very good, however maybe someone who already decompiled some RenPy projects would post some examples of passably well written games, as I doubt someone who wants to learn from established projects can differentiate between clean and messy code examples.

I'd do it but I haven't touched any strangers yet.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,376
15,289
Because it's a good idea

Avoid learning from any game that starts with something that looks like:

Python:
init:
    $ myvariable1 = 0
    $ myvariable2 = 0
    $ myvariable3 = 0
-or-

Python:
init python:
    myvariable1 = 0
    myvariable2 = 0
    myvariable3 = 0
Regarding variable declaration, this too is bad practice:

Python:
label whatever:
    $ myvariable1 = 0
    $ myvariable2 = 0
    $ myvariable3 = 0

And of course, there's this that is a really bad omen:
Python:
default MC = Character( "mc" )
Variables that are constants shouldn't be savable.


On the same topic there's still some who are doing that kind of error:
Python:
define mc = Character( "[mc]" )

label start:

    "What's name do you want to use"
    $ mc = input( "Your name" )

Should also be added the (still too frequent):
Python:
label whatever:
    show screen whatever
    pause
    jump whatever
And its variations (there's too many to present them all).
The dev want a blocking screen that will wait for the player input, but neither use the , nor the syntax, that are made for this.


The use of show imageName when all the CGs are full screen.
Not understanding the difference between and , while they are the basis of any Ren'Py game is a really bad omen.


Talking about bad omen, the use of without related is also a strong one.
It's perfectly possible, and totally legit, to have the return in another label:
Python:
label whatever:
    [...]
    call calledLabel

label calledLabel:
    [...]
    if someCondition:
        jump subCalled1
    else:
        jump subCalled2

label subCalled1:
    [...]
    return

label subCalled2:
    [...]
    return
But it must always be ended by a return.

Doing so show a strong misunderstanding of how the game flow works.


Also a bad omen are games that copy/paste a big part of their code because of a small variation, especially when it regard the CGs:
Python:
label whatever:
    menu:
        "what swimsuit should she wear ?"
        "The red one":
            jump beachRed
        "The green one":
            jump beachGreen

label beachRed:
    scene beach001red
    girl "Wow, it's beautiful here."
    [...]

label beachGreen:
    scene beach001green
    girl "Wow, it's beautiful here."
    [...]
Here it's more excusable, but it's also not really difficult to find information on how to avoid this. It's been years that people promote the right way, and there's many games displaying it, some being already more than 5 years old.


More subtle, and so alas harder to catch, screens that handle all the action and update themselves for a long period are also to avoid.
 
  • Red Heart
Reactions: 79flavors
Sep 16, 2019
491
1,935
I'm not a developer but if I may make a recommendation, check out Game Developer Training channel on YouTube, he has a Renpy Master Class series that should be helpful.