Game Design Game Development Geek / Technical

Toytles: Leaf Raking Progress Report – Dialog Tagging and Filtering

In last week’s report, I planned and started work on a new way for the game to choose and present dialog to you when you visit a neighbor.

The immediate goal, and the sole goal of last week’s sprint, is to allow neighbors who are worried about the status of their lawns to say something about it.

Sprint 7: Grumpy dialog

Last week’s sprint plan was:

  • Give each neighbor unique text as unhappy clients

I did 6.5 hours of game development, almost doing as much as I did the previous week. In fact, I could have done more, except I spent part of the weekend helping my sister-in-law move.

I was able to replace the simple dialog system based on client status with a more versatile system that is based on arbitrary tags that correspond with the state of the game.

I really enjoyed this coding effort, partly because my plan wasn’t as fully fleshed out as I would have liked. That is, I started to have an idea about dialog options based on tags, came up with a point of attack, and then took a leap of faith that the code would evolve fully formed into what I needed.

And it worked out! I’ve test-driven solutions before, but this was the first time I put so much faith into the code turning out to be what I needed. It was like putting together a puzzle that I was simultaneously jigsawing the pieces for.

Last week I explained the validators. This past week I created tags, such as IS_CLIENT_TAG and IS_PROSPECT_TAG, and I changed the collection of existing dialog text to pair with those tags instead of the client’s status.

I created a dialog filter which is initialized with a collection of tags, and when it is given a collection of tagged dialog, it will return a filtered collection based on those tags.

Where do those tags come from? They are generated based off of the current state of the game.

NeighborGreetings::DialogFilter dialogFilter(NeighborGreetings::getDialogTagsFromGameData(CurrentData));
NeighborGreetings::TaggedNeighborDialogCollection filteredDialogCollection = dialogFilter.filter(NeighborIDsToGreetings[yardData.occupantID]);

Now, the implementation to getDialogTagsFromGameData() is a bit simplistic, but it uses the validators in a sequence of if statements. For instance, it checks if the game’s current state indicates if the neighbor you are visiting is a client, and if so, it adds IS_CLIENT_TAG to the tag collection, which is returned and becomes the argument to the constructor of DialogFilter.

In the future, I can change this function to add more validators/tags. For instance, I can check the time and date and see if it is a specific holiday or a weekend or if it is early in the morning or late in the evening, and if I pair up those tags with new dialog that is relevant, it should easily allow for a variety of dialog options for a given neighbor.

Adding the grumpy dialog

So the dialog filter is able to determine if you are visiting a prospect, an ex-client, a client, or an unhappy client and find the text appropriate for that given neighbor. All that’s left is to write the text for unhappy clients.

Unfortunately, I wasn’t able to take advantage of this new dialog filter system to add new dialog for unhappy/worried clients. I might have been able to spend part of Saturday on writing that new dialog, but as I said, I was helping someone move all day.

I think I underestimated how much work there was in creating this system. I mean, all told, it only amounts to about two full days worth of work, but as I am working on this part-time, it’s spread over the course of a couple of weeks. It means that despite all of the effort, the game currently looks and behaves the same from the player’s perspective as it did before these changes.

I know that since I’m not working on the game full-time that occasionally I will take on something that might take a few hours and it will take a few days in real time, but it’s still frustrating. I feel like I could have done the last 7 weeks of work in one or two weeks if I was focused on it full-time.

So it looks like once again the grumpy dialog, and the next release, is pushed into the next sprint.

Thanks for reading!

Toytles: Leaf Raking Player's Guide

Want to learn when I release updates to Toytles: Leaf Raking or about future games I am creating? Sign up for the GBGames Curiosities newsletter, and get the 24-page, full color PDF of the Toytles: Leaf Raking Player’s Guide for free!

One reply on “Toytles: Leaf Raking Progress Report – Dialog Tagging and Filtering”

Comments are closed.