Get ready to work and download the necessary programs: engine, code editor, graphics programs and others.
All programs are free. We will briefly describe how to work with them in the course.
Ren'Py - visual novel engine;
Notepad++ - code editor;
GIMP - graphics editor;
FastStone Image Viewer - picture viewer with basic editing capabilities;
Audacity - audio editor.
Ren'Py includes an excellent help system, which is also made as a visual novel.
Let's get acquainted with the structure of the game in Ren'Py and the most important files.
Game folder - This is where your novel folders and scripts are located;
Images folder - pictures, character sprites, backgrounds;
Gui folder - interface pictures;
script.rpy - main script file;
options.rpy - game settings;
gui.rpy - file to modify the interface;
screens.rpy - gallery, in-game menus and other interface elements.
Finally, let's start creating a visual novel. First, we'll create a project and give it some basic settings. At the same time, let's learn some basics of the code editor, if you haven't done any programming before.
You will need Notepad++ or another code editor.
A visual novel doesn't do without dialogue. So the first thing to learn is how to make your characters talk.
In this lesson, we'll begin to learn the basics of programming in Ren'Py.
# Everything after the grid sign and until the end of the line is a comment
# Ren'Py completely ignores comments
# Use them for notes and to temporarily disable lines
# Create a character named Billy, his name will be displayed in light blue
define bi = Character('Billy', color="#4ca6ff")
# A new game begins after this label
label start:
# Specify the character variable ("bi") and after space his words in quotation marks.
bi "Billy's words."
# If you don't specify the character, you get the author's words.
"Author's words."
# This command ends the game and goes to the main menu.
return
In fact, the "return" command will not necessarily end the game. It exits the current label and returns to the previous one. But don't think about that just yet. We will come back to this topic in future lessons.
Before that, our heroes were invisible. For a visual novel, this is clearly not a good thing. It's time to learn how to display our heroes on the screen. Along the way, replace the boring black background.
# Clear the entire scene and set a new background.
scene bg name
with fade # Transition through black
# A picture with the name "bg name" will be displayed.
# Display the sprite. The picture "damon smile" will be displayed over the background.
show damon smile
with dissolve # Smooth transition
# Remove a sprite. Any sprite that begins with the word "damon" will be removed.
hide damon
You may find that your background or character sprite isn't the right size. In this lesson, we'll learn how to quickly adjust the size of your pictures.
In addition, we'll figure out what to do when your characters are shown on a white background. For this, we will need the programs Gimp and FastStone Image Viewer.
By default, RenPy places the character in the middle of the screen. If you want to show more than one character at once, you need to move them to different positions.
In this video, we'll learn different ways to position our sprites and how to save position arguments in a special variable.
# Place the picture at the left edge of the screen
show damon smile
at left # or right/top etc.
# Precise position horizontally and vertically
show damon smile:
xalign 0.5
yalign 0.5
# Create your own named position
define mypos = Position(xalign=0.5, yalign=0.5)
# Use your position as usual
show damon smile at mypos
The usual way of displaying pictures can be simplified in most cases. We will learn how to quickly change the character sprite right in the dialogue.
This saves a lot of time when creating a visual novel, and the resulting code is much easier to read.
# Link an image to a character
define d = Character("Damon", image="damon")
# Change the character's sprite right in the line of dialogue.
d smile "Hi, I'm Damon."
d angry "I'm very angry!"
# Change the sprite for one line, then return the previous sprite after that.
d @ smile "Hi, I'm Damon."
d @ angry "I'm very angry!"
The easiest way to liven up a visual novel is to add transitions when you change the background or sprite. RenPy has quite a few built-in transitions that are very easy to use.
# Show a character sprite with a dissolve transition.
show dimon smile
with dissolve
# Hide a character sprite with a dissolve transition.
hide dimon
with dissolve
# One transition can be specified after several pictures.
# These pictures will appear with the transition at the same time.
show dimon smile
show alice angry at right
with dissolve
# Similarly, transitions can be used when changing scenes.
scene bg class
with fade
# You can specify a scene and characters with a single transition.
scene bg class
show dimon smile
show alice angry at right
with fade
Link to information about the transitions on RenPy's official website.
Experiment with different transitions on your own.
There are few visual novels without actions or dialogue choices.
Dialogue choices are the foundation on which many VNs are built. Once you've mastered them, you'll be able to create a full-blown visual novel with different endings.
Along the way, let's see how RenPy code is divided into parts using labels.
# The label command creates a label with any name in the code. In essence, a label can be thought of as a block of code.
label my_label:
# All code indented by 4 spaces below the label will be considered part of the my_labelblock.
"You see a cow flying at you. What are you going to do?"
# The menu command creates buttons with answer choices.
menu:
# The first text in quotes is the text that will be displayed at the bottom of the screen.
"What are you going to do?"
# The following text with a colon at the end creates a choice button
"Move left":
# And the code that is indented by 4 spaces below the choice will execute when the player clicks on that button
# The jump command moves the game execution to the specified label
jump move_left
# Create a second choice button
"Catch a cow with your head":
# If the player selects this option, the code in the cow_pow tag will start executing
jump cow_pow
# In this case, the return command is not needed, as the game will move to the move_left or cow_pow label.
# But it is better to put return at the end of each label to avoid accidental errors.
return
# This label will execute if the player clicks "Move left"
label move_left:
"You dodged a falling cow."
# return will bring us back to the main menu.
return
# This tag will execute if the player clicks "Catch a cow with your head"
label cow_pow :
"The cow crushed you to death."
# return will bring us back to the main menu.
return