Thursday Report: JASON!

This week I spent some time looking into databases. Since there’s going to be a great deal of possible conversations through the game, it wouldn’t make sense to deal with this dialogue directly in the engine itself. Sorting through great numbers of copy in code probably isn’t even good for the soul.

External databases make things more manageable — I knew this much. My time creating or even using databases is virtually non-existent however, so I knew I had some learning to do.

I began looking into CSV, which seemed at first like the ideal format. It can be formatted and edited in most spreadsheet software, but exports to raw text that can be parsed by the editor.

Through my digging, however, I learnt about JSON, and how it’s a popular choice for many modern systems and software. While JSON is built with Javascript in mind, it’s wide-usage has made it viable on all kinds of different platforms, including Godot.

From what I’ve discovered, the beauty of JSON is also it’s curse: JSON is simple by design. You add the label of a thing, and then you type what that thing is.

From Wikipedia

Taking the above example, if you were writing this out the hard way, you bet your butt that you’re typing out “type” and “number” for every single “type” and “number” that you’re dealing with.

Fortunately, since both CSV and JSON are just text, they can be converted between format without too much trouble. My plan, then, is to build everything in a spreadsheet, where I have a full and clear view of all the data, export to CSV, and then convert to JSON. Which means we go from this:

To this

And it’s good to go.

I don’t know if this is the right way of doing things, but it seems to be working for now. As always, I’ll be keeping to the standard practice of keeping things as simple as possible, until anything breaks.

Speaking of which, I did spend an embarrassing amount of time this week trying to figure out why my arrays (the dialogue itself) wasn’t translating correctly between the JSON and the game when running. As it tturns out I had been using two different kinds of quotation mark the whole time, which systems don’t like much, no-sir. Who knew there was more than one kind — I certainly do now.

These aren’t the same thing, folks!

But, with that out the way, I now have a pretty effective way to assign each character their own unique database of dialogue that the engine will pick and hand the character on-the-fly. While travelers will each have their own unique dialogues, the vegetable villagers will have different personality ‘identifiers’ that they will be labelled with to help balance the workload.

Tellstone now speaking his mind.

Currently I’ve been able to randomise different dialogues, but I’m hoping to have Godot navigate the database to select dialogue based on many factors, including the weather, how ‘warm’ they feel toward the player, and pure chance.

I’ll eventually be extending databases for different items, tasks, and other such areas where there are too many items I’d be mad not to.

Unfortunately my previous plan to assign dialogue instructions by including capitalised, three letter terms to the end of each entry (such as ‘SHO’ for ‘shocked’) has fallen a bit short. It works by itself, but combining different instructions seems to be giving strange results.

Still, this is the beginning of building a dialogue system where I can start establishing conversations where character really start to react and convey emotion, all in an environment that’s clean and structured.

After saying, “Hey, it’s my favourite gardener!”

The player-response system is still being toyed with. I really like the philosophy behind using icons rather than text at this point — a picture paints a thousands words, after all. However I’m still struggling with finding icons that don’t feel too gamey or interfacey. It’s hard to describe, but I don’t want the player to suddenly feel like they’re navigating a phone rather than a world. So we’ll see, something to come back to.

Throwing around ideas for conversational responses.

Lastly, I’ve been reworking the inventory system with my new wisdom derived from working on the equipment screen.

The result is something that’s almost functional, but still needs some work. Each slot is now it’s own node that takes care of itself, rather than the inventory screen managing all the data. This makes it really easy to assign the quantities and item of each node.

Will six slots be enough?

The only thing left are the many items to begin filling those slots with.

My original placeholder was an apple, which I quickly scrapped after realizing that eating an apple in this game would, of course, be abominable.


Follow me on Twitter.