Visual Novel using Corona

@richard I need a little bit help as well, I am also working on a Visual Novel project and decided to go with Corona as its engine aswell

The story will be divided in arcs (4) and each arc will have chapters. Each arc/chapter will have around 300 pages~ average.

The layering of the scene is like this :

  • -Background Image
  • -Character sprite image (left or right or both if 2 chars)
  • -Dialogue background image (just a placeholder to show convestation beween characters)
  • -Dialouges (actual conversations shown above the Dail.BG)

All these things will always be present per story page, and aside these sometimes 2-3 buttons will show to ask for user choice which will change how the story unfolds.

A small minigame might also be present using the gestures of touch devices but yeah that will reside in its own scene for the sake of it.

I am a bit confused how to manage hundreds of dialogues, character sprites and background arts within a single scene and change them using touch event on the dialouge_BG actor.

 

Your approach for creating character and BG controller seems great as I can just create function which will return proper image to be used for that character, same thing for dialogue aswell with something like dialogue.make(“arc1”, “scene3”, “line31”)

I didnt got your explanation for that creating a script controller though, can you please explain it a bit more ?

The only thing I am confused is if I can handle atleast 1 story arc by using 1 scene controller using loops or tap events (tap reloads the controller) or will I need to create 1 scene controller per page/chapter and jump from one scene to another per tap

@zenkyren sorry my intention isn’t to hijack your thread but rather then creating another thread for same question as yours, I thought it will be better to ask @richard in this thread itself for future references

To be more clear, the hard part is the “path”. It’s basically your movie script (this happened, and then this, and then etc) but its calling lines from your script file rather than just having the text itself (saving you tons of localization headaches, and letting you or someone else write the script seperately without breaking your lua code)

  1. local path = {}
  2. path[1] = { script=31, leftActor=1, rightActor=2, a=32, b=33, c=34}
  3. return path

In this case, the path file starts off as a table, and ends as one. Each numeric entry is a “moment” or scene, so to speak. For example, in this example, “moment 1”, the game will use script 31, show actors 1 and 2 onscreen, and at the end offer three choices; to go to script 32, 33, or 34.

But to “flow” time you need to know what scene to goto next too, so you could add that. Here’s what a normal entry might look like:

  1. path[2] = { script=27, leftActor=1, rightActor=2, next=3 }

Play script 27, show actors 1 and 2…and then goto path[3] when done. 

The basic theory is that your scene (as in storyboard/composer) doesn’t know anything about this. Every time you enter the scene, you load some part of the story, say like this: story:load( next ) which would load path 2 and all of the stuff mentioned above. ‘next’, in this case, is a variable you pass (storyboard and composer both let you pass in parameters when you enter a scene).

Another option (instead of params) is to use a globals file. This is a great way to manage savegames and keep track of progress.

  1. – globals.lua
  2. local globals = {}
  3. globals.name = “George”
  4. globals.currentScene = 1
  5. return globals

Just include that where you need it. Then you can call ‘globals.currentScene’ instead of params.next, and just update it as necessary.

Anyway, to answer your question, no, don’t duplicate your controllers. Theoretically you can get away with even a single storyboard scene and reloading it where appropriate. You just need to simplify the complexity by building multiple levels of lua files (controllers) to handle it. 

ie: 

/localization/en.lua – english script

script.lua – script controller, calls script from active localization using script.get()

path.lua – contains the path (game flow)

story.lua – path controller, uses path.get() to fetch the path step and then can use that to grab the right text from script.get()

I’m actually wanting to program a visual novel engine as well and i just saw your post today. Would you be willing to collaborate on a project together richard9?

Wow this is really weird, I was checking this topic for your reply each 2 hours the day I posted my comment but after that I didn’t got any notifications on mail for any new replies. Do we need to manually subscribe to a thread to get mails on new replies ? Is there any option to auto-follow whenever I reply to a thread ?

So by script you mean script as in the outline of story (dialouges etc.) or the code script that determines whats happening in a scene.

Like the example you gave, script 31 loads a xx background image, after 2 secs adds chara 1 on left, after 3 secs adds chara 2 on right, plays audio file etc. Is that what you meant by script ? Aka creating common code for scenes depending on what will happen in it ? 1 Script for dialouge scenes, 1 script for any cutscenes, 1 for any mini events, 1 when the user needs to enter a choice which will determine next scene etc., is it like that ?

Sorry that I might be a bit confused, as am not sure if script is what you mean in general as just a step to create a game or if its something related and specific to lua itself (like some function or controller etc.)

mikey0: Maybe if it’s a github thing? My time is pretty restricted though, tempted to just build the framework myself quickly but with a baby sometimes I just am too busy!

shub: script = ie: movie script. Lua is a programming language is far as I’m concerned and anyone calling it scripting can flog off. :wink:  So you should basically have the:

path: the ‘code’, controlling how the game progresses

script: the ‘text’

actor: the ‘people’ who appear onscreen

and so on…terminology is usually the first thing that gets put in the fire when working on a framework!

But yes, common code means doing similar things once. I’d probably have a file that specifically handles showing multiple-choice dialogue windows, for instance. And another that shields you from making audio calls directly. Anything you have to do more than once can probably be given a lua file somewhere.

Ah I see, you meant the dialouges, I am still feeling a bit reserved to go for Corona since I have always worked in C#, Java, PHP, ObjC and Lua just gives me a weird feeling.

I think for the cutscenes and special events after specific scenes, it will be something like if(path==31) or if(script==31) (ofc in LUA code) and then perform the custom mini-event like playing audio, displaying video or w/e.

2 small things I would like to ask you last are :

Do Corona has a GUI interface builder ? I don’t have problem setting margins and X-Y manually but a GUI certainly helps a lot (dibs on XCode Interface builder). And do Corona has any good IDE like Xcode (for Objc), VS (for .net) or Eclipse (for java)

Do the textview or textbox element in corona provides ability to scroll text ?

Again, really appreciate you taking your time to answer my doubts and help me getting one step closer to try out Corona.

Corona doesn’t have an interface builder. But you have a ton of flexibility when working with GUI’s. Check out the API. Composer for changing scenes, Widgets for UI, and Text/DisplayObjects for everything else pretty much.
As far as IDE you can use Xcode for Corona SDK. I would personally recommend Outlaw if you’re on a Mac. If not don’t use it because the Windows version won’t even run.

Richard9 I’m going to put it on GitHub once i have a decent framework set up. Congrats on the baby. If you can build the framework quickly that would be really helpful. I figured doing a collab project would be easier though since they say 2 heads are better then one.

I downloaded Corona Editor and LuaGlider for now, will take a look at Outlaw since I have a macbook too.

I am still a bit worried how UI elements can be exactly arrange and positioned without calculating their exact X-Y origins, not to mention this is specially difficult to do if you use particle system

However I might be wrong as I have yet to use Lua and check the APIs, my comments are from my exp. of creating a UI by using code for Objc only

Read the API, there’s a ton of ways to do that. display.contentWidth and display.contentHeight gets the correct sizes of the screen. however, depending on how you want to lay things out, it might be better to put in actual pixel coordinates.

Yeah I just use SublimeText3 with the Corona Editor plugin. Works great. I suppose if you want a serious debugger or IDE stuff like Outlaw/Glider/etc might be more relevant but ST3 is literally an Apple-grade interface. 

And generally speaking you should be developing somewhat resolution-agnostic, which means most of your X/Y code is going to be variable fractions rather than outright placement. (Although Corona builds so fast neither method is particularly difficult)

mikey, I’ll give it some thought. I have a contract to push through right now though so it all depends how much non-baby time appears during the day.

I completely understand. Hopefully you get some time. But either way good with the new baby. :slight_smile:
I actually am working from the beginning. Setting up an easy to use menu as a base. Then going from there, I’m going to work on saving and loading. After that, then I’m going to figure out how to set up the actors, scripts, etc

wow, didn’t ever thought that this kind of idea is popping up here. I thought that I am the only one thinking of the opportunity of using Corona to build a visual-novel like game.

short question to anyone who can answer this: i’ve been wondering for a while after tinkering with Corona, but how can I create a text box that will show those conversations? i haven’t get the slightest idea of how to create that though.

I created a prototype for that and the way I did was, create the textbox’s background as a image and then create a rect of text (texbox) of same size or lesser size acc to the image and place the text on it

The text ofc you will have to load from a table or script like advised above

yes, I get the gist of it. but Corona isn’t specialized in animating text, while that thing is pretty common when you’re playing a visual novel. a kind of animation where the texts appear as they were being typed in and out. get it?

I actually have an open source project that I’m working on. I’ve kinda had to put it off to the side for a bit because I’m working on an MMORPG as well. But, you are free to use the source code as much or as little as you want. Just, if you can, please put me in the credits I would really appreciate it. I have dialogue boxes displaying correctly and backgrounds, as well as a timer for dates and a script reader.

https://github.com/MikeyUchiha/visual-novel-engine

Gonna check that out, I will push a few of my own custom codes which I wanted to add in my VN to make full use of mobile technology like using mini-games or events making use of swipe or gesture recognizer.

By the way, have you added the background music/sfx part or does it need to be added ?

PS: Some kind of basic readme would have helped on how your script can be used (dialogues and scenes)

I know shubhank, I just haven’t had time to go back and fix up the Read Me file, which I actually explained in the Read Me. lol

Honestly, I wasn’t even planning on showing people this until I had it in a more completed state but since someone brought it up I figured I’d post it so that you’re not starting from scratch.

I’ve been very busy with the MMORPG I’m working on and I also just finished up my finals so I’ll have more time to go through and document the code a bit better. Also, I will try to redo the Read Me over the next couple of days. If you want to help and push in some custom code feel free to add me on Skype and we can see what we can come up with. The background music/sfx still has to be done, but honestly, that’s the last thing on my last to focus on. Since automatic fowarding of scripts based on input is a high priority as well as remembering player variables/events(thinking of using SQL for this).

Skype Username: MikeyUchiha

Do not use sql for anything like player variables or save state, atleast not remote sql. The file cannot be encrypted or protected and thus a user can edit the database to linger with variables and game state. I myself did quite a lot of research and found it better to sync the data to a remote sql server in realtime or something like parse.

I will try to push up some code once I resume my VN project again since we are still on character sprites stage and am researching and testing backend code.

Added you on skype :slight_smile:

Thanks for the advice. Most MMORPG’s use SQL for their character database though and they have to be secure. So that’s why I figured that SQL itself was secure. What do you think about using JSON?

I got your Skype add and I look forward to working with you. I actually have character sprites pretty much functioning if you want to take a look at my code.

cool, thanks for sharing mikey0. I will definitely take a look at it. Though it is quite a lot to check, and the read me file doesn’t seem to explain much. :slight_smile: