Home Artists Posts Import Register

Content

First off, I wanna thank everyone for their support this past month! I'm so very thankful that I was able to do so and still have you all here waiting for me to come back, I really do just have the best community. ♥ Thank you for all that you do!

Now! I want to get into some of the coding design I put into this VN demo. This time around, I want to get into my choices for "Dialogue Parsing", in particular the narrative display when talking to a character. I tried to make this as reusable and configurable as possible, so I had to make some interesting decisions.

This is part of a larger file, but I wanted to focus on this narrative "step": each step is one full dialogue tree for a character. A step can have 3 attributes: a check method, a complete object, and a text string.

The check method basically determines if the narrative step should be accessible right now, based on triggers in the global GameState object. I'm only checking the triggers here, but it can also check on items held and other attributes from the GameState object, so it's not just limited to event triggers.

The complete object contains attributes that get added to the "triggers" in GameState once the dialogue is complete. Basically, when the dialogue ends you've completed that "event", so that gets flagged to prevent it from being repeated/it can trigger other dialogue events in other areas.

Finally, the text string is arguably the most important. I wanted to make this as easy to write for as possible, so it is one big text string that supports Markdown, and you can specify both a character name and a character portrait image for every line of dialogue! Each line is one text box; meaning you'll have to click to advance to the next line once it's done. I parse a lot of this via regex. Let's break it down!

For the above textbox, the text line is:

"Alice//Alice/alice-glare: ...I can see that you need assistance. Since Fomo seems to have taken a liking to you..."

When we parse this, we can see that Alice is the character name to display, Alice/alice-glare is the image, and the rest is the text to be typed/displayed in the textbox! The regex would then need to split on the first instance of ": ", as that's the end of the configuration data for this line and everything after is the dialogue to display. This all makes adding new dialogue very easy to manage, as it's all very self contained and configurable. The addition of Markdown means that you can specify bold text (**text**) and italics (*text*) for emphasis without knowing any real code! With enough portrait images, I can simply sit there and type out scenarios and interactions and not have to do any additional coding. The framework is already there!

For some lines, you can see instead of a character name, is just the letter "u"...This is for lines the player character says/thinks (you = u). Images can also be specified for these lines, so you can see character's reactions to what the player is doing/saying.

Futhermore, you can see that there's no configuration data for certain lines (such as line 4 in the above picture). In these cases, the configuration data from the previous line carries over to the new line; so you don't have to retype all of it if the character's name/expression does not change between textbox advances.

There's a lot more going on besides this, but I thought this was one of the more interesting/fun solutions I came up with that makes the demo easy to build upon. I can expand on this later, and even implement choice dialog boxes if need be! Also, if I get some guest writers creating scenarios for the game, this framework is very human readable/editable, so they (hopefully) won't have much difficulty writing additions for it. Pretty good, if I say so myself!

Lemme know what you think, this is all still very early even if it is very much workable as is.

Files

Comments

DarkRaven

i think this is very nice the amount of effort ya putting into it x3 cannot wait to see what ya think of next for it x3