Enemy AI
-
- Bounty Hunter
- Posts: 130
- Joined: Wed Aug 01, 2007 1:32 am
- Location: Here
- Contact:
Enemy AI
Wouldn't it make more sense that if you damage someone enough they'll just run away? I just restarted a game and I already pulled a bunch of kills in the Llama. I understand in missions you need to kill the enemy, but in like random encounters to me it would make sense they would get their nose blooded some and run, unless you kill them quickly or chase them down
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Enemy AI
Supposedly, the AI script has provisions for that.
So I guess it's just not working right.
So I guess it's just not working right.
-
- Bounty Hunter
- Posts: 152
- Joined: Thu Sep 02, 2010 8:00 pm
Re: Enemy AI
While developing the autodocker, I did an experiment where I invoked other AI scripts instead of the autodocker. For instance, the BarrelRoll script worked beautifully. However, I noticed that some of the scripts did not do much, e.g. the evasion scripts did not evade. I did not know if I had used them incorrectly or if they were erroneous, and I did not have time to follow up on it. It might be a good idea if we quality check the various scripts.klauss wrote:Supposedly, the AI script has provisions for that.
So I guess it's just not working right.
-
- Bounty Hunter
- Posts: 152
- Joined: Thu Sep 02, 2010 8:00 pm
Re: Enemy AI
I just went through all the AI scripts in src/cmd/src/ai/hard_coded_scripts.h.breese wrote:It might be a good idea if we quality check the various scripts.
I found that the following scripts behave different than I would expect:
* AgressiveLoopAround: Moves towards the target and crashes into it.
* Kickstop: Does not stop.
* MatchVelocity: Does not move.
* RollFacePerpendicular: Does not roll.
* Takeoff/TakeoffEveryZig: Just moves straight ahead.
* VeerAway/VeerAwayITTS/VeerAndVectorAway/AfterburnVeerAndVectorAway: Moves towards the target and crashes into it. The AfterburnVeerAndTurnAway script seems to work though.
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Enemy AI
That's odd, many of those scripts are central to current AI - are you sure you just didn't know how to use them?
Because I would think, if they didn't work, most NPCs wouldn't either. MatchVelocity for instance is referenced in many xml ais.
Because I would think, if they didn't work, most NPCs wouldn't either. MatchVelocity for instance is referenced in many xml ais.
-
- Bounty Hunter
- Posts: 137
- Joined: Wed Apr 08, 2009 6:07 am
Re: Enemy AI
But does the ship actually try to match velocities? That could be hard to tell.klauss wrote:MatchVelocity for instance is referenced in many xml ais.
-
- Bounty Hunter
- Posts: 152
- Joined: Thu Sep 02, 2010 8:00 pm
Re: Enemy AI
On further investigation, it appears that MatchVelocity does work -- it just worked differently from what I had expected. The velocity it matches is the velocity of the target at the moment when the script is invoked. If the target changes velocity, the script will still try to match the initial velocity.klauss wrote:That's odd, many of those scripts are central to current AI - are you sure you just didn't know how to use them?
Because I would think, if they didn't work, most NPCs wouldn't either. MatchVelocity for instance is referenced in many xml ais.
I am positive that the veering scripts are erroneous. It appears that they are given a relative heading that they treat as an absolute heading.
As for the other scripts, who knows? I have simply described the observed behavior, and I find it hard to reconcile that with the names of the scripts. But the scripts could have bad names. Difficult to tell with the current level of code comments.
EDIT: I also noticed that most scripts, including those that work correctly, jitters/shakes when they face a target straight on.
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Enemy AI
Do we want to document that behavior, or fix it?breese wrote:On further investigation, it appears that MatchVelocity does work -- it just worked differently from what I had expected. The velocity it matches is the velocity of the target at the moment when the script is invoked. If the target changes velocity, the script will still try to match the initial velocity.
This is a nice oportunity for code review - if we made a patch, we could have it reviewed by the AI's authorbreese wrote:I am positive that the veering scripts are erroneous. It appears that they are given a relative heading that they treat as an absolute heading.
![Wink ;)](./images/smilies/icon_wink.gif)
This is a problem of the scheduling method, when units have low priority on the physics/AI scheduled, their movements are imprecise and it results in jitter.breese wrote:EDIT: I also noticed that most scripts, including those that work correctly, jitters/shakes when they face a target straight on.
I don't know if it's that bad - people do jitter
![Wink ;)](./images/smilies/icon_wink.gif)
-
- Elite
- Posts: 7243
- Joined: Mon Apr 18, 2005 2:40 pm
- Location: LS87, Buenos Aires, República Argentina
Re: Enemy AI
Speaking of AI, I'm getting a lot of this on the console:
That might indicate some AI issues.cannot find AI script FacePerpendicularFast
-
- Bounty Hunter
- Posts: 152
- Joined: Thu Sep 02, 2010 8:00 pm
Re: Enemy AI
Not sure. We should probably document it, and write a new script that continuously adjust the velocity.klauss wrote:Do we want to document that behavior, or fix it?
Well, these scripts have Parkinsons.klauss wrote:I don't know if it's that bad - people do jitter ;) - as long as it's moderate.
Regarding FacePerpendicularFast, this is an error in data/ai/events/bomber.agg.xml. It has a rule that refers to the script as "FacePerpendicularFast", but that is its C++ name, not its scripting name, which is "face perpendicular fast" (the name mapping can be found in src/cmd/ai/script.cpp). However, there is a comment above the rule that says that it is experimental. Maybe we should just delete the rule.
-
- Elite Venturer
- Posts: 753
- Joined: Sat Apr 15, 2006 2:40 am
- Location: chthonic safety
Re: Enemy AI
Looked there again. Those turned out to be built-ins, and the problem was... That's... awkward... ![Embarassed :oops:](./images/smilies/icon_redface.gif)
Added trivial patch in the bug-tracker.
![Embarassed :oops:](./images/smilies/icon_redface.gif)
Added trivial patch in the bug-tracker.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
-
- Elite
- Posts: 1567
- Joined: Tue Jan 26, 2010 2:03 am
Re: Enemy AI
patch should go up this week as well as a few other data related changes. Once its up let me know if it fixes the problem for everyone so I can close out the tracker report.
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo
-
- Merchant
- Posts: 42
- Joined: Tue Dec 22, 2009 9:16 pm
Re: Enemy AI
Whether or not an enemy that has been damaged should run would probably be determined by whom the enemy is. For example, the cultural bias for the Aera would be to fight to the bitter end. Military type ships doing missions to guard something would probably fight to the bitter end or until whatever they are protecting is out of danger. The ULN seem to go in for suicide attacks with smaller, possibly unarmed, units, since their objective is to crash into you, then they probably will not go for running much. Military type craft that have a mission to complete should normally not withdraw until the mission assigned is complete. However, Merchant Guild and other merchant vessels would most likely run at the first indication something is hostile to them. Zealots of a particular group, I think would tend to fight through also.
So when and whether or not a ship should run when x amount of damage is done is really a function of their mission requirements and mindset, not the amount of damage they have taken. Of course, there are limits to the complexity and variety of scripts and writing one for every race/situation is almost impossible.
So when and whether or not a ship should run when x amount of damage is done is really a function of their mission requirements and mindset, not the amount of damage they have taken. Of course, there are limits to the complexity and variety of scripts and writing one for every race/situation is almost impossible.
-
- Elite
- Posts: 1567
- Joined: Tue Jan 26, 2010 2:03 am
Re: Enemy AI
klauss added the patch so make sure to grab it off svn
Because of YOU Arbiter, MY kids? can't get enough gas. OR NIPPLE! How does that mkae you feeeel? ~ Halo