carrotcake Blog šŸƒ


official devlog for carrotcake written by Louis Durrant

Thursday Report: JASON!

Posted on Dec 20, 2018

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.