ID:265099
 
In one of my projects, I've finished enough of the game engine that I can actually add some objective! So far, the only playable char is a red fox. In light of that, I created a rodent that the fox can chase. So far, the rodent looks like this:
  • Whenever he moves, he leaves tracks. These stay around for quite some time before they fade away, making it easier for Mr. Fox to find where he has gone.
  • If he is unbothered, he wanders randomly. This I certianly want to change; I want this rodent to carry out normal rodent-like behaviours.
  • If the fox approaches, he runs! He picks the fastest path away from the fox, and runs it untill he is a safe distance away. He's a deal faster then the fox is, so he has a bit of an advantage there. However, he is awefully slow in the river and cannot go through trees at all, while the fox can at least go through them at a reduced speed. I can tell you, this does not need much improvement! The rodent is very, very fun to chase.


Can you help me plan out rodent-like behaviours to add to this animal? I would be very much pleased if you would help me out, as realism is important to this game. :o)

-Lord of Water
I think you might have some success implementing these behaviors:

  • Foraging: A rodent will search for food until it eats its fill, or for food to bring back to its nest. This means "smelling" food and heading in its general direction, and also avoiding areas where the rodent has been before. (If they collect food, they should also avoid foraging food from their own nest, which is just stupid. They should also avoid others' nests unless abandoned.)
  • Nesting: A rodent will tend to hole up somewhere reasonably out of the way and safe. Many gather food in burrows.

    I think those are the real basics. Many rodents tend not to be especially social, I would think, so you might have small clans here and there but as a rule they'd probably be indifferent to other rodents.

    Lummox JR
Hack n' Slash action! : Like Itchy & Scratchy!

Anvil Dropping: Guess

Here are some serious ones:

Droppings
Rubbing against trees/bushes
Scurrying - Moving from tree to tree to aviod being detected

-S
Basically when you talk about adding realism AI to a mob its really only a matter of how much perception you want to add, and what other objs/mobs are in that mob's perception to interact with and effect outcome.

I've have experience programming my own AI-state machines before, 1st in Qbasic, and later in C. The method I'd suggest using is what I call, the Action/Reaction List.
List all the actions on one side of the list you wish your rodent to perform. The across from that list all the reactions as a result of that, or different kinds of reactions that can take place, sometimes just putting in random variables helps in this matter. For the rodent its simple you have a single mob, with all these what I call (Perception Variables), and then you have the world, everything that the rodent can interact with. The more world items the rats can interact with and effect to more realism you get.

For basic Artificial Life demos most people have a world time that decreses a hunger, need for rest, and thirst variable. I use this in my game Kemet at the moment, but mostly only effects players, but can be applied to other computer controlled mobs as ewll. The mobs in these worlds are able to move around objects, and if they get close to some they like/dislike you can just (Target = Rodent ++) or (Target = Rodent --) to chase after or runaway from. Also something to set are realistic limits that cause a action. Like you could make a rat for example when its health is close to dying that it will flee at all cost. Or on the other hand you could make a rat start looking for food onces its hunger level reaches a certain limit. Later if still no food is found you can make the next limit cause the rat to fight whatever gets in it's way to get food as the ray is now starving. The more AI states you create here the more realistic yet complex your coding gets. Because say a rat is in its hunger state, so its looking for food, it comes to a river, but a tree is blocknig both sides of the rat next to the river. It then turns into starving state. Now you must ask yourself, does the rat attempt to cross the river and drown itself? Or does it retrace a few steps backwards turn right or left(randomized) and then head forward a few spaces and then head in the direction of the move on the other side of the river until it either starves to death or finds a way across the river wihtout dying.

Your not really dealing with true AI in games even those thats what we call it, but your making AL which is Artificial Life and simulation. When dealing with AL think along these lines: Mob->Condition Variables->World->Objects in that World->Interaction between Objects in that World, and the Conditional Variables of the Mob. Also for more complex realism, you can make interaction between other mobs, like if player run away, if animal similar in size attack. And interaction between objects. Like the mob gets food from a trap, when the food is taken from the area, a trap is sprung which causes the mob to loose motion and the ability to escape.

Much babble here, but there should be some patterns you see here that you can use when programming AL. I've been researching both AI and AL and its a past hobby of mine. Perhaps later I'll make an AL demo that has some of the items I've listed above, because seeing in action is easier to understand sometimes that just reading about it.

LJR
In response to Sariat
i've noticed that my rat usually follows the same path that it came from, when going back somewhere. I.E. if that path is reasonable, it should not follow the fastest one, but the one it knows is safe.

she usually pushes the stuff around in her pen, so the rodent could do something like that. Instead of gathering food, the rodent would probably bury it, which would take time to do and time to undo.

as for droppings, they usually poop in the same place, usually mines water (that would taste nasty).

i've seen her steal off a person's plate before, so you could include that :)
In response to Airson
It would indeed be fun to have rat tribes invade the Humans' Lodge area, when that is added in. Imagine five or nine rats sneaking in through windows and running around wildly. Joe, get your gun!

-LoW
In response to LordJR
LordJR wrote:

Much babble here, but there should be some patterns you see here that you can use when programming AL. I've been researching both AI and AL and its a past hobby of mine. Perhaps later I'll make an AL demo that has some of the items I've listed above, because seeing in action is easier to understand sometimes that just reading about it.

LJR

Can you recommend good reference material (books/web pages) on AI in games? I'm trying to learn more on the subject.

Thanks!
In response to Dramstud