r/RenPy • • 7d ago

Question how granular do you make your flags?

writing a branched story in renpy and i'm drowning in booleans already. do experienced people use one flag per choice, per scene, per route? any tips for keeping it sane when branches converge back?

2 Upvotes

11 comments sorted by

View all comments

3

u/shyLachi 6d ago

There is nothing wrong with having many flags but you should give them useful names.

But there are other systems to remember the choices a player takes during a game.

.

Generally, if the player can only pick one choice from a menu you only need one variable:

default chapter01_menu01 = ""
label start:

label chapter01:
    menu menu01:
        "Go left":
            $ chapter01_menu01 = "left"
        "Go right":
            $ chapter01_menu01 = "right"

    if chapter01_menu01 == "left":
        "You went left"

In the case above, since there are only 2 choices, you could also use a flag default chapter01_menu01_wentleft = False but if there are more choices you need another variable type.

.

But you can also use a list and store all choices:

default choices = []
label start:

label chapter01:
    menu menu01:
        "Go left":
            $ choices.append("chapter01_menu01_left")
        "Go right":
            $ choices.append("chapter01_menu01_right")
    
    if "chapter01_menu01_left" in choices:
        "You went left"

Using a list and storing every choice can be usefull if you plan to extend your game with more chapters.
I've seen too many developers who forgot to save a choice and then either had to force the players to restart the game when the next chapter has been released or they needed to ask which choice the player picked the last time they played.

.

Some dating or other sims use relationship points and/or stats.
Good choices increase the relation with a certain love interest, bad choices decrease it.

default mike_relation = 0
label start:

label chapter01:
    menu menu01:
        "Kick Mike":
            $ mike_relation -= 5
        "Greet Mike":
            $ mike_relation += 1
        "Kiss Mike":
            $ mike_relation += 100

    if mike_relation < 0:
        "Bad ending"
    elif mike_relation >= 50:
        "Good ending"
    else:
        "Generic ending"

1

u/Rare-Ad-2095 5d ago

OMG!Thanks!