Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1038171 Posts in 41953 Topics- by 33573 Members - Latest Member: kirbasin

September 02, 2014, 01:12:04 AM
TIGSource ForumsDeveloperTutorialsCreating a Visual Novel with Ren'Py: Part 1
Pages: [1]
Print
Author Topic: Creating a Visual Novel with Ren'Py: Part 1  (Read 31474 times)
genericuser
Guest
« on: November 29, 2008, 03:02:40 PM »

(First tutorial for me; Please tell me if there's anything I missed/got wrong/could've improved.)

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:

Code:
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:

Code:
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:

Code:
label start:

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

Quote
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:

Code:
    "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:

Code:
    "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;

Code:
    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

Code:
    "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:

Code:
    "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:

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

Quote
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):

Code:
    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:

Code:
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).

Code: (The game we currently have)
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:

Code: (The game, after adding characters:)
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



EDIT: Fixed an error with italics and the code tag

EDIT2: New version of Ren'Py. No big changes, but I've updated it anyway.

EDIT3:

Part 2 is now up.
« Last Edit: August 30, 2009, 09:54:55 PM by genericuser » Logged
george
Level 7
**



View Profile Email
« Reply #1 on: November 29, 2008, 03:58:31 PM »

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

Hardly, as despite being aware of visual novels and Ren'Py for a while I've only played a couple, nevertheless I still read your tutorial straight through, it's nicely done! Please continue.
Logged
KennEH!
Level 10
*****


"What, me worry!?!"


View Profile Email
« Reply #2 on: November 29, 2008, 06:17:34 PM »

Pretty cool! I always liked me a good visual novel. Though good ones are hardly ever found.
Logged

Madness takes its toll please have exact change.
Cray
Level 0
***

can't upload an avatar :(


View Profile WWW
« Reply #3 on: January 07, 2009, 09:47:25 PM »

That's a great little tutorial genericuser, thanks! Smiley

Is a part 2 still in the works?
Logged

▓█▓ rpg maker vx
▓█▓ cemetery manager
genericuser
Guest
« Reply #4 on: January 07, 2009, 10:43:21 PM »

That's a great little tutorial genericuser, thanks! Smiley

Is a part 2 still in the works?

Yep. Was on vacation for a while, though, so I've stalled a bit. Rest assured that I'm working on it, though   Wink
Logged
Levin
Level 1
*


vincenzolettera
View Profile
« Reply #5 on: January 08, 2009, 12:37:35 AM »

Yep. Was on vacation for a while, though, so I've stalled a bit. Rest assured that I'm working on it, though   Wink

great!!!  Grin
Logged
Javilop
Level 2
**



View Profile
« Reply #6 on: January 08, 2009, 02:14:32 AM »

I just wanted to say thanks!
Logged
genericuser
Guest
« Reply #7 on: January 09, 2009, 10:10:53 AM »

I've put up Part 2 of the tutorial.

Probably needs some proofreading and other improvements, but it should be OK for the time being.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic