Creature AI

Discuss your creative projects: game development, writing, film making or any thing else, fantasy related or otherwise! Talk about art you like, display your own artwork or stories, or offer help and insight.
Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Rasmus
Ee Master
Posts: 714
Joined: Fri May 08, 2009 1:44 am
Location: Sweden
Contact:

Creature AI

Post by Rasmus »

So, I have been working out a quick layout for how monsters AI could work in Dungeon Master, 3D or not..

Start Sleeping:
When fatigue or hp < 25 %
When fear < 50 %
No enemies in sight
At least one follower awake and fatigue or hp > 5 %
(While eating, view and smell are reduced 100%)

Stop Sleeping:
When fatigue and hp >= 100 %
When food < 25 %
Friend nearby makes warning
Getting damaged

Start Eating:
When food < 25 %
No enemies in sight
When fear < 50 %
(While eating, view and smell are reduced 50%)

Stop Eating:
When food >= 100 %
Enemies in sight

Start Guarding:
No other friends are guarding
At least on friends are sleeping or eating
When food > 10 %
When fatigue > 10 %
(While guarding, view and smell are increased 50%)
When fear < 25 %

Stop Guarding:
When food < 10 %
When fatigue < 10 %
When enemies in sight (make warning)
No friends are sleeping or eating

Start Fleeing:
When enemies in sight and..
Enemy value (0% - 100%)
Fear value (0% - 100%)
when (Enemy value) * (Fear value) are higher than 75 %

Stop Fleeing:
When no enemies in sight
Enemy value (0% - 100%)
Fear value (0% - 100%)
when (Enemy value) * (Fear value) are lower than 40 %

Start Playing:
When bored > 75 %
When friends bored > 75 %

Stop playing:
When bored <= 0 %
When friends bored <= 0 %

Start Attacking:
when (Enemy value) * (100% - (Fear value)) are higher than 50 %

Stop Attacking:
when (Enemy value) * (Fear value) are higher than 75 %

Start Following Enemy (not attacking):
when (Enemy value) * (100% - (Fear value)) are higher than 25 %
(While following, view and smell are increased 50%)

End Following Enemy:
when (Enemy value) * (100% - (Fear value)) are lower than 5 %


Rang values (highest priority to do):
Fleeing 100
Attacking 85
Guarding 40
Eating 20
Sleeping 20
Playing 10
Following Enemy 10

These last values can always be changed depending on the monster type. And I think this is here the real AI comes into play by changing them a bit randomly and that the creatures maybe change them by him self by learning what works best for him..
User avatar
Rasmus
Ee Master
Posts: 714
Joined: Fri May 08, 2009 1:44 am
Location: Sweden
Contact:

Re: Creature AI

Post by Rasmus »

Any comments/improvment/new behaviours are welcome.. I must say that the game Dungeon Keeper 2 was some insperation when creating these behaviors :)
User avatar
Ameena
Wordweaver, Murafu Maker
Posts: 7517
Joined: Mon Mar 24, 2003 6:25 pm
Location: Here, where I am sitting!
Contact:

Re: Creature AI

Post by Ameena »

DK2? In that case, you missed out "Go to Torture Chamber"...or does that come under "Start playing"? ;)
______________________________________________
Ameena, self-declared Wordweaver, Beastmaker, Thoughtbringer, and great smegger of dungeon editing!
User avatar
Rasmus
Ee Master
Posts: 714
Joined: Fri May 08, 2009 1:44 am
Location: Sweden
Contact:

Re: Creature AI

Post by Rasmus »

Under start playing? Hahaha, I guess I could do some misstresses in thight leather dresses that whips those who deserve it :D
User avatar
ian_scho
High Lord
Posts: 2806
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Re: Creature AI

Post by ian_scho »

You have to define what 'Sight' is as well
For fleeing, you could base it on a percentage of individual health (some monsters have a lower value than others, therefore being more courageous), and enemies in sight of course. They 'should' rally even if the enemy are in sight though, me thinks, but then they'd run away again as soon as the enemy are near...
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Creature AI

Post by beowuuf »

Ok, looking as this properly, I'm torn how to respond. My instinct is that alot of monster needs and stats are far better abstracted than mandated. However, I also realise that the more you can create 'living' creatures that interact with the world independantly of the party/game, the more likely you are to great wonderful emergent gameplay instances.

I can imagine two Trolins standing at a door, both bored, playing around. One becomes less bored, goes back to guarding, the other tries to play but can't, so goes off for food. With the right accidental dialogue, it would suddenly seem like a brilliantly scripted set up to breaking through thedoor, when it would just be a natural occurence.

I like the non-resource draining stats that force the creature to interact or behave differently. Not sure about a hunger stat though, since that means that any active creature is slowly consuming the food the party will need later in the dungeon.

I think hunger and its priority (and in fact boredom and playing, which is a brilliant concept) should not have the same value, nor the same priority, for each creature. I know you've said the lower values can be swapped around, but I'd say that even more interesting is having these higher values swapping with lower. Creatures that either don't perceive or care less about their own safety than something else. For example, in DM some quirk of mechanics made it seem like giant scorpions got bored very easily, even if in the middle of combat. The thorn demons in DM2 didn't really care who was around, and seemed to always be grazing unless the party got too close. It made them seem territorial that they never ran from where you found them to be eating.

Also, I think the idea of seeding a 'wildcard' might be interesting. Having a very remote chance that a creature will go into a frenzy when very low on health, or just be cowardly and run after getting in a powerful blow. Might be interesting to have these blips set a flag so that creature takes on that trait. Also, might be interestign to also rarely have weak monsters become disoriented, so they lash out or move slower, rather than run off to sleep.

Anyway, cool AI ideas to start with!
User avatar
Zyx
DSA Master
Posts: 2592
Joined: Mon Jun 05, 2000 1:53 pm
Location: in the mind
Contact:

Re: Creature AI

Post by Zyx »

Interesting ideas! I'll try to find some time today to think about them.
User avatar
Ameena
Wordweaver, Murafu Maker
Posts: 7517
Joined: Mon Mar 24, 2003 6:25 pm
Location: Here, where I am sitting!
Contact:

Re: Creature AI

Post by Ameena »

With regard to Wuffy's mention that the monsters might end up eating food intended for players, that can be easily avoided by having them eat something else - hunks of rotting meat or something, which are flagged for monster consumption (as opposed to player consumption, though they might be player-edible too but poisonous or whatever). Or the player characters themselves could also be flagged as "monster-edible" - ie the mobs go hunting when they are hungry ;). Of course, it would depend on the species - stuff like undead are probably not gonna get hungry, and Screamers would probably just want a nice damp puddle to sit in or something ;).
______________________________________________
Ameena, self-declared Wordweaver, Beastmaker, Thoughtbringer, and great smegger of dungeon editing!
User avatar
beowuuf
Archmastiff
Posts: 20687
Joined: Sat Sep 16, 2000 2:00 pm
Location: Basingstoke, UK

Re: Creature AI

Post by beowuuf »

yeah yeah, just keep telling yourself screamers don't need warm bodies...
User avatar
Ameena
Wordweaver, Murafu Maker
Posts: 7517
Joined: Mon Mar 24, 2003 6:25 pm
Location: Here, where I am sitting!
Contact:

Re: Creature AI

Post by Ameena »

Lol well, I just figured seeing how they're plants and all ;).
But yeah, what I sort of missed specifically saying there (mainly 'cause I didn't think of it till halfway through the post) was that types of food could be tagged as "monster-edible", "player-edible", or both, so monsters will only go for food tagged for them, which would presumably include the player characters if that creature is carnivorous ;).
______________________________________________
Ameena, self-declared Wordweaver, Beastmaker, Thoughtbringer, and great smegger of dungeon editing!
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Re: Creature AI

Post by Bit »

Hehehe, now that's a nice idea - the dungeon as eco-system - keep the balance - spend a hero :D
User avatar
Rasmus
Ee Master
Posts: 714
Joined: Fri May 08, 2009 1:44 am
Location: Sweden
Contact:

Re: Creature AI

Post by Rasmus »

@ian_scho: I still uses all the stats from the original DM, and in this case I use a combination of the original "Bravery" from DM, and a new stat called "courage" (this one goes down when hit by others, and increases over time all depending on how high the bravary stat is). I also use a stat called "friendlyness", this also goes up and down depending if you fight them or not, ofcourse some creatures always fight you, but it is a good stat when having creatures fighting creatures, and also that a charm spell can be cast affecting this one :) Anyway, as it is now I multiply the courage and the friendlyness stats together to get a "fearvalue" that decides if the creature should be afraid of you or not. I have also added see-length and smell-length stats according to DM, these are also affected on what the creature are doing, if he is sleeping then they are zero, guarding increases them, playing and eating lower them.. These values also dependes on how friendly the creatures are towards you, if the friendly value are zero then they can see you (or care about you) at the max sight and smell values, but if the friendly stat are on 50 %, they only notice you at half length. I have inserted and tried this out, and it seems to work, but I think I will have to try them out at a little bit more extrem conditions to be sure. I may also add that if the enemys noticed you and they have free sight (no walls etc. in the way) they "rally" or get higher walking speed if that was what you meant :)

@beowuuf: I agree with you on the abstract part, I have tried to create a more advanced AI where the cretures learn their abilitys.. But that is way over my head, in this case I would prefere some stability in the programming so that later on the cretures really acts in a way I want them to (in general :)). I have inserted all of these behaviour I started the topic with and tried them out, as long as I have some random priority values and how fast they get hungry, sleepy etc. I can't predict what they are going to do next, even if they prefere doing one thing over another. And I guess this is okey.
You gave me an idea with the "two trolins". It shouldn't be so hard for me to insert a frustration behaviour. This one could be increase when "no one to play with", "no food to find", "if the party closes a door in front of them (max :))", "if the party lock in a fleeing enemy in a dead end", then they could take out their frustration on banging the door, throwing stuff around, getting damagevalues that could be either very low or very high.. I think this value also could affect the other values like getting tierd faster, do less "exploring" and more wander at radom etc. The 'wildcard' that you mentioned could be combined with the frustration and low hp, if everything goes at the opposite direction of the creatures will, then he can go berzerk at the heroes :D

About the food, as it is now I have only done so that if the screamers are hungry they just sit down where they are and lower their roots into the ground, I was also thinking about that the trolins for example could have unlimited food on them..
But ameena has a good point, I could add some food into the dungeon that only some creatures eat. Image lureing a bunch of trolins by throwing food in front of them untill they reach a pit, that you later on open :)
And ofcourse, if the trolins eat screamerslices, they would be enemies with them, therefore the killing should result in eating the screamerslices that just happend to fall of them :)

@bit: eco-system? Well I could insert Mophus, he could be multiplied and run around here and there in the dungeon being killed by anyone that doesn't like his apparance.. It would be like southpark "Oh no, you killed Mophus!" :D
User avatar
Hajo
Craftsman
Posts: 106
Joined: Tue Mar 02, 2010 11:33 am
Location: Between chair and keyboard

Re: Creature AI

Post by Hajo »

This makes me want to develop a "monster zoo tycoon" style ... sandbox or so. Most likely this stays a dream.
Post Reply