Mori AtelierMori Atelier
renpycodenarrative

Devlog #002: Branching Choices

January 28, 2025
2 min read

One of the core mechanics of any visual novel is player choice. Today I dove deep into Ren'Py's menu system and learned how to create meaningful branching paths.

The Menu System

Ren'Py has a built-in menu statement that's elegant in its simplicity:

menu:
    "What should I do?"

    "Go to the library":
        jump library_scene

    "Stay home":
        jump home_scene

When the player reaches this point, the game pauses and presents the choices as clickable buttons. Each choice leads to a different label — a different branch of the story.

Tracking Choices with Variables

Choices aren't very interesting if they don't have consequences. Ren'Py uses Python variables to track the game state:

default trust_level = 0

label conversation:
    m "Do you believe me?"

    menu:
        "I trust you.":
            $ trust_level += 1
            m "Thank you. That means a lot."

        "I'm not sure...":
            m "I understand. Trust takes time."

    if trust_level >= 3:
        jump good_ending

The $ prefix lets you execute arbitrary Python in the script. This is where Ren'Py's power really shines — you have a full programming language at your disposal when you need it.

Flowcharting Before Coding

Before writing any branching dialogue, I learned the hard way that you need a plan. I started using a simple text-based flowchart:

START
├── Choice A: Trust
│   ├── Scene 2A (trust +1)
│   └── Choice B: Confront
│       ├── Scene 3A (trust -1)
│       └── Scene 3B (trust +1)
└── Choice B: Doubt
    └── Scene 2B
        └── Merge → Scene 4

This keeps the narrative manageable and helps identify where branches can merge back together. Not every choice needs to spawn an entirely new path.

Lessons Learned

  1. Keep branches shallow — deep branching trees grow exponentially
  2. Merge paths when possible — the player gets the feeling of choice without doubling your writing workload
  3. Use variables for flavor — small dialogue changes based on past choices add depth without adding branches

The key insight is that the illusion of choice can be just as powerful as actual divergent paths.

What's Next

  • Implement a proper affinity system
  • Design the choice UI to match the game's aesthetic
  • Write the first chapter's complete dialogue tree
Back to Devlog