Terasology / Behaviors

Store for an assortment of behaviors that can be applied to creatures
https://terasology.github.io/Behaviors
6 stars 18 forks source link

Developing AI "Intelligent" Behaviour #110

Open Jacob-Rueckert opened 2 years ago

Jacob-Rueckert commented 2 years ago

In order to improve in Intelligent AI behaviour this issue is meant to give examples of intelligent behaviour. I already made an example tree for an not so intelligent behaviour like a sheep.

Tree Stupid Sheep

This is based on the high level overview Tree from https://github.com/Terasology/Behaviors/wiki/High-Level-Overview For me the line to make a entity feeling intelligent isnt the behaviour to the player certanly. So as you can see a stupid sheep will follow the player no matter what. That in my mind is non intelligent behaviour. What if a wolf shows up and kills the sheep. Would it still follow the player? I dont think so. Although the logic of non intelligent behaviour towards the player is restricted to peacefull entitys. If we think about modern shooters, hostile entitys will behave intelligent, like seeking cover when shot at or firing grenades when youre in cover. Still i wouldnt restrict such behaviours towards the player and try to make a interacting approach like the sheep-wolf example.

Therefore environmental behaviour is what i want to mostly concentrate in intelligent behaviour. What can be environmental conditions is the first to think about:

  1. Day & Night Cycle
  2. Weather Conditions (Rain, Mist, Sunshine, Snow)
  3. Events (Forestfire, Thunderstrike, Avalanches, Wolf Hunt, Explosions)
  4. Sounds ( Walking, Dying Sounds, Block Break Sounds, Firework)
  5. Entity Visability (Seeing an Entity (not Player) )

All of the above are the first one coming to mind and which i think are able to implement in someway in the current behaviour system. For sake of workflow i will ad some written concepts since making the visual trees right now is laborious. IWolf , Sheep, Rabbit, Bear) Intelligent

skaldarnar commented 2 years ago

Discussed in a call on Discord with @Jacob-Rueckert @skaldarnar and @jdrueckert :

Until Friday, November 11:

Until next Tuesday, November 15:

Jacob-Rueckert commented 2 years ago

I made new subtrees for the suggested Timid, Chaser and Guard I added in parathesis behind the subtree an possible use case for these subtrees.

Lets start with Timid. I believe a rabbit wouldnt be scared from a fly or an caterpillar. Therefore we first need to realise which Entity is nearby and if the rabbit would be scared from it. Also a Rabbit wouldnt instantly run from the Entity. This is an usual behaviour among animals. Only when they reach a certain range or make a fast / dangerous move, timid creatures would start to flee and they wouldnt stop as long as the Entity is still in a certain range. Therefore you maybe need to add a second configuration for "Entity Near". One which is the range the timid Entity starts fleeing, and one for the time / range / visibility of the scary Entity so its stops fleeing.
Timid Rabbit

Next one is the Guard. I would specify my image of a guard not as a stational but as an dynamic one. Therefore the example of a sheep dog. If a herd is moving his first priority should be staying near to the flock. A Guard wouldnt attack just out of visibility. Therefore i would make an state "Alert" in which we can add sounds / animations to intimidate an enemy entity. I declare nemesis in this case since players might be fine for a sheep dog but bears / wolfs wouldnt. So we need to declare a certain group of entitys the sheep dog is hostile against while hes peacefull to any other entity. Lastly we have to get back into a alert spot while the nemesis is still nearby but not dead. Guard

Lastly the Chaser is the same as Guard and Timid. We look out for the nemesis and if hes in range. If hes not, the chaser trys to get in range and checks if he can attack. This will be continiousily iterated till the nemesis is dead. Since we dont have to care about a home / guard spot we dont have to implement an get_home behaviour in chaser it self. Although a wolf would probably have an own den so he shoud have one. But not particulary in chaser itself. Chaser