Welcome to the "Bytes of Love" Ren'Py programming guide. This document aims to provide you with a clear and structured approach to scripting your visual novel. Follow these guidelines to ensure consistency and readability throughout your project.
- Location for Declarations: All variables should be declared in the
VisualNovel/UFOSC/game/script.rpy
file. - Naming Conventions: Use underscore casing for variable names (e.g.,
rust_normal
instead ofrustNormal
) to maintain consistency.
- Weekly Cycle: Structure your script based on the week day cycle. For example, to edit events on day 1 of week 0, use
w0_d1_[Location]
as a naming convention. - Labels: Use labels to mark the beginning of a scene. Labels work similarly to functions in programming, allowing you to "jump" to different parts of the script. Example:
label start: # Your scene code here
- Scenes: Use the
scene
statement to change backgrounds. Note that this is specifically for changing scene backgrounds, not character images.- Example of changing a scene:
scene classroom_day
- Example of changing a scene:
- Declaring Characters: When declaring a new character, add their definition to
VisualNovel/UFOSC/game/script.rpy
. - Menus for Choices: Use the
menu
statement to present choices to the player. Follow eachmenu
statement with text-only options.- Note: You can precede the choices with a line of dialogue, which will be displayed alongside the options, to add context or emotion to the decision-making process.
- Changing character expressions within choices is allowed. Use the
show
statement with a transition (e.g.,with dissolve
) for visual effects. - Example of presenting choices:
menu w0_d1_Rust: "Before making a choice, the [mc] thinks:" #this is shown under the choices in a text box "Mean response": mc "You suck." show rust_angry with dissolve "Nice response": mc "Nice to meet you." show rust_happy with dissolve
- Error Troubleshooting: If you encounter an
EXPECTED MENU ITEM
error, ensure that commands are placed inside the options, similar to theshow
command in the example.
- Dynamic Text: To make text dynamic based on player choices or actions, declare and use variables accordingly.
- Example of declaring a variable:
$ food_item = "bacon"
- You can then use this variable within your script to dynamically change the text.
- Example of using a variable:
mc "I want to eat [food_item]."
- Example of declaring a variable:
- Purpose: Utilize
if
statements to dynamically alter game content based on variable values. This is especially useful for conditional dialogue options, scene changes, or character interactions. - Syntax and Example:
if python_rep > 10: # Conditional content here
- Application in Choices:
- To conditionally display choices, wrap the choice in an
if
statement within amenu
block. - Example:
menu: "This choice always appears." if python_rep > 10: "This choice only appears if python_rep is greater than 10."
- To conditionally display choices, wrap the choice in an
- Adjusting Choices: Change the text and outcomes of choices dynamically by referencing variables.
- Example: Using
python_rep
to influence dialogue options.menu: if python_rep < 5: "Ask about basic Python concepts.": # Outcome for low python_rep elif python_rep >= 5: "Discuss advanced Python topics.": # Outcome for high python_rep
- Big Choices: For significant choices, create separate files within dedicated folders (e.g.,
w1_d1_choices/
, containingw1_d1_LunchJava
,w1_d1_LunchPython
, etc.). This approach keeps your project organized and manageable. - Small Choices: Minor choices can be integrated directly into the main script file, avoiding unnecessary file fragmentation.
-
Scenes and Character Displays: Use variables like
python_rep
to make decisions about which scenes to display or how characters react.if python_rep > 5: scene special_python_classroom show character_smiling else: scene regular_classroom show character_neutral
-
Conditional Interactions: In sections detailing character interactions, remind scriptwriters to consider the player's relationship status with characters, influenced by variables such as
python_rep
, to adjust dialogue and interactions accordingly.
- Beginner Tips: Start small and gradually add more complexity to your game as you become more comfortable with Ren'Py's scripting language.
- Testing: Regularly test your game to catch and fix errors early in the development process.
- Community Resources: Don't hesitate to seek help from the UFOSC Discord! Specifically the Bytes of Love Channel. For people, refer to our main developers: Lazzy, Anton, Jason, or Mathew!
This guide is designed to help beginners navigate the basics of Ren'Py scripting for the "Bytes of Love" project. By adhering to these principles, you'll create a more organized and enjoyable visual novel. Happy coding!