Dog Eat Dog Dev Log — Week 2: Like Rabbits
This past week at Stealth Elephant Entertainment was a bit of a hectic one. I’m a college student, you see, so I had to set aside game dev for the most part and focus on finals. Despite that, I did make tangible progress. Though perhaps not as much as I’d like.
This week was all about the AI. In fact, I actually disabled the player character to focus on the AI behavior. It started fairly simple: here’s the wandering pattern I showed off last week.
I didn’t spend much time making this behavior too complicated. The character alternates between walking in a random direction and waiting. That’s all there really is to it. Now you may also notice in the gif above that the bunny’s food level is really high. Normally it defaults to 100, but I had to set it up to 5000 while recording. Why? Normally the bunny would quickly get hungry and seek out food. Here’s what that behavior looks like:
As you can see, the bunnies run to the nearest flower and eat it, just like a player would. Their food level goes up, showing their hunger getting satiated.
The final behavior in the current build is reproduction. Each bunny only has 50 seconds to live, so they need to make more bunnies or else they die out. There’s not really anything complex going on here. When their other needs are all met, the bunnies set out to find another bunny. When those two bunnies touch, a new baby bunny is born.
Now if you’re following my personal mastodon, you’ve already seen this. But my first attempt at reproduction did not go according to plan. To sum it up, I ran the game after I taught the bunnies how to make babies, but before they knew how to stop making babies. The result got me laughing at the absurdity of it all.
My final point of discussion is the way the bunnies make decisions. As it stands, my bunnies alternate between wandering, foraging, and reproducing based on a simple need system. Basically, every bunny has each of their needs assigned a value from 1 to 100. 100 means the need is completely satisfied and 1 means that it’s in dire need. Each need goes down by 1 point every second, and if a need ever hits zero, the bunny dies.
The three needs for each bunny are recreation, food, and reproduction. Recreation is linked to wandering, where each second spent wandering raises Recreation by 10. Food is linked to foraging, where the bunny meets a certain quota (right now it’s 20) of calories before checking their needs again to see if they should continue eating. And reproduction is linked to reproduction (obviously). Every time a bunny makes a baby, their reproduction goes up by 100 points. So it’s not meant to be something that happens often. This system leads the bunny AI to choose their behavior based on what’s the most pressing, and then take the appropriate actions. It’s a fairly simple system, but it leads to the simulation of a simplistic ecosystem.
That’s it for this week. I hope you enjoyed. The build for patrons this week will keep the player disabled because they need a bit of attention to be worked into the current system. Thanks for reading, and I hope you’ll come back next week for more.