Dog Eat Dog Dev Log — Week 3: In which Bunnies and Foxes and Shrubs Have a Nice Chat

Lincoln Hutchinson
Stealth Elephant Entertainment
4 min readDec 27, 2017

Merry Christmas, everybody! As you may have noticed, this log was delayed by two days due to the Christmas celebrations. Sorry for the wait!

This week, a lot of progress has been made in terms of graphics and the AI saw a minor overhaul in terms of structure. Here’s what the game looks like now:

Actual Artwork!

As you can see, we have an actual background now. We also have an actual color-shifted bunny for the AI rather than the green tinted one I was using before. We also finally have some carnivores in the form of those foxes up at the top. Lastly, the plant art got an upgrade from my lousy programmer art to a nice little shrubbery sprite.

We also have some new artwork of some environmental assets. These are some bushes and flowers that don’t presently do anything in the game and only serve as window dressing.

We also added a simple title screen. It’s pretty bare-bones and doesn’t do anything, but it was a quick little task that makes the game slightly nicer.

Now for the AI. If you’re subscribed to our Patreon so you can play the builds yourself, you might not see any major difference. Honestly, I think the only change you may notice in the bunny behavior is the disappearance of the wandering state. This disappearance is actually due to a major overhaul in the AI system under the hood. I’ll put this in fairly simple, non-technical terms for the sake of brevity.

Last week’s build had the AI using what’s called a finite state machine for their behaviours. Basically, the AI had a list of needs that decreased over time (Hunger, Recreation, and Reproduction). Whenever the AI didn’t have anything to do, it would look at whichever need was the lowest, and then say something like “I am hungry, therefore I will do whatever action I was programmed to do when hungry.” That system was lacking when it came to the type of behaviour I wanted from my NPCs. Basically, while it was fairly straightforward to write the AI for my bunnies in a vacuum, once I got to the foxes, it was difficult to reuse the code from the bunnies in a nice modular way that would allow for flexible behaviours in different creatures.

The new system uses something called “Needs-Based AI.” This is an idea I pulled from this article by Robert Zubek. If you’ve ever played The Sims, then it may help to know that this is modeled after the system used in that game. In the Needs-Based AI system, rather than a given character knowing what it wants and what it has to do what it wants, it knows what it wants and it can ask other objects if they can give the character what it wants, and what the character needs to do to get that object to give it what it wants.

That’s all a bit of a mouthful, so let me offer an example of how this works within the game. A bunny isn’t doing anything, and it gets hungry. It looks around itself and finds a plant. The plant tells the bunny that the plant can make the bunny less hungry if the bunny follows the plants instructions. The bunny agrees, and the plant sends the bunny two instructions. First, walk to the plant, then eat the plant.

It’s fairly simple, but it’s a system that allows for a lot of small adjustments without a lot of extra programming. For example, if I want to make a second animal that can eat plants (as foxes currently do), then I don’t need to program in anything new as long as the new animal has the same pieces of code that allow it to get hungry and look around for things that allow it to fulfill its hunger.

There’s also an additional layer of customization on top of the base needs level that allows me to place any number of prerequisites on top of a given object that fulfills a need. For example, when bunnies want to reproduce, they must first match the criteria of having reached a certain base age (20 seconds at present). There are a few other criteria placed on top, such as the criteria that the bunny not be targeting itself as a potential partner. With this system, alongside the simple behaviour pieces that make up the step by step guide will make up the backbone of the game’s AI system as we move forward.

With all that out of the way, I should warn you all that next week’s build will actually not focus on AI. After three weeks of working on the AI, I’ve actually decided it’s time that I spend a little bit of my focus on the player character and their interaction with the game. It is a game, after all. My plan is to work out the player’s progression and combat mechanics and get them to a point where they’re fairly enjoyable to play with, then I’ll be able to come back to the AI and integrate them into that system. So that’s what you’ve got to look forward to next week. See you then!

--

--