This is my first blog to support the kickstarter for Creature Craft. http://www.kickstarter.com/projects/oatycakes/creature-craft
I want to talk about AI. Everyone, me included, bitches about AI in games. When a squad mate commits some pointless suicidal act our first shout is “Stupid AI!” And rightfully so, but our conversation about AI needs to go much deeper than why are your team mates always so stupid. The real question is for an AI to not be stupid, what does it need to know?
Let’s stick with the suicidal squad mate. So, lets say he stands up in the middle of a fire fight and gets his stupid computer head blown off. Why does this happen? And more importantly, why would a human not do it? In virtually every context of a malfunctioning AI it is that the computer lacks context for its decisions. It simply doesn’t know that it needs to keep ducking. The programmer may have decided that if bullets weren’t flying close to your squad mate for a little while that he could stand up and advance on the enemy. The reasons that situations like this arise is that no programer or design team can ever fully anticipate the situations involved in a game. There is a limit beyond which the AI will fail. Our goal as programmers is to put that failure point as far out there as possible, so that hopefully, an average player will never encounter it.
When you are designing an AI there is another component and that is equally important. That is situational intelligence. Going back to your squad mate again. If he has been setup in-game as inexperienced and brash then you would expect a much lower level of competency from him. On the other hand, if he is supposed to be a Navy SEAL and he pulls a stupid trick like that then you will be aggravated and any realism the game was shooting for will be thrown out the window, right alongside the controller.
Now, finally, I come around to Creature-Craft. AI for animals has the same issues as for humans. Different types of animals behave very differently in situations. A lion and a rabbit will behave entirely differently when encountering the same situation. It certainly would not do for a pack of lions to flee from a lone wolf the way a pack of rabbits would. Furthermore, in general, as size increases so does intelligence (This is for animals not people!). Even within a species this tends to be true. Look at alligators and compare how easily caught a small specimen is compared to a large one. There are a thousand issues to contend with in making animals behave correctly. Sound impossible?
Well, there’s a reason why a doctor has to study 16 years to treat humans and a vet has to study the same amount to treat all the other animals in the world. Humans are vastly complex and individual. Animals are exponentially less so. Think of it this way. If we were to need a dog and a cat in a game would we need to write two entirely different AI routines? No, of course not. Most of their behaviors are identical. Meat eaters, sleep a lot, four legged, affinity for humans. The differences are almost entirely in the level to which they exhibit certain behaviors. So, a cat is much more driven to hunt small animals. A dog is more likely to want to be beside a human during activity. A cat sleeps more. And so on and so forth. Animal behavior can successfully be modulated by a simple percentage change. At that point the only complicating factor is to determine how that characteristic exhibits itself.
Okay, now we are in the nitty gritty stuff. How does an animal that has a 50% herding, 75% hiding, 10% size, and 15% bravery behave?
Well, in my world, herding indicates two things, the first is that the higher the herding percentage is, the less space any given quantity of that animal will take. So, a 100% herding animal would have the entire herd tend to occupy as little space as possible. Making them stand shoulder to shoulder. The other aspect is that a herd will protect it’s members.
Next is the hiding rating. That decides how often the animal will leave concealment. A Great White Shark would rate 0 on that scale and a catfish would rate ~90%. This creature really likes to hide but will come out to move around and to forage.
Size should be pretty self explanatory. It tells us what it can eat and what can eat it.
Finally, this animal has a very low bravery. If it sees a predator it is going to bolt. This braveness rating will counteract the herding protective aspects since the animals are too afraid to ever come and help.
So, in the end we have an animal that is roughly, a rabbit!
That’s the basics of Creature Craft’s AI. Tomorrow I will get in to greater depth about the AI and talk about how it works with everything in the game to inform the actions of the creatures!