SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   DW Mod Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=196)
-   -   Better Aircraft Behavior Experiment (https://www.subsim.com/radioroom/showthread.php?t=93941)

LoBlo 06-01-06 07:27 PM

Better Aircraft Behavior Experiment
 
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:

Code:


; $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

Code:


; $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...
Quote:

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.


Code:


; $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.

Code:


; 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

Quote:

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

Quote:

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

Quote:

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

Quote:

Originally Posted by LoBlo
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.


All times are GMT -5. The time now is 01:33 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.