Others What things do you need in a VN markup language?

uradamus

Active Member
Jan 4, 2018
680
746
I'm working on making a game with VN elements in Godot, and I don't like any of the existing solutions for storing and retrieving text and defining scenes. I've been planning to build a VN framework on top of Godot for a while now, but for now I'll settle for putting together a very simple markup language for describing scenes and a parser for stepping through and utilizing that data. My plan is to make each line in a scene file a sequential command, where each line starts with a keyword to tell the parser what sort of command it is, followed by the appropriate data to go with it.

For instance there could be a keyword like "text" or "t" to signal that the next thing it should do is display the text that follows the space after that keyword. A related one would be for dialog, which could use "dialog" or "d" and it gets followed by an identifier that the parser uses to fill in a name label to attribute the following text to. You should be getting the general picture by now.

I'm also planning to have one or more files where a number of things can be defined and/or given aliases on a global scale for use by all scene files. Some things that can be done in these files will include defining UI layouts, so you can easily swap between different screen layouts from a scene script with a simple one-liner like everything else.

So my question for all of you is what do you feel are essential commands needed for executing a VN scene.

You don't have permission to view the spoiler content. Log in or register now.

Please let me know if you can think of anything I've missed! :)

Edit: Oh, forgot two points. The parser will ignore leading whitespace and blank lines. Also I'll probably use # as a keyword for comment lines, to tell the parser to ignore lines starting with that and move to the next valid line to execute instead.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,020
3,124
Funnily enough I've been on the same sort of quest for 2 years now.

While it is possible to write a "VN scripting" language using just string matches, you will quickly find yourself bogged down in details of syntax, error handling and inevitable spaghetti code.

I'm not a beginning programmer, although my experience has largely been with embedded development and later web apps, but i ended up going through 3 different attempts at a "string match ghetto interpreter" and giving up on each after a few months of work.:oops:

Discouraged, I asked for some help in a different forum, and was told the following:

"To write a genuine parser, you need to look at implementing lexing/tokenizer and then an interpreter for the resulting AST."

Turns out all this stuff is covered by "Complier" courses if you are lucky enough to have studied computer science, else you'll have to teach yourself.

Eventually, I stumbled upon "Crafting Interpreters" ( craftinginterpreters . com ) [:noexpression:sigh not enough posts to include links!] which is a book/website in progress by Robert Nystrom. His stuff was a godsend, and I was able to follow along and translate his examples from the original Java into C# and integrate into a Unity app.

It worked! :heartcoveredeyes::heartcoveredeyes: MUHAHAHA finally my VN dreams would come true!

Exceeeeept, no, i then realised that the world did not need yet another half-baked VN scripting language.:FeelsBadMan:

And then I grabbed the free Inkle libraries, integrated to Unity, and here I am now, an engineer struggling to write dialogue and learn how to make renders that don't look like cowshit.

Who would have thought making a VN could be so hard!? :):):)
 

uradamus

Active Member
Jan 4, 2018
680
746
@terrordoll While my game will feature a fair bit of VN like elements for advancing the story, it will be more of a sim game and featuring real-time 3D graphics, rather than just renders, so Ren'Py is out for me at least. I hate Unity, most games made with it end up having issues for me. I'm not sure if it's just because I'm on Linux, but I doubt it, since so many Windows users end up complaining about it as well. Plus I'm not interested in anything with a subscription. Godot is just better all around on pretty much every conceivable front, unless you rely on Unity's marketplace, which I don't need at all.

@osanaiko Ya, I know the basics of lexing/tokenizing. It really shouldn't be that difficult. While I do plan on making any VN framework features I come up with for Godot available on GitHub, I really don't care if anyone else actually uses it or if it's needed or not. I just know how I want to deal with scripting scenes and currently no one has made anything like this available for Godot yet. So if I want it for my own use, I've got to create it myself. The options I've seen available so far rely on crap like xml, which I can't stand working with. No way can I put up with laying out scenes in xml with all that unnecessary cruft.

I'm still a little ways out from getting started on this though, outside of just brainstorming and coming up with the list of things I need to account for. Right now I'm finishing up a text demo of my game's early story in Twine, which I've found I really enjoy using for planning branching narratives. Also been doing a lot of 3D modeling, got a good chunk of the bridge and home scenes I need pretty early in the game and some character sculpts started. On the Godot side of things, I've just been watching some tutorials each day to get caught back up to speed by the time I'm ready to jump into some coding, probably in the next week or so. At which point this will likely be among the first things I tackle.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,020
3,124
@uradmus well it sounds like you are thinking about all the things necessary. Some beginners don't even know what questions to ask.

Going back to your original question, I'd suggest taking a look at the documentation for Utage (on the Unity store - which i understand you are not interested in using), but don't discount the knowledge it embodies regarding Japanese style VN commands.

Good luck with your Godot adventures - hopefully it has matured a bit more since last time I looked at it.
 

uradamus

Active Member
Jan 4, 2018
680
746
@osanaiko Ya, I'll give it a look. I've been playing a lot of VNs over the past few years and spent some time looking over Ren'Py a while back, so I already had a pretty good idea of most things that are needed for a fairly feature complete alternative, but it's always good to hear from others and see how other's have tackled related tasks. BTW, that Crafting Interpreters book looked interesting too, haven't gotten into it yet, but after looking over the intro it seems like it'd be a good read. I probably won't go through the whole thing, since a lot of it would be overkill, but it never hurts to have a solid refresher from time to time.

Ultimately I'd like to put together a rather advanced VN framework on top of Godot. Basically with a node based editor, similar to Twine's, for laying out a game's scene relationships, but with both text and visual layout editor's available for editing the scenes themselves. Plus a resource tracker to manage assets - both placeholder and final versions. Probably a few other things eventually too, like UI and text style editors. For now though I only really need the scene scripting markup + interpreter to get going with my current project. But I've got plenty of other projects I'd like to tackle down the line, including some more traditional VNs, that would benefit from such a framework. Though I'll first have to spend some time figuring out how to integrate new tools into Godot itself for a lot of that stuff, but it does have pretty good support for such things from what I've heard.