ChiChiLand Adventure: NPC Motivation

Having finished working on the Kiki’s Cocoa project, I got back to work on the ChiChiLand Adventure. My current task is programming the NPC VI.

I am also beginning to lay foundations for the new custom pathfinding algorithm to replace the Game Maker Studio’s built-in one.

At the moment of spawn, each NPC gets assigned a food they prefer and a hunger meter. As the hunger grows, the animals are more and more likely to seek out food. When the seek procedure starts, they first tag the food and then proceed navigating to it. If there is no untagged food to be found, they keep walking around and periodically checking if new food appeared.

I am still to implement functions such as sight/sense range and the actual food consumption/regrowth mechanics, but at the moment I have something that looks like a game of musical chairs: some animals get their food and others keep running around searching for more berries that never spawn.


I was planning to have the whole system running by now, but haven’t accounted for the need to tag food sources. In one of the builds without the tagging mechanic all animals would clump around few, limited food sources, constantly pushing one another out of the way. It was hilarious to watch, but fundamentally broken:

Animals knew how to find food, but not how to share
Animals knew how to find food, but not how to share


The animals are much better behaved now, but still pretty dumb :) I am also beginning to see some serious performance differences between the .exe version and the html5. Considering opening up a free Steam Workshop alpha if the browser version keeps getting slower.