·

—

Devblog #6: The Sentence Builder

Hey, it’s me again, back after a couple weeks of absolute radio silence with another dev blog that people may or may not read. This week’s topic on the Sentence Builder and how it works was suggested by flayed-by-firelight on Itch.io.

The idea for the Sentence Builder first came about in the initial stages of development where I was trying to find ways to differentiate this game from my original sources of inspiration. 7 Days to End With You had something similar, where in a couple of in-game instances, the game prompts you to select one of the words in your vocabulary to say (I can’t find any images of this, so you’ll just have to imagine for now).

While I overall enjoyed the game, my honest thought was that the actual application of the language and what you, as the player, were able to do with it was rather limited. You have all of these words that you’ve learned the meaning of, and yet, once you’ve learned the words, you don’t really get to use many, if any of them in actual conversation.

So, initially, I came up with the idea that you would type out sentences as actual in-game dialogue for the game to pick up on and react to. It would’ve been a rather interesting idea, until I realized that typos, different typing formats, special characters, and general input sanitization would be an absolute nightmare to deal with. So, I scaled back slightly to the current drag and drop system, where you, well, drag and drop items from your dictionary of all of your words into the Sentence Builder, before sending that sentence to the game for it to parse.

Now, I will admit that currently I don’t really use the Sentence Builder to anything near its full extent, as right now the two times it appears in the game are really just trying to get you to say some key words. But, as the groundwork is already there, it wouldn’t take that much effort to expand it to full, grammatically correct sentences (I hope).

Early version of the Sentence Builder, which makes me realize that I need to update the sample screenshots of a lot of things…

After you’ve built your sentence made up of words and compounds, you can go ahead and submit that to the game, which takes the sentence, and breaks it apart to find key parts of the sentence such as the Subject, Verb/s, Objects, and more. By default, every word is already associated with a part of speech, making this process much easier for the Sentence Builder, assuming nothing crazy is going on. Finally, the entire thing is checked for grammatical correctness, and a score is generated for how utterly wild the sentence supposedly is.

Now, I will be honest, there are a ton of different edge cases that could probably bork this system, but that’s what bug reports on the Discord server are for.

For the actual responses to the information given by the player, there are two main paths that one could potentially go down: key word and information recognition, and an LLM. I, personally, decided to go with the slightly more rigid key information recognition route, as incorporating an entire LLM into this game that is essentially a small side project of mine didn’t seem right, especially since I would have to build one from the ground up for it to be able to handle Ordateig. Oh, and I also like my game being able to run on a potato. (As an aside, I did actually get offers from an AI company or two to pay them for their own models, which I declined.)

For how I handle the key information recognition, once the dialogue script calls for the Sentence Builder to be pulled up, it waits for the player to input a sentence. It then enters a branching system of different possible responses, where each one, in a nutshell, attempts to find the few key parts that it needs in the correct grammatical functions in the sentence, and if the best match, that option is chosen as a response.

Of course, if you have an utterly abysmal grammar score, the game will also react accordingly.

Well, that’s a slightly longer devblog than normal. Once again, thanks to flayed-by-firelight for suggesting this topic, and if you have anything else you want me to rant about, put it in the comments. Otherwise, I’ll pull some random thing out of my head in time for the next devblog on Friday, November 20th at 8:00 pm UTC. Yes, I’m officially just changing the time I release these since I never get them on time anyways.

Leave a Reply