Visual Novel Engine

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Message
Author
KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

Visual Novel Engine

#1 Post by KOE » Thu Aug 21, 2003 10:54 am

Hello! I want to develop a Visual Novel engine, but currently I am unsure of the general implementation (technical-wise) of VNs. I am assuming most of the engine consists of parsing or interpreting scripts which control the flow of the game? I'd be interested in knowing what kinda of features are supported in these scripts and what format are these scripts written in. Or if there are other implementations, I'd like to know that as well. Thanks for any advice.

User avatar
chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

#2 Post by chronoluminaire » Thu Aug 21, 2003 1:12 pm

If you're writing the engine, then you can get to be the one who determines the format, can't you? :) In practice, everyone's scripts will be a slightly different format, and so they'll have to convert it to whatever format you use. But that's not really a problem.

The features required will be different for different games / visual novels. You can deduce what features are required by seeing what the games do! The more features you provide, the happier your users will be ;) Some things I'd think would be necessary for almost anything, though:

* Line of dialogue. Needs a simple way to indicate which character is saying it. For example:
RANMA: Come here and say that again, Akane!
RANMA: Or I'll tell everyone *your* secret!
AKANE: You wouldn't dare!
(or)

SPOKEN RANMA
Come here and say that again, Akane!
Or I'll tell everyone *your* secret!
SPOKEN AKANE
You wouldn't dare!

* Hide/show character. Specify costume and expression for character. Obviously these will need defining in a separate file somewhere. Eg:

SHOW RANMA UNIFORM SURPRISED
RANMA: Who's there? Oh...
SHOW RANMA UNIFORM HAPPY
RANMA: It's you, Akane!
SHOW AKANE UNIFORM HAPPY

* Hide/show background, or specify different location.

* Thoughts / narration: basically dialogue with no speaker. While it is possible to manage without this (see Casual Romance Club), pretty much every game uses it somewhere or other.

* Chaining on to another script, or another part of the same script. Labels and Gotos would seem a reasonable way to do this; other ways would be fine also.

GOTO FIRST-EVENING

LABEL FIRST-EVENING
BACKGROUND DINING-ROOM
SHOW NABUKI CASUAL SMILING
NABIKI: Dinner's ready, Ranma...

(or)

LOAD FIRSTEVENING.TXT
(where FIRSTEVENING.TXT contains the next chunk of script)

* Some way of allowing choices for the player, and varying things based on the results. Lots of possibilities here. One simple way would allow work like this:

AKANE: What do you think of me, Ranma?
CHOICES
I wish you'd leave me alone@AKANE-SLAPS-YOU
You're OK, I guess@AKANE-SLAPS-YOU
I love you, Akane!@AKANE-BLUSHES-AND-SLAPS-YOU
ENDCHOICES

LABEL AKANE-SLAPS-YOU
SHOW AKANE JUDOCOSTUME ANGRY
AKANE: How dare you! *slap*
RANMA: Owww...


* Set values of variables, and test them. Not strictly necessary - you could do everything based on jumping to different pathways based on choices. But it makes the possibilities much nicer for the end user. The kind of syntax I'd think should be understood is something like this:

ADD AKANE-JEALOUS-OF-SHAMPOO +2
SET GOING-OUT-TONIGHT 1

IF AKANE-JEALOUS-OF-SHAMPOO > 4
SHOW AKANE JUDOCOSTUME ANGRY
AKANE: Don't you dare touch him!
ADD SHAMPOO-TEMPER -5
ENDIF

Ideally there'd be a way of only showing some of a set of player choices based on the values of certain variables. Something like <choice>#<condition>@<label>:
CHOICES
I wish you'd leave me alone@AKANE-SLAPS-YOU
You're OK, I guess@AKANE-SLAPS-YOU
Just leave me alone#DEPRESSION > 4@AKANE-COMFORTS-YOU
I prefer Shampoo#LOVE-FOR-SHAMPOO > 6@AKANE-SLAPS-YOU
ENDCHOICES



This is just some ideas off the top of my head. With a language like that (plus a couple of extensions for music/sounds), you could pretty much write Three Sisters' Story, Tokimeki Check-In, Season of the Sakura, Mizuiro, and a few other popular bishoujo games. Which would certainly do for starters!

(Note: that was a scripting language I made up as I went along, and not the one my game uses :). My game's choices are coded in Java using some objects I created for the purpose. My scripts look something like this:

Keiko.show('happysmile');
Keiko.say('Oh, it's great to see you, Takuya!');
Keiko.friendship += 2;

But there's no reason to use Java-like syntax if you're writing a general engine! )

Eiji
Regular
Posts: 81
Joined: Mon Jul 21, 2003 3:32 pm
Location: Ohio, USA, Sector 001 Earth
Contact:

hmm...

#3 Post by Eiji » Thu Aug 21, 2003 1:51 pm

hey.. dont forget to make an SDK for this engine.. I'd love to be your first tester.. just drop me a PM when you got something...

KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

#4 Post by KOE » Fri Aug 22, 2003 6:11 am

Yes, my problem lies in the design of the engine since this would be my first time making a VN. Good tips though.

My plans for the engine will be open source, with Linux as the primary target. So SDK will be available! However, it will also be written with portable code so that a win32 port can be built without any problems. I plan on using SDL as the graphics backend.

As for the game itself, well, I guess I'll need a team for that wouldn't I? That'll be something I can think about later.

User avatar
chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

#5 Post by chronoluminaire » Fri Aug 22, 2003 8:04 am

Hmm, it looks like PMs are disabled on this board, so Eiji, you might not have much luck there :)

I just thought I should actually offer to help, KOE. I'm got quite a bit of programming experience in assorted random languages, so I might be able to contribute. I'm certainly happy to discuss ideas further, and willing to actually join in coding the engine (and/or whatever game you start work on!) if you want.
Since PMs seem to be disabled, my email address is: chronoluminaire (at) messages [dot] to

KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

#6 Post by KOE » Fri Aug 22, 2003 11:09 am

So much for Lemma's rule #5....
Right now, I need to plan the entire design of the engine and to build a list of capabilities. Once I have the whole design thought out, I will proceed on to coding.

Zero
Newbie
Posts: 10
Joined: Wed Jul 09, 2003 7:43 am
Contact:

#7 Post by Zero » Fri Aug 22, 2003 3:10 pm

I'm not that proficient at coding, however I can offer assistance in testing and documentation.

User avatar
chronoluminaire
Eileen-Class Veteran
Posts: 1153
Joined: Mon Jul 07, 2003 4:57 pm
Completed: Elven Relations, Cloud Fairy, When I Rule The World
Tumblr: alextfish
Skype: alextfish
Location: Cambridge, UK
Contact:

#8 Post by chronoluminaire » Fri Aug 22, 2003 7:43 pm

Hahaha. Yes, I see the point about Rule 5. But it's one thing to go asking people to join the project, or actively seeking or hoping for it; quite another if you're trying to get on with things yourself and these people just insist on volunteering... ;)

Seriously: if you want to wait some time while you plan and sort things out then that would make perfect sense. But as and when there's anything I can do, feel free to email me or post here.

KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

#9 Post by KOE » Fri Aug 22, 2003 9:56 pm

What can be done now is start planning out the design. Come up with a features list that will be supported. And post all your ideas on this board so everyone can get involved. I'll get workin.

BlackSpider
Regular
Posts: 133
Joined: Fri Aug 22, 2003 1:08 pm
Location: Wroclaw, Poland
Contact:

#10 Post by BlackSpider » Sat Aug 23, 2003 10:35 am

I might be able to help in the future.
At least after I finally release the demo of 'Town Heat' :?

'Town heat' project site is at : http://www.republika.pl/piotrkn22/th/

KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

#11 Post by KOE » Sun Aug 24, 2003 6:40 am

'Town Heat' development looks great. : )

Right now, I need help coming up with a feature list. Basically a list of what features it should support.

BlackSpider
Regular
Posts: 133
Joined: Fri Aug 22, 2003 1:08 pm
Location: Wroclaw, Poland
Contact:

#12 Post by BlackSpider » Sun Aug 24, 2003 9:13 am

Well, these are the main commands (functions) in my script, which btw is completely in C right now (this will change in the future). I think there are some universal commands that (when changed accordingly) could be part of any ren 'ai engine.

First, I have a huge function called 'int DisplayScene(int game_scene)' with a switch and a few thousand case statments. Then depending on what the player chooses this function returns the new game position to the main program. I know that it should not really work like that, but after all it's my first try and the project is only in early development stage.

As an example :

case 151:
{int your_name_decision = WriteDecision
("Tell her your name", "Invent a funny name", "It's none of your business!", 0);
if (your_name_decision == 1) game_scene = 152;
else if (your_name_decision == 2) game_scene = 170;
else if (your_name_decision == 3) game_scene = 153;
break;}

case 152:
WritePlayer
(ConcatenateText("It's ", player_name, ", but I'm sure Reiko already told you my name."));
game_scene = 500; // end of asking name loop
break;

and it goes on like that for a few thousand lines (but I am afraid it's going to be much more). Also, at some point the user profile, relations and inventory structure might change depending on the path he/she has chosen.

Some of the commands (functions) I 'm currently using.

void WriteComment(char *string);
void WritePlayer (char *string);
void ThinkPlayer (char *string);
void WritePerson (char *person, char *string);
void ThinkPerson (char *person, char *string);
int WriteDecision (char *string1, char *string2, char *string3, char *string4);
void ShowBackground (char *filename);
void HideBackground (void);
void DisableBackground (void);
void ShowMovingBackground (char *filename, int direction, int speed);
void HideMovingBackground (void);
void ShowExAnimation (char *filename, int x0, int y0, int direction, int movspeed, int anispeed, int repeat);
void HideExAnimation (void);
void ShowLeftPerson (char *filename, int frame);
void ShowReversedLeftPerson (char *filename, int frame);
void ShowRightPerson (char *filename, int frame);
void ShowReversedRightPerson (char *filename, int frame);
void ShowMiddlePerson (char *filename, int frame);
void ShowReversedMiddlePerson (char *filename, int frame);
void HideLeftPerson (void);
void HideRightPerson (void);
void HideMiddlePerson (void);
char *ConcatenateText (char *str1, char *str2, char *str3);
void PlaySound (char *filename, int repeat);
void PlayMusic (char *filename);
void StopSound (void);
void StopMusic (void);

There are 3 options for the delayed text.
1) single char appears every 35ms (fast)
2) single char appears every 70ms (slow)
3) all chars appear instantly

And the possibility to disable image/character blending for slow systems.

I hope that gives some ideas of what could be supported.

Eiji
Regular
Posts: 81
Joined: Mon Jul 21, 2003 3:32 pm
Location: Ohio, USA, Sector 001 Earth
Contact:

#13 Post by Eiji » Wed Aug 27, 2003 5:04 pm

And the possibility to disable image/character blending for slow systems.

I hope that gives some ideas of what could be supported.
yeah... the MYST series of games (which play in roughly the same way as Ren'ai games) had a "transitions" feature you could toggle to determine how fast the view changed... which did help if you had a slower system or no hardware acceleration in your vid card..

that would be a good feature...
plus it might not be a bad idea to have a "drag and drop" design interface.. like the GUI maker in Torque does.. (for those of you that dont know that engine.. its the one the now-defunct Dynamix used for the TRIBES games.. and is currently available from GarageGames.com)

KOE
Regular
Posts: 44
Joined: Thu Aug 21, 2003 10:37 am
Location: Canada
Contact:

#14 Post by KOE » Thu Aug 28, 2003 8:33 am

This seems strange to me... as I'm guessing that most of the VN would consist of still image frames. I don't see how blending would slow the system so much. But since every says it does, it seems like a good feature.

BlackSpider
Regular
Posts: 133
Joined: Fri Aug 22, 2003 1:08 pm
Location: Wroclaw, Poland
Contact:

#15 Post by BlackSpider » Thu Aug 28, 2003 3:05 pm

Well, it appears that image blending slows my system so much (from 75fps(VR) to 15fps - but it 's an old Celeron 466Mhz) that I decided to add a command that could switch it off. It 's probably because I 'am still using the old (DirectX5.0/7.0) interface that has no hardware alpha blending support for DirectDraw surfaces during blt operations. I know that DirectX 8.0 and above has support for hardware accelerated blending, but I can't use it right now because this would force me to convert the whole 2D engine from the old DirectX to the new DirectX interface. As a temporary way out I decided to implement a software based 16 steps blending for backgrounds and characters.

Now some more combat mode ideas (that I recently implemented in my ren'ai engine).

void HitPlayer (char *sndfilename);
void HitLeftPerson (char *sndfilename);
void HitRightPerson (char *sndfilename);
void HitMiddlePerson (char *sndfilename);
void EnterComabtMode (char *ally2, char *ally3, char *enemy1, char *enemy2, char *enemy3, int e1hp, int e2hp, int e3hp);
void ExitCombatMode (void);

IMO all those commands should generate some kind special effects.


And there 's also the animation sequence for character winking.
Here goes a typical 8 seconds sequence when the character winks quickly twice, then after a few seconds he/she winks only once:

0 - 1000ms (opened eyes)
1000 - 1100ms (half closed eyes)
1100 - 1200ms (closed eyes)
1200 - 1300ms (hc eyes)
1300 - 1400ms (o eyes)
1400 - 1500ms (hc eyes)
1500 - 1600ms (c eyes)
1600 - 1700ms (hc eyes)
1700 - 5100ms (o eyes)
5100 - 5200ms (hc eyes)
5200 - 5300ms (c eyes)
5300 - 5400ms (hc eyes)
5400 - 8000ms (o eyes)


Anyone has more cool ideas.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]