January 27, 2016 by namespacestudio
Another week has gone by, and this time I’ve spent the entire time up to my elbows in directed graphs, dialog trees, and quests. Having all of them individually isn’t so bad, but making them play nicely together has been a pain in my butt. Complicating all of this is the need to have some sort of file IO so that I don’t have to hard code every single quest into the game. This meant that in addition to doing the work with dialog trees, I’ve had to implement a small version of a developer console, where appropriate strings from the quest json files get parsed as functions inside of the engine, allowing dialog trees to check to see if, for example, the player has talked to npc bob a specific number of times, or to perform some action in order to prepare the game to run a quest.
For now I think the system will do, but it has one major drawback, in that it can only work with static classes. Because the information is just strings of characters in a file, I can’t reference a specific object. Instead, I have to call functions on classes that I know in advance will be there (i.e. the static classes), or perform expensive searching for individual objects. What this means is that I have the world state as a dictionary of strings attached to the world state static class, which the json files run their queries against.
Overall, I’m pleased with the progress, and though I think that the quest system is far from perfect, it’s heading in a direction that should be able to meet all of our needs.