CREATING A VISUAL NOVEL WITH RENPY PART 1

Courtesy of Generic User

Part 2: http://rpgmaker.net/tutorials/515/
*************************************************************************
NOTE:
First of all, this tutorial is from a person named Generic User. It's been a year(?) since he posted and I thought his excellent tutorial could get more exposure. You can find the original over here. So onwards!
*************************************************************************

Creating A Visual Novel With Ren'Py

Part 1: The Basics

Level: Absolute beginner; no experience needed at all.

Summary: We're going to create a visual novel using Ren'Py, an engine for creating visual novels, complete with dialogue, choices, graphics, and sounds.

At the end of this tutorial, you'll have learned how to create a visual novel with Ren'Py, and you'll have a finished game that can be sent to other people.

In this part, you’ll set up the software needed, and you’ll learn to make a very basic visual novel.


Skills that are absolutely needed:

- None

Skills that will almost certainly come in handy:


- Being able to draw people and scenery

- Being able to tell a story


Well, then; let's begin...

Step 0: A short introduction to visual novels

Visual novels are, in short, kind of a mix between novels and video games. If you’ve ever tried a “Choose Your Own Adventure”-book, you’ll understand the concept pretty quickly.

They’re not video games in the traditional sense, in that you can’t control most of the things that happen. Instead, you follow the story as it goes along. However, you’ll get several chances to interact, like in this picture:


From my game, 31BR: Do you want to argue further with the curator?

Depending on your actions, the story is affected in different ways; the game might even end differently.

If you're still unsure about what a visual novel is, just follow the tutorial. You’ll get to try out a short visual novel for yourself.

To make our visual novel, we’re going to use the engine Ren’Py, which allows us to create a visual novel without having to code everything.

Step 1: Getting everything we need

The only thing you really need for now is Ren’Py itself. You can find it at www.renpy.org . The latest version right now is 6.9.0, or “The Long and Winding Road”. Download the version that’s appropriate for your computer. This will most likely be the first link, "renpy-6.9.0-sdk.7z.exe".

When you’ve downloaded the program, start it. It will ask you for a directory. You can ignore this, however; if you click "OK" straight away, Ren’Py will appear in the same directory that you downloaded the .exe to.

If you downloaded the .zip instead, just extract it with your favorite unarchiver.

If you use Linux; download "renpy-6.9.0-sdk.tar.bz2" instead. Extract it by using this command in the terminal:


tar -jxvf renpy-6.9.0-sdk.tar.bz2


You might also want to check if you have an updated version of Java. The games can be run without it, but the included editor(jEdit) won't run without Java.


Step 2: Playing your first visual novel

Open up the folder “renpy-6.9.0”, and run the Ren’Py launcher. On Windows, this will be renpy.exe. If you're running Linux, it'll be renpy.sh.

You'll see something like this:


The Ren'Py launcher

Choose “Select Project”, pick “the_question”, and finally “Launch”.

You'll see the game “The Question”, a small visual novel designed for people new to them. I recommend playing it to get a feel for what visual novels are, and how they'll play.

(Don’t worry, you don’t have to make romance games.)

When you're finished playing it, and ready to create stuff, exit the game. You'll be back at the Ren'Py launcher. This time, pick “New Project”, and then “Template”. Give the project a name; I'll call it "The Coin". Finally, pick a theme for the project. It doesn’t matter which.

After a few moments you should be returned to the launcher again, with the new project selected. Click “Edit Script” to get started.

The editor, jEdit, will now start, with the file “script.rpy” open. Delete everything in it, and put this in it instead:


label start:
"Me" "I wish I had just one more quarter..."
"Me" "I’d rather take the bus instead of walking there."
"Me" "What’s that?"
"I saw something shiny on the street."
"I picked it up."
"It was a quarter!"
"That cheered me up... "
"Girl" "Excuse me, but have you seen any coins around here?"
"Girl" "*sigh* I can’t find that one quarter..."
return


Save it, go back to the launcher, and press “Launch”.

Congratulations, you now have your first visual novel! Granted, it lacks certain things, like graphics, sound and an actual plot, but it’s a start, isn’t it?

Step 3: Understanding the code

You’ve created your first visual novel; now it’s time to see how it works.

First, we have the line:

label start:


This is required for every game programmed in Ren’Py; it’s where the game starts.

A bit on indentation: You might have noticed that all the lines, except for this one, have 4 spaces in front. If you’ve used Python, you’ll know this as indentation. This is how Python, and therefore Ren’Py, groups statements in the code. Don’t worry: jEdit handles this, so you don’t need to worry for now.


Now, on to the second line:


"Me" "I wish I had just one more quarter..."


This is what’s going to make up a good part of the novel; dialogue. This line will show up as this in the game:


A standard line of dialogue.


As you can see, the first quote defines the name of the person speaking, and the second quote is what’s going to be said.

Since the next lines are pretty similar, let’s just skip ahead to the fifth line:


"I saw something shiny on the street."


This is narration: dialogue without anyone speaking. There are some situations where narration is best to use, such as describing thoughts, emotions or actions.

Now that we know what those lines do, there’s only line that hasn’t been covered yet;


return


A return statement ends the game. While the game works fine without one, it’s a good habit to have one at the end of the game.

Now that we know what each line does, it's time to move on to...

Step 4: Adding characters


"Girl" "Blah blah"


This is an example of what we've been using to create the dialogue. This method works pretty well. However, there's a problem with it:

What would happen if we, for some inexplicable reason, decided to name the girl Sintie Senatarsu Santasuseh-Sensinda?

Two things would happen.

The code would look something like this:


"Sintie Senatarsu Santasuseh-Sensinda" "Excuse me, but have you seen any coins around here?"
"Sintie Senatarsu Santasuseh-Sensinda" "*sigh* I can’t find that one quarter..."
"Sintie Senatarsu Santasuseh-Sensinda" "Can you help me find it?"
"Sintie Senatarsu Santasuseh-Sensinda" "I hate walking all the way... "


and the coder would probably look something like this after a while:


Long character names considered harmful.

Obviously, this is a problem.

The best way to solve this is to use characters: by predefining the names of the characters in the story, we can cut down the size of the code considerably.

To define characters, we put something like this in the beginning of the code:


init:
$ sue = Character("Sintie Senatarsu Santasuseh-Sensinda")


A small note about init:The init statement allows you to do certain things before the game starts. Characters have to be defined in the init block. Images also have to be imported in this block.


This allows us to do this(instead of what I showed you above):


sue "Excuse me, but have you seen any coins around here?"
sue "*sigh* I can’t find that one quarter..."
sue "Can you help me find it?"
sue "I hate walking all the way... "


As you can see, using characters simplifies coding a lot. You can also give them individual colors:


init:
$ sue = Character("Sintie Senatarsu Santasuseh-Sensinda", color="#aaffaa")


Whenever she talks now, it'll show up like this:


It might not be much of a difference, but it'll help in the long run.


This makes it easier to see who’s talking at the moment.

Now we're going to apply this to our game(except for the overly-long name part).


label start:
"Me" "I wish I had just one more quarter..."
"Me" "I’d rather take the bus instead of walking there."
"Me" "What’s that?"
"I saw something shiny on the street."
"I picked it up."
"It was a quarter!"
"That cheered me up... "
"Girl" "Excuse me, but have you seen any coins around here?"
"Girl" "*sigh* I can’t find that one quarter..."
return


After adding characters, we get this:


init:
$ me = Character("Me", color="#aaaaff")
$ girl = Character("Girl", color="#aaffaa")

label start:
me "I wish I had just one more quarter..."
me "I’d rather take the bus instead of walking there."
me "What’s that?"
"I saw something shiny on the street."
"I picked it up."
"It was a quarter!"
"That cheered me up... "
girl "Excuse me, but have you seen any coins around here?"
girl "*sigh* I can’t find that one quarter..."
return



If you save this, and play through it, not much will have changed. However, the code is now tidier, and it's easier to write more lines now.


Congrats, you've learned to create a simple visual novel!

Next part: You'll learn to create different paths that the player can take. You'll also learn how to get graphics in your game.

Stuff you can do in the meantime:

- Create more characters, with differently colored names

- Write new lines for the characters. Or create a new plot entirely.

- Rant about how bad I am at writing tutorials :D

Posts

Pages: 1
do colors have their own codes, or do we put in ?
Pages: 1