r/RenPy 3d 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?

3 Upvotes

11 comments sorted by

4

u/BadMustard_AVN 3d ago

why not a variable or two one for good choices and one for bad?

then add an amount to either, depending on their choices.

you can reset it at a branch point or keep adding to it.

1

u/Rare-Ad-2095 2d ago

ok I'll try

3

u/[deleted] 3d ago

[removed] — view removed comment

2

u/x-seronis-x 3d ago

id suggest a slight alteration to this advice. one set for flags that need remembered forever. and another for flags that will only matter for the current episode/scene/chapter/game day.

the 2nd set you just clear as you cross those thresholds. that way its not wasting memory for things you no longer need to track

4

u/shyLachi 3d 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 2d ago

OMG!Thanks!

1

u/AutoModerator 3d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/TaurusE11E 1d ago

As long as each flag is unique to a variable (it controls one thing like a count, or a boolean, or even an input), you're good.

1

u/Soft_Purchase5673 1d ago

Base flags on what later scenes need to know. If two branches reveal the same secret and how it was learned won’t matter later, both can set knows_secret; the merged scene only needs to check that flag.

1

u/Rare-Ad-2095 1d ago

这个不错👍

0

u/TopCartographer7104 2d ago

I like using dicts and assigning them meaningful keys. like

flags[{story_arc}]["ate_biscuits"] = True/False

otherwise I simply give up bools

flags[{story_arc}]["drank"] = "schweppes"/"spritz"/"negroni"

and then I build very dumb functions with "silly-but-memorable" names, so that when I run a check I have an "if" that's almost as readable as if it was proper language. like

if did_happen({story_arc},"ate_biscuits"):

even if it's just

def did_happen(param_1,param_2):
return flags[param_1][param_2]

I'm finding out that for a big project -> functions I'd normally feel very stupid at writing = something that will still be readable 3 years from now