PDA

View Full Version : Better Aircraft Behavior Experiment


LoBlo
06-01-06, 07:27 PM
I'm trying to improve the AAW behavior of fighters like the CVN escorts (Migs and F14/F18). I've modifed the FighterEvade Doctrine as an experiment to see if they're behavior is any better... trying to get them to vector in and attack planes that maybe threatening friendly ships.

What I've done is to create a new doctrine called "Interceptor" for the fighters and tried some changes. So far here's what I've tried with the doctrine to see if its an improvement:


; $Header: FighterEvade.txt Wed Apr 23 16:04:39 EDT 2003 $
; $Revision: 1 $
; $Copyrt1: Copyright (c) 2003, Sonalysts, Inc. All rights reserved. $
;
; FighterEvade
; LoBlo attempted Edits,June 2006
; attempting to script better anti-air behavior from interceptors to make them better protectors
; currently untested
; Set Tactic
IF NEWTRACK THEN {
; AAM or SAM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "AAM" OR TgtMissileClass "SAM" ) THEN {
SETTACTIC "AirEvadeMissile"
} ENDIF
; SSM or ASM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "ASM" OR TgtMissileClass "SSM" ) THEN {
ATTACKBEST
} ENDIF

;What about enemy fighter response?
IF TgtClass $= "AIR" AND ( TgtID $= "HOSTILE" OR ( TgtID $= "UAE" ) OR ( TgtID $= "UPD" ) ) THEN {
ATTACKBEST
} ENDIF
} ENDIF


I'm not sure if this improves Interceptor/Fighter escort behavior though. The next step that I'll probably try is to script some behavior to set better intercept course and speeds instead of planes just waiting for an enemy to get into firing range they would actively set up some intercept courses and then fire... that's the next step anyway.

If anyone tries out the above doctrine give some feedback. Better? Worse? No Change really?

thx,
lb

LuftWolf
06-01-06, 07:41 PM
"AttackBest" is the command to fire a weapon if those conditions are met. To the best of my knowledge, it doesn't include any persuit logic, so you'll have to include commands that reference the ranges of the weapons to have them fire intelligently.

So I'd add something like IF TgtClass $= "Air" AND tgtID $= "Hostile" THEN intercept/ IF ( tgtrng <= AttackRng ) THEN ATTACKBEST ENDIF ENDIF.

I haven't done much with the non-asw functions of the aircraft AI, but I do know that the Sim seems to excert a lot of control over them, because they do things that are not scripted AT ALL in the doctrines, like attack ships and other aircraft, and drop sonobuoys.

PS Intercept is a function that automatically sets an intercept course for the target.

PPS I'd also use the default platform doctrine to reference a target doctrine for these features, and create a priority structure for all the commands.

PPPS If you want your interceptors to shoot down incoming vampires, make sure you enable missiles as legit targets in your database for those air launched missiles.

LoBlo
06-01-06, 07:56 PM
EDIT: The doctrine below isn't working right yet. Don't use it yet.

Thanks for the tips. Yeah, I've noticed that sometimes fighters engage surface ships with HARMS and sometimes they don't. Sometimes they actively engage a target and sometimes they loiter. Its all really aimless without any discernable logic to why and when.

Thanks for the doctrine tips. I'm not really a programmer. How about this then, per your suggestions


; $Header: FighterEvade.txt Wed Apr 23 16:04:39 EDT 2003 $
; $Revision: 1 $
; $Copyrt1: Copyright (c) 2003, Sonalysts, Inc. All rights reserved. $
;
; FighterEvade
; LoBlo attempted Edits,June 2006
; attempting to script better anti-air behavior from interceptors to make them better protectors
; currently untested
; Set Tactic
IF NEWTRACK THEN {
; AAM or SAM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "AAM" OR TgtMissileClass "SAM" ) THEN {
SETTACTIC "AirEvadeMissile"
} ENDIF
; SSM or ASM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "ASM" OR TgtMissileClass "SSM" ) THEN {
ATTACKBEST
} ENDIF

;What about enemy fighter response?
IF TgtClass $= "AIR" AND ( TgtID $= "HOSTILE" OR ( TgtID $= "UAE" ) OR ( TgtID $= "UPD" ) ) THEN {
Intercept
IF (tgtrng <= AttackRng) THEN {
ATTACKBEST
} ENDIF
} ENDIF


Also...
PPS I'd also use the default platform doctrine to reference a target doctrine for these features, and create a priority structure for all the commands

Is that a better method then just creating all behavior in one .txt file without SETTATICS?

thx

LuftWolf
06-01-06, 08:01 PM
The problem is, if you don't use that method, than the all of the target referencing commands become non-functional or problematic, because the platform doctrine often can be refering to many different targets. In general, its best to only use the platform doctrine in DW to reference the NEWTRACK variable and then assign a target doctrine using some conditions to decide the appropriate assignment. Then, using the priority structure, you can allow the platform to intelligently manage multiple contacts.

So, in other words, you have to start over somewhat if you want it to work.

Also, make sure you watch your whitespace and spacing.

Cheers,
David

LoBlo
06-01-06, 08:16 PM
I'll see what I can come up with then. Definately WIP.

thx.

XabbaRus
06-02-06, 05:14 PM
Good luck, hope you can figure this out. AI aircraft performance has always bugged me.

LoBlo
06-02-06, 09:55 PM
EDIT: Corrections made
Ok, here's what I'm testing so far and its shown some marginal improvement over current behavior. First is a modification to the FighterEvade doctrine that will call upon a "AirIntercept" Doctrine when an enemy plane is detected.



; $Header: FighterEvade.txt Wed Apr 23 16:04:39 EDT 2003 $
; $Revision: 1 $
; $Copyrt1: Copyright (c) 2003, Sonalysts, Inc. All rights reserved. $
;
; FighterEvade
; LoBlo attempted Edits,June 2006
; attempting to script better anti-air behavior from interceptors to make them better protectors
; currently untested
; Set Tactic
IF NEWTRACK THEN {
; AAM or SAM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "AAM" OR TgtMissileClass "SAM" ) THEN {
SETTACTIC "AirEvadeMissile"
} ENDIF
; Enemy fighter?
IF TgtClass $= "AIR" AND ( TgtID $= "HOSTILE" OR ( TgtID $= "UAE" ) OR ( TgtID $= "UPD" ) ) THEN {
SETTACTIC "AirIntercept"
} ENDIF
; SSM or ASM Missile?
IF TgtClass $= "MISSILE" AND ( TgtMissileClass "ASM" OR TgtMissileClass "SSM" ) THEN {
SETTACTIC "AirIntercept"
} ENDIF
} ENDIF


The AirIntercept Doctrine is then called (if an enemy plane is detected) and hopefully the AirIntercept will act in the following ways
3. A intercept course to the enemy plane is plotted and engines are revs to 85% trottle.
4. When within attack range missiles are released
5. After missile release, a evasion route is plotted.


; By LoBlo, attempt to script better intercept and attack behavior from fighters
; Intercept incoming aircraft
IF NOT LostTrack THEN {
IF TgtClass $= "AIR" AND ( TgtID $= "HOSTILE" OR ( TgtID $= "UAE" ) OR ( TgtID $= "UPD" ) ) THEN {
SetSpd Maxspd / 1.15
Intercept
IF ( TgtRng <= AttackRng ) THEN {
ATTACKBEST
} ENDIF
} ENDIF
} ENDIF
; Evasion after firing
IF WeaponAway THEN {
SteerAway
SetSpd Maxspd / 1.1
} ENDIF


That's the theory anyway, it accomplishes it with moderate consistency on the small scale battles that I've been testing, though there are some problems. The main one being that the evasion route after engaging the target, are not taken most of the time and the planes will still close on the target after their weapons have been released, where they should better evade to avoid return fire... WIP:hmm:

If anyone would like to give it a try themselves feedback would be appreciated.

lb

LoBlo
06-02-06, 10:18 PM
On a side note:

Those F14 are looking pretty fierce now with the most aggressive attacks in the game. The 100+nm range of those Phoenix missiles + Mach 3+ speed equal GROWL. :huh: :yep:

LuftWolf
06-03-06, 12:43 AM
If anyone would like to give it a try themselves

I've put this on my list of things to fix for LWAMI4.

It is interesting how little actually has to be done sometimes to get major effects from the AI, so my style for the AI is to keep it consistent and let the SimEngine do as much of the decision making work as possible.

LuftWolf
06-03-06, 06:36 AM
The main one being that the evasion route after engaging the target, are not taken most of the time and the planes will still close on the target after their weapons have been released, where they should better evade to avoid return fire... WIP

Instead of using "Engaging" in the last conditional, use "WeaponAway".

LuftWolf
06-03-06, 06:41 AM
TgtRng <$= AttackRng

This should not be a $=, since the string is not being tested for, but rather the value held in the variable taken from the database.

LoBlo
06-03-06, 07:29 AM
So that's why my fighters weren't engaging consistently... thanks

after further testing, the fighter behavior is..... still darn bizzare. With the most bizzare coming whenever a fighter expends its missile load, it will go Kamikaze on reckless intercepts util its closes to point blank, then twirl around to eventually fall into the ocean...:down: :nope: :doh:

Its obvious the reason why...but how to fix it?...:hmm:

LuftWolf
06-03-06, 07:37 AM
Interesting.

I would add a minimum range to the intercept command conditional, like 1/4 of AttackRng. If that doesn't work, try using an absolute value.

Also, try adding If AttackRng > 0 to test for the results of going winchester on that variable. (or better yet, use the Debugviewer and DebugOut "" commands, which is really necessary for doctrine scripting at this level to figure out what's going on)

Ah, isn't modding SO much fun?

LoBlo
06-03-06, 07:52 AM
Fun as in "my head hurts" fun?:lol: j/k...actually not really.:88) I just can't stand to see such illogical AI behavior, ruins my "simulation" experience. :(

I'll try the minimal range to see if it helps the behavior... but this brings up an interesting question...

... How to get planes to automatically return to base after expending their weapons?... :hmm:... this may be biting off more than I can chew. I'll have to cogitate on this one for a while...

LuftWolf
06-03-06, 01:14 PM
Fun as in "my head hurts" fun?:lol: j/k...actually not really.:88) I just can't stand to see such illogical AI behavior, ruins my "simulation" experience. :(

I'll try the minimal range to see if it helps the behavior... but this brings up an interesting question...

... How to get planes to automatically return to base after expending their weapons?... :hmm:... this may be biting off more than I can chew. I'll have to cogitate on this one for a while...

There is no way to do this in the doctrines...

You can keep track of how many times the aircraft fires, but this is only useful if you make a unique doctrine for each aircraft.

Molon Labe
06-03-06, 01:52 PM
Just a suggestion...

Take a look at AAM behavior; they tend to enable right away and shoot down wingmen instead of the baddies.

LoBlo
06-03-06, 02:30 PM
Thanks for the input. I'll look into it. I've noticed that myself a few times when a missile intended for the enemy is locking onto and destroying friendlys. I've also noticed how Evasive maneuvers aren't triggered until the missile is right on top of the fighter. I'll be looking to change this somehow eventually.

What I'm working on currently is kindof perplexing. For some reason, the AttackBest command is causing the planes to close distances and engae with their... guns!:doh: What the heck....

... such a strange engine this is, where half the behavior is hidden in the engine and the other half open in the doctrines. I wish we had more access to the AttackBest logic because it certain does produce some strange behavior sometimes.

LoBlo
06-04-06, 09:23 AM
After throughly investigating this weird, "AttackBest Not working" bug I'm a little bit back to square one.

I've put some DebugOuts into the doctrine file to see what's triggering and I see that AttackBest If structures are triggering, but yet the result is no missile fire...:damn:

... back to the drawing board...:88)
...WIP...this will probably take awhile to figure out.:doh:

Here's the current version of the AirIntercept.txt doctrine that I'm testing if anyone would like to give it a go.

; By LoBlo, attempt to script better intercept and attack behavior from fighters
; Evasion after firing
IF WeaponAway THEN {
DebugOut "Weapons fired, evading now"
SteerAway
SetSpd Maxspd / 1.25
; Intercept incoming aircraft
} ELSEIF NOT LostTrack AND TgtClass $= "AIR" AND ( TgtID $= "HOSTILE" OR ( TgtID $= "UAE" ) OR ( TgtID $= "UPD" ) ) THEN {
DebugOut "Intercept Course"
SetSpd Maxspd / 1.15
Intercept
; Attack when in range
IF TgtRng < ( AttackRng / 1.1 ) THEN {
AttackBest
DebugOut "Firing"
} ENDIF
} ENDIF


Putting a "If AttackRng >= 0" condition at the beginning of the doctrine has not seemed to repair the behavior...
As far as indiffinate intercept courses... I'm thinking about leaving the "intercept" command in a Init structure so that an Intercept is plotted during the first detection but not indefinantly.

WIP
lb

LuftWolf
06-04-06, 10:51 PM
Usually there is some basic principle that one takes for granted that works differently than expected, and that is the source of the problems.

Once you find that, it becomes easy to see what's happening and why, although sometimes the solution presented makes the work much less appealing than it was when you started the project.