Author Topic: AI behaviour  (Read 1108 times)

Offline peter

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
AI behaviour
« on: August 08, 2006, 05:43:28 PM »
What needs improving about the AI?

 My most recent patch (revision 8, in the Files section on the yahoo group) made some changes to AI repair skill use.  (now they do First Aid, General Repair, Medicine, Biotech, Mecha Repair, in that order).

 The AI is now good at selecting a weapon and an appropriate missile burst size.  They love to use BRUTAL BLAST weapons.

 The main silly thing is firing 3/4 of the missiles from a Heavy Assault Pack at a single un-armoured target as soon as it's barely in range.  So the AI could really use SWARM weapons a lot better.  And giving some consideration to how much of a threat the target is, and whether there's anything else to shoot at, should influence whether they fire most of their missiles at once at it.  The missile firing decisions work well for mecha combat, where there is the opportunity to reload between fights, and a laser rifle + calliope + heavy assault pack won't be your only weapons.  For enemy AI, it works well to fire big bursts, because they'll die quickly.

 One possible direction would be to have the AI decide on a strategy for killing something:  Either strip the armor down with lots of light weapons, or with (BRUTAL) blast attacks, or punch through the armor, either with high damage or armorpiercing weapons.  For this to work well, the AI would have to consider its weapons while choosing its target, rather than  1. choose target, 2. choose weapon, 3. choose BV/called shot/...

 So yeah, the AI should look at the target when deciding how to attack.  A called shot at the body when they're down to one hit point, but they don't have any body damage, isn't a good plan.  I've resisted making the AI head-hunt, since I think it would be _very_ effective, and very lethal in personal combat against just-starting characters without good dodge skill or good armor.   It would also be killer against head-cockpit mecha.  I mean, all it takes to kill an Ovaknight is a good sensor and attack skill, a Gajira heavy missile, and a called shot to the head.  With some Spot Weakness skill, even Haywire missiles work well for head shots, esp. against lighter mecha like a Corsair or Century.

 The AI's movement decisions are not always great, but they could improve with more specific orders.  And I don't have much idea how to make it better.  I haven't looked at the hotmap and movement heuristics much.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
AI behaviour
« Reply #1 on: August 09, 2006, 12:22:59 AM »
Quoting: peter
What needs improving about the AI?

Here are some things that it doesn't do yet:
- Open doors (if the NPC has hands)
- NPCs other than lancemates don't use their repair skills
- no-one uses medicine

Offline peter

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
AI behaviour
« Reply #2 on: August 09, 2006, 01:01:51 AM »
Quoting: Joseph Hewitt
no-one uses medicine


 Yes they do.  Unless you changed it to stop lancemates from reviving dead lancemates with 100% success rate.

  My latest changes make lancemates smarter about medicine, so they don't wast MP trying to cure status ailments when they will fail (e.g. cyber malfunctions, or, with low medicine skill, poisoning.)

 Good suggestion on doors...

Offline draconuszero

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
AI behaviour
« Reply #3 on: August 09, 2006, 01:40:58 AM »
Alternatives to opening the doors if they have no hands could be to bash it in, but well that might kinda be a bit awkward to see a high-int lancemate/pet just crashing through the entire map just to follow you.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
AI behaviour
« Reply #4 on: August 09, 2006, 02:16:48 AM »
Quoting: peter
Yes they do. Unless you changed it to stop lancemates from reviving dead lancemates with 100% success rate.

What I meant to say was, no-one uses pills. I haven't changed anything about the medicine skill.

Offline macksting

  • Hero Member
  • *****
  • Posts: 1085
    • View Profile
    • http://forums.wintercomic.com
AI behaviour
« Reply #5 on: August 09, 2006, 03:37:37 AM »
On the gate crashing note:
Wouldn't the game be more terrifying if, after you close the door between you and the Berserker, it started smashing and plasing the door down?
Sounds like something I'd like to see.

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
AI behaviour
« Reply #6 on: August 09, 2006, 04:21:49 AM »
Agreed. Opening doors for some, smashing them for others.

Offline peter

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
AI behaviour
« Reply #7 on: August 09, 2006, 05:19:04 AM »
So how should we implement this?  Some AI can go through doors (one way or another), and some can't (their attacks are too weak for it to be effective, or they're really stupid: out of sight out of mind).  Ones that can't go through doors would use the current path-finding code.

 AIs that can go through doors will treat doors as if they aren't obstacles, for the purposes of path-finding.  When they actually get to them, they have to open or break them.

 AIs that "can't go through doors" could still attack doors if they had nothing else to do, and some reason to believe there was an enemy on the other side.  OTOH, some monsters should just be happy to be left alone.  Most monsters aren't getting payed to kill the PC, they just don't like intruders.  Hunter synths are another story, and gremlins are out to make trouble...

 Should dungeon monsters know and use secret or locked doors?  Maybe only when the player doesn't have LOS on the door?  (There's a peep-hole so they can see if anyone's outside...)

Offline Anticheese

  • Hero Member
  • *****
  • Posts: 651
    • View Profile
AI behaviour
« Reply #8 on: August 09, 2006, 05:28:31 AM »
I think that dungeon mosters should only be able to use doors if they are capable of doing so, A rat cant and a hunter synth's mind is clouded by bloodlust, But in saying that most denizens have been in there for a long time and would know the map like the back of their hand, So if they hear things (Gunfire, Combat, Etc) or see a corpse of their comerads (Poor Ratley, he was a good friend) they might scout out a few adjacent rooms to their "Home"

I like the idea of monsters breaking down doors also, It would add a great element to the game and A.I

Offline Joseph Hewitt

  • Administrator
  • Hero Member
  • *****
  • Posts: 2552
    • View Profile
    • http://www.gearheadrpg.com
AI behaviour
« Reply #9 on: August 09, 2006, 05:43:25 AM »
Quoting: peter
Should dungeon monsters know and use secret or locked doors? Maybe only when the player doesn't have LOS on the door?

Aha! NPCs can't open doors yet, but this is something that's already done! If you check the Meta1.txt file, you'll see that there's a special script line "NPCOpenDoor". This is the script that's supposed to be used when a NPC tries to open the door, so it will be possible to define this behavior of doors on a by-door basis.

The big problem, I think, will be altering the hotmap procedure so some NPCs treat doors like walls and some treat them like spaces.

Offline Tung Nguyen

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • http://tunginobi.spheredev.org/
AI behaviour
« Reply #10 on: August 09, 2006, 09:22:27 AM »
That's going to be tricky, the hotmap business. Without extremely well-tuned senses, NPCs shouldn't be able to tell exactly what location the player is at when doors are closed between them.

Do enemies remember the last place they saw the player character if the PC goes out of view?

And do lancemates still run after the PC in safe zones? They should conserve stamina for when it's needed. I believe they should even refrain from running unless they are planning to rush enemies, or if they're in bad shape and need to escape.

Offline macksting

  • Hero Member
  • *****
  • Posts: 1085
    • View Profile
    • http://forums.wintercomic.com
AI behaviour
« Reply #11 on: August 09, 2006, 09:11:47 PM »
Is it possible to set it on a monster-by-monster basis, just a little feature of the monster (doorspace = 0) or something? Just program a basic check procedure into the pathing?

...for that matter, is it possible to fix that on the fly, such as having a command to your lancemates that says "Don't open doors" set doorspace to 0 if it's usually 1?

Or whatever. I ain't no programmer. :)

Why is it that Guardians really book it all over the map, anyway?

Offline peter

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
AI behaviour
« Reply #12 on: August 10, 2006, 02:47:12 AM »
Quoting: macksting
Is it possible to set it on a monster-by-monster basis

 Yeah, it would just be another attributed, like their name, the PC's  reaction score with them, their stamina, etc. etc.  The hard part is putting checks of that attribute into the code all over the place.

Quoting: macksting
Why is it that Guardians really book it all over the map, anyway?

They have good speed, and lots of stamina (Athletics 5).  And they have Weightlifting, so they're not encumbered.   A guardian would make an _awesome_ lancemate, if you can overlook their low knowledge stat (10).  They have rank 10 in all mecha combat skills, and rank 12 in all personal attack skills (rank 10 in Dodge).  They have good Initiative and Spot Weakness, too.  NPC archetypes are defined in Series/ANPCdefault.txt, BTW.

Offline macksting

  • Hero Member
  • *****
  • Posts: 1085
    • View Profile
    • http://forums.wintercomic.com
AI behaviour
« Reply #13 on: August 10, 2006, 09:49:26 PM »
That would explain it. So when I play the little two-guns investigator of many skills, I'm playing the newcomer-maverick in the force, who can barely lift the armor but could pick an apple off the head of a Harpy.

How cute. :)

So pathing is scattered all through the code? Or where else would you need the checks?

Offline peter

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
AI behaviour
« Reply #14 on: August 10, 2006, 10:09:54 PM »
Quoting: macksting
So pathing is scattered all through the code? Or where else would you need the checks?


 I think it's all in aibrain.pp.  I had a look at the code yesterday, and the main problem is that if you change how IsObstacle works, you have to change all the other places that call it.  And stuff like that.  There's no one place you can put in "if this AI can open doors, this isn't an obstacle".

 I don't yet fully understand the whole hotmap algorithm gearhead AI uses, so that doesn't help...  I think I have an idea of what it's for, but I don't know the details of what the numbers mean.