File Structure

Once you've created your Ren'Py project in the game folder you will see four files:

gui.rpy
A set of definitions that control the overall layout of the game screens. Also includes a set of definitions for running on mobile devices.
options.rpy
A collection of options that broadly control how the game is built and run. It also includes the name of the game, version number, and "about" text.
screens.rpy
Definitions of the screens used in your game. This includes how the menus and "say" screens are presented, the start and in-game menus, the quick menu, about, and help screens.
Note: because the start menu is in this file, edits can potentially make starting your game impossible. Avoid editing this until you've a good understanding of how screens work, and a backup!
script.rpy
The very short example game script.

The temptation is likely to start editing script.rpy to code your game. However, there's nothing special about this file other than it contains the special label start - the one that's called when the player clicks "Start". In fact the start label doesn't even have to be in this file.

If you ever need to re-build your game from the Ren'Py launcher to change the default colours or screen size, these files will be overwritten. So it is best to keep the bulk of your code elsewhere.

Ren'Py will find and compile any .rpy file in or under the game folder, and to a first approximation they are all lumped together. You may want to begin by creating sub-folders according to the story structure you plan to use.

For example if you are using the Three Act Play structure you could make sub folders act1, act2, and act3. In the act1 folder create act1scene1.rpy:


label act1scene1:
    "It was a dark and stormy night..."
    return

Then edit script.rpy to just contain:

label start:
    call act1scene1
    return

That's it. That's a valid, if very short, "game".

Your sub-folders could be chapters, locations, events, or whatever makes it easy to remember where something is. The important thing it to keep individual files relatively short and self-contained. Editing, and specifically scrolling up and down, files that are many thousands of lines long is painful (literally).