An engine that can be used to manage and play Visual Novels with limited interactivity. It supports a simple scripting language so you can control the story from within your XML file (which is the actual story).

Post tutorial Report article RSS Feed How the engine works.

In this tutorial I'll try to explain the inner workings of the engine and how it reads and displays the story. The engine itself is exported as a library which you can include in your personal projects. But for easy of use I have provided you with 2 'players', more on those in another tutorial.

Posted by moci on Nov 11th, 2009 Page 1 of 3    
Basic Client Side Coding.


Here is an overview of how the engine actually works.

  • Load a given XML file
  • Parse the contents of that XML file
    • List all the assets needed
    • List all the dialogs and frames that make up the story
  • Load all the assets that are needed
  • Show the 'cover' image of the story
  • Proceed the story frame by frame with dialogs
  • Stop showing frames when the end is reached

Now that's all fine for people that aren't looking to expand or change the code itself. So how does it actually work?

For starters the engine itself has to be driven by something, an outer layer that will tell the engine to start working and fetch whatever information the engine has to give (frame images, dialogs, …).

So basically without the outer layer (which you create yourself or use one I provide) the engine is worthless.

Let's assume we've got an outer layer and it calls the proper functions of the engine.

It all starts with this function:

		public static function processXML(xmlPath:String):void {
			var xmlLoader:URLLoader = new URLLoader();
			xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
			storyPath = getFolder(xmlPath);
			xmlLoader.load(new URLRequest(xmlPath));

This function get's the ball rolling. It's not that special but it's the first step in loading the XML file.
Here's the actual loading of the XML itself.

		private static function xmlLoaded(e:Event):void {
			storyXML = XML(;
			for each (var sound:XML in storyXML.assets.sounds.sound) {
				Sounds.addSound(sound.@id, storyPath + "sounds/" + sound.@src);
			for each (var image:XML in storyXML.assets.images.image) {
				Images.addImage(image.@id, storyPath + "images/" + image.@src);		

Here you can clearly see that it basically runs over every asset listed in the XML file and tells the asset manager to load the specified asset.

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Windows, Mac
Send Message
Creative Commons
Release Date
Released 2009
Engine Watch
Track this engine
Report Abuse
Report article
Related Engines
Visual Novel Engine
Visual Novel Engine Creative Commons Released 2009
Related Groups
IntoGames Developer & Publisher