Animal AI - Complex Behavior With Simple Implementation

Post Reply
User avatar
TheSheWolf
Hunter
Posts: 935
Joined: April 28th, 2010, 9:48 am
Contact:

Animal AI - Complex Behavior With Simple Implementation

Post by TheSheWolf »

Drives & Programming

Ant colonies, and ants, have long been an interest of both behaviorists and computer programmers. It was realized that rather than program one enormous set of fixed behaviors, instead it was better--and far easier--to program in a number of small rules. Ex. rather than trying to teach an ant "program" to go to a certain place along this or that route, instead the behaviors of "go this way" and "move around obstacle" worked wonders.

In animal behavior, animals (and people) are much the same. We are driven by our "drives," compulsive needs or urges, which fluctuate according to physical fulfillment, hormonal level and (as any dog trainer will tell you) psychological manipulation. As an example, an predator might have, in only a vague order of importance:

- Fear (the compulsion to flee that which it fears)
- Hunger
- Prey Drive (the desire to hunt, separate but linked to eating)
- Mating Drive
- Territory Defense
- Sleeping
- Social/Play Drive (the urge to socialize and to play)

Drive Fluctuation

Now, if everything is available to an animal in its environment, it'll tackle whatever is closest (out of sight/out of mind type of thing) and, once one of the animal's needs are more urgent, it will seek that out. As the "defecit" grows more intense, the drive in question will begin to subvert other drives.

Examples: Ever been so tired you fall asleep no matter where you are? A soldier who's been at war will tell you it's more than possible for exhaustion to subvert fear. Animals can get so hungry that they completely ignore their fear of man or other predators to ravenously steal scraps. And anyone who's seen videos of rutting male animals know that they can go completely without food once that mating drive kicks into full gear.

Application for Game Programming

The reason I'm posting this here is the recent discussion of altering animal AI. We are LONG overdue for having more complex behavior, something other than "wanders the map" and "sleeps/eats on schedule." This system could be relatively easily implemented, in a simple way, to mimic extremely complex behavior systems.

How?
1. A list of drives is created.
2. Each species (and gender) is given a score range for each drive (ex. 1-10)
3. Each individual animal's drives might be somewhat randomized, and will gradually change over the course of a single game.
4. The animals are programmed with SIMPLE behaviors that they attempt to perform when over threshholds of certain drives, and moreso, prioritize the higher drive-deficit behaviors.
5. There are areas of each map invisibly flagged for certain behaviors/drives per species. Ex. multiple sleeping sites for deer, meadows each marked for deer feeding, or den sites for bears; areas animals will go to drink; areas claimable as territory, etc. It's possible that some of THIS is already implemented, as I've never seen deer feeding in forests--only fields, etc.

Example time! Let's say only TWO new animations are created for deer species: antler-rubbing, and fighting other bucks.

Our game starts, and this one buck (let's name him Fred) starts wandering the map. His hunger & thirst are low. He isn't tired (sleep drive's deficit is low). So he starts wandering toward the nearest invisible marker that's noted to be claimable by Whitetail deer as Territory. He starts to rub antlers on trees now and again around this area, because that's what bucks fulfilling Territory drive do.

Eventually he starts to feel the mating drive spike, and antler-rubbing has lowered the Territory drive, so he wanders (sticking to his claimed territory) making Grunt calls now and again. Another buck with territory drive comes trotting in to meet him, and the two fight. The other buck loses, runs off, and--because the other buck's territory drive is also lowered/satisfied--he's unlikely to mindlessly repeat this behavior.

Fred's calls and scents have now attracted a wandering "mating instinct" doe, who now comes into his territory. Fred follows her around until he gets hungry, and goes off to graze.


As hunters, as we wander through the game ourselves, instead of just any animals being anywhere, we could find bears actually fishing salmon at rivers, then wandering off to sleep; wolves spending some time around a den rather than just chasing everything they come across--hunting only when hungry... Deer would ignore calls if they were too tired or too focused on food, etc. It would add an INCREDIBLE amount of complexity to the game without a whole lot of actual work.

So, in summary:

- Create list of drives that fluctuate
- Link behaviors and locations into each drive, per species
- Congratulations, incredible animal complexity

I hope this makes sense, and I hope it gets read and considered, if only for a small bit of inspiration as to improvement on the current level of detail in the animal behavior.
User avatar
deerman30
Tracker
Posts: 187
Joined: June 6th, 2015, 12:20 am
Contact:

Re: Animal AI - Complex Behavior With Simple Implementation

Post by deerman30 »

This does sound like a good idea towards animal AI, but how far can the devs take it?


I Love Big Racks
Post Reply

Return to “Animal Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest