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.
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.