|I just add these pictures for prettyness|
What brought me to this wild conclusion? Let's back up a little. Even though I finished a computer sciences degree at university, I make my games in Unity. I could make my own game engine, but why re-do something that has been done better by others before? With Unity as an engine base, I can make even more awesome games than if I had to build the graphics part myself. Unity is very suitable for 3D action games and that's why it is my engine of choice. With standard assets and scripts you can build a prototype within the hour.
But, as with any existing engine, Unity can not be tailoring to every possible kind of game you might want to make with it. What I was missing was a decent way of scripting. Sure, Unity has a great object-oriented scripting system, which is great when you want to handle many pieces in a game environment, but a story script does not work that way. Many things working at a time makes a story confusing. What you want is something more monolithic, guiding the program and player in a certain direction. What you want is something called a structural scripting language, something like BASIC.
|More pretty pictures!|
Fortunately, Unity has an asset store that can get you any kind of asset, script or functionality you desire. Unfortunately, none of them felt right. There's a lua framework, that mostly focuses on moddability of games and there are several visual novel toolkits that do little else. However, none give me any tools to script events in a game field, which, as an action-fan, kind of saddens me. The final level on the spaceship in Sonic 2 would be less impressive if you just teleported there, the scenes in Tomb Raider with Miss Natla made the spelunking feel extra mysterious and anyone who played Final Fantasy 6 (or 3, maybe not an action title) will remember how awesome it was to see that asshole Kefka be blown apart bit by bit in the end. Also, yes, I am excluding over-scripted games, so I can make my point.
So, with all the existing systems being unsatisfactory, I set out to make my own scripting system. These were the requirements I had for the system:
- Portability to every platform Unity provides, so everything had to be built from scratch
- Modularity, it should be easy to expand and easy to use for multiple purposes
- Easy localization for text and speech
- Communication with the playing field, start animations etc. at given times in the script
- GUI handling, let the new script handle menus, because Unity's GUI handling is so atrocious, it needs a complete post of its own.
I call it: the Story Engine.
|What could all these pretty pictures be for?|
The scripting language was the main focus for the system. A script for the system consists of a CSV or "Comma Separated Value" file. For easy parsing, I interchanged the commas with whatever this vertical line character is called: "|". That way I did not have to worry about quotes and commas in text. Another benefit of CSV files is that you can edit them in Excel or any other alternative.
|Basic design of the system|
The first row in the CSV file tells the interpreter what every cell in every column does.The top line of a typical script would be:
Every row in the Excel sheet holds 1 command. I won't go into too much detail, but these are the basics:
- There are several possible commands possible for the cmd column. All commands are eventually handled by the 'processor' module.
- Arguments for those commands can be put in the arg0-arg3 columns, if you want to use a command with more than 4 arguments, just add a column in Excel
- The label column depicts labels for the goto and gosub commands to jump to.
- The txt_xx column sets the text for any GUI element, like buttons, story-text or subtitles. A locale command can switch the txt column used for text with the language code used for xx.
- spk_xx, for when spoken text is needed, holds the name of a sound file. Also switchable with the locale command. In this case, the budget only allowed 1 spoken language :(.
|A little girl with explosives.|
I have not been kind to the dating sim, the sibling of the visual novel, comparing it to a screwdriver to my eye, but I have always had a certain respect for the visual novel format in a story-telling kind of way. Text based stories easily break the "show, don't tell" rule, while on the other hand visual stories need to have everything shown, even dull conversations, or it breaks immersion. A visual novel can show a lot without description, while still leaving room for the imagination of the reader.
Also, a visual novel is perfect to test your scripting system with. Even though I did not know much about visual novels, I was happy to dive into that world and I met a lot of nice people along the way. If those people are reading this: you know who you are, you're awesome!
So, I made the first prototype of a Chapter in 1 day (12 hours in 1 day, so technically one and a half work day), a proof of concept demo with actual artists in a month (released as a demo much later) and today, as of writing, we release the full product. Introducing:
|The logo of Detective Hank and the Golden Sneeze|
Detective Hank and the Golden Sneeze is an interactive whodunnit visual novel with a different culprit on each playthrough. It uses almost all capabilities of my scripting system. Localization and voice acting are pending. As for now, I will keep on polishing the engine, as after release a lot of people are bound to bump into fringe-bugs.
|It's getting crowded in here.|
Building this visual novel was a fantastic test for my scripting system. I found out a lot of parts did not work as I intended them to and, because the system did not need much expansion, the bugs were easy to isolate and fix. As I wanted more functionality for the novel, I got to experiment with inheritance and see if expansion of the base-code worked. And it did!
For the sake of just making a visual novel why didn't I just go with Ren.py or TyranoBuilder? I could have, but the pieces of code I hold now are so modular, I might just use them for every game I am going to make for the next couple of years. It was fun to build a visual novel to test both my engine coding and story writing skills and it definitely made me a better game developer. That's why this action-loving dev made a visual novel... and it might not be his last.
As of writing, Detective Hank and the Golden Sneeze is still awaiting the Steam Greenlight process, but it is already available on itch.io over here. If you want to try it out first, we have a demo available here.