Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: FrikgFeek on July 18, 2016, 12:15:20 pm

Title: Feature Request: free-afterburner-use as an AI profile flag.
Post by: FrikgFeek on July 18, 2016, 12:15:20 pm
So as far as I understand the only way to get the AI to use afterburners freely atm is with an alter-ship-flag SEXP. Making free-afterburner-use an AI profile flag would make it much easier to have more helpful AI that can follow the player as he afterburns through waypoints or when attacking capships.
As a bonus it would also be helpful if you could also use ai.tbl Ai profiles overrides for this flag if you want to make certain classes without free-afterburner-use.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: General Battuta on July 18, 2016, 12:25:33 pm
Yes yes yes yes
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: mjn.mixael on July 18, 2016, 01:04:17 pm
 :yes:
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: Spoon on July 18, 2016, 03:45:50 pm
In what way is the afterburner currently restricted for ai usage? Waypoints (though they do set ETS to engine max) and?
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: FrikgFeek on July 18, 2016, 03:52:14 pm
A better question is in what way it isn't. AI will only use afterburners when attacking, but they will use them no matter how far away the fighters/invisible nav buoys they're "attacking" are.
If you order AI to "cover you", or guard any friendly ship they will not use afterburners to either get to that ship faster or keep up with you as you're afterburning.

The free-afterburner-use flag has existed for some time now but the only way to use it is to assign it as a ship flag through alter-ship-flag.

Currently, this flag still doesn't make AI use burners for "guarding" a ship but they will use them if you order them to form on your wing. Even this would be much better than having the AI constantly lag behind or having to manually create events that set this flag for every mission.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: General Battuta on July 18, 2016, 03:55:51 pm
In what way is the afterburner currently restricted for ai usage? Waypoints (though they do set ETS to engine max) and?

Escort orders, disarm orders, disable orders, 'cover me' orders I believe, basically everything that's not a plain attack order.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: AdmiralRalwood on July 18, 2016, 03:56:42 pm
With free-afterburner-use (which, as the OP notes, can only currently be set with the alter-ship-flag SEXP), the AI code will allow afterburners to be used when: attacking a big ship, flying to a target position, guarding a ship, and flying in formation. As far as I can tell (from searching for AIF_FREE_AFTERBURNER_USE), that list is exhaustive (although note that this is only additional situations allowed by free-afterburner-use; even without the flag, afterburners are allowed when attacking small craft, when evading, or after taking a hit).
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: Spoon on July 18, 2016, 03:59:35 pm
Now that I have been educated, I give this feature request a wholehearted +1
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: FrikgFeek on July 18, 2016, 04:25:25 pm
the AI code will allow afterburners to be used when:  guarding a ship,

Not quite.


Alter-ship-flag SEXP has been used to give alpha 2 free-use-afterburners. As you can see he will happily use them when ordered to "Form on my Wing" but when ordered to "Cover me" he'll stop.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: AdmiralRalwood on July 18, 2016, 04:36:19 pm
the AI code will allow afterburners to be used when:  guarding a ship,

Not quite.

[snip]

Alter-ship-flag SEXP has been used to give alpha 2 free-use-afterburners. As you can see he will happily use them when ordered to "Form on my Wing" but when ordered to "Cover me" he'll stop.
The AI needs to be at least 385 meters away from its goal point to use afterburners in guard mode; completely different logic is used when to decide to afterburn in formation flying.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: FrikgFeek on July 18, 2016, 04:42:26 pm
Interesting. So is there a way to make the AI use their burners when ordered to "cover" the player? Because from my testing ordering alpha 2 to "cover me" will not make him use his burners no matter how far away he is. And in the previously linked video he's at least 500m or so away from the player considering the starting distance is like almost 400.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: Admiral MS on July 18, 2016, 04:51:07 pm
Yeah, formation flying (form up on my wing and waypoint order for a wing) is something entirely different from approaching a target. The latter is just to burn until below a certain distance. Formation works using average speeds that are a bit of an issue with afterburners cause these are not always active. The AI will try to approach its position in the formation gradually and keep a certain speed by using short ab pulses.

I'm surprised it doesn't work for the cover order. As far as I remember there is no different function involved but maybe I dumped too many stop afterburner calls all over the ai code :lol:
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: AdmiralRalwood on July 18, 2016, 04:59:57 pm
in the previously linked video he's at least 500m or so away from the player considering the starting distance is like almost 400.
Well, I said "at least" 385 meters; that's just the minimum distance needed for the condition to possibly ever be satisfied (according to my math). Note also I said "from its goal point", not "from the object it's guarding"; a better test would probably be ordering a fighter (which has been given free-afterburner-use, of course) to guard something a few kilometers away and seeing if it afterburns.

So is there a way to make the AI use their burners when ordered to "cover" the player?
Change the AI code. :P

No, but seriously, the AI code is littered with magic numbers like this that have long needed to be de-hardcoded and exposed to modders; this is just one example of many, I'm afraid.
Title: Re: Feature Request: free-afterburner-use as an AI profile flag.
Post by: FrikgFeek on July 18, 2016, 05:11:26 pm
Putting in an Argo 4kms out and ordering Alpha 2 to protect it seems to make him use his burners, which is good. Now if only some handsome SCP coder could figure out how to make them do that for the "cover me" order  ;7