Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Maulden

macrumors newbie
Original poster
Jan 8, 2012
9
0
California
EKVN is a project I've been working on for a while now; the original goal was to make a framework that made it easy to produce "visual novel"-type games (such as Fate/Stay night, Katawa Shoujo, etc.) on iOS. That said, over the past few months, I've redone the code so that it can also be used for more "quick" dialogue scenes for other types of games, especially since I'm planning to use it for lots of little NPC interaction scenes in an action-adventure game I'm developing.

EKVN is built on top of cocos2d-iphone and I've put together a pseudo-"scripting language" (and by "scripting language," I really mean lots and lots of strings stored inside a .plist file) to make it easier to create scenes/dialogue/etc. Together with the scripting language, EKVN supports audio, branching story paths (for those times when you want multiple endings), simple graphical effects (fade-in/fade-out scenes, moving character sprites around, panning the background), and a simple (and rather basic) auto-save system.

I'm planning to start work on a game (the action/adventure mentioned a few paragraphs ago), and due to time constraints, I'm not planning to do any more major work on EKVN until cocos2d-v3 comes out (or I finish my game and copy some of the relevant features back into EKVN, whichever comes first!), but in the meantime, I added the most recent stable version to my GitHub account, so anyone interested in visual novels (or at least adding dialogue/conversation scenes to their games) may want to check it out:

https://github.com/elfketchup/EKVN

The readme also includes a tutorial on how to get things up and running. It's written mostly for people who aren't too experienced with Cocos2D, but who want to try making visual novels on iOS, so it might seem pretty basic to the more experienced game developers here. :p

Anywho, time for screenshots!

A quick test of how it looks when "playing":

ScreenShot2013-09-19at110342PM_zpsff02cb85.png


Time for player choices, the first step towards branching story paths and multiple endings:

ScreenShot2013-09-19at110238PM_zps703216e8.png


The pseudo-scripting language I put together, in action. For the record, I actually do the editing in a text-file (or a Pages document, if I'm feeling fancy :D), and then copy+paste into a .plist file. This is because writing/editing the script IN the .plist file can get a little headache-inducing after a while. :p

ScreenShot2013-09-20at74411AM_zpsfa555ab2.png


...and I can't really think of anything else to add. Wait no, I forgot something: it’s supposed to be easy to add EKVN into your own, existing projects (assuming you're using cocos2d, at least). The simplest way is to just copy the folders “EKVN Classes” and “UI Files” into your project, create a .plist file with a “script” in it (the readme includes a short tutorial on how the scripting language works), and then

#import "VNLayer.h"

in a relevant part of your code. Then copy+paste something like the following the following:

NSString* nameOfScriptFile = @"my script"; // ...or whatever you want to name it. Leave out the .plist extension!
NSDictionary* settingsForScene = @{ VNLayerToPlayKey: nameOfScriptFile };
[[CCDirector sharedDirector] pushScene:[VNLayer sceneWithSettings:settingsForScene]];
And that should be enough to get your own dialogue scene going. If you’re making something like a JRPG, this should make things like conversations with NPCs a lot easier to set up. :)

If you want to add it on top of an existing CCScene / CCLayer (continuing the JRPG example, if you want to have the conversation taking place while the world map is visible), you can do something like this:

NSString* nameOfScriptFile = @"my script"; // Leave out the .plist extension!
NSDictionary* settingsForScene = @{ VNLayerToPlayKey: nameOfScriptFile };
VNLayer* theVNLayer = [[VNLayer alloc] initWithSettings:settingsForScene];
[self addChild:theVNLayer];
self.touchesEnabled = NO; // This layer won't handle touches
theVNLayer.touchesEnabled = YES; // Have VNLayer handle touches

and once the script for the scene/conversation has finished, you can call this (probably in an “update” function somewhere) :

if( theVNLayer.isFinished == YES ) {

[self removeChild:theVNLayer];
self.touchEnabled = YES;
}
and that should do it. Seamless conversation scenes everywhere! Unless bugs appear (I hope not).

ScreenShot2013-09-19at110334PM_zps1d74d47a.png
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.