Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: General Battuta on July 30, 2010, 01:01:01 am

Title: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on July 30, 2010, 01:01:01 am
Two brief requests. I spoke to The_E to make sure I had clearance to post without annoying people. Obviously these are not for 3.6.12.

1. It would be lovely to get an AI standoff attack mode in which the AI ship would stop at the maximum range of its weapons and engage from there. Trebs, Maxims, what have you. If the target approached it would seek to maintain this distance while turning to make snapshots (maybe there'd be a minimum distance that'd trigger the withdraw behavior.)

2. Could we get a generalized version of cap-waypoint-speed that would simply cap a ship's speed, no matter what behavior they're engaged in? This can be faked on warships by sabotaging the engine system, but it's an ugly hack. This would allow for better warship behavior in tightly FREDded scenarios (something currently impossible until dynamic waypoint movement via set-object-position is implemented.) I understand this could be somewhat difficult and I'll happily take 'no for an answer.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Sushi on July 30, 2010, 10:24:53 am
You do know that other people are allowed to work on AI behaviors, right? :p

I agree that standoff attacks would be interesting, though. And very, very annoying to fight. :) How would you decide which weapon's range to use? For example, if the AI is packing trebs and maxims, how do you determine whether it should try to maintain Treb range or Maxim range?
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on July 30, 2010, 10:29:53 am
You do know that other people are allowed to work on AI behaviors, right? :p

I agree that standoff attacks would be interesting, though. And very, very annoying to fight. :) How would you decide which weapon's range to use? For example, if the AI is packing trebs and maxims, how do you determine whether it should try to maintain Treb range or Maxim range?

hrrrrrrrrrghhh

That's a very tricky question. I feel like ai-primary-standoff and ai-secondary-standoff is horrible, especially as you could have multiple secondaries with different ranges. I think the most elegant solution is just to have the AI use its longest-ranged weapon.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Aardwolf on July 30, 2010, 08:38:26 pm
Why not have the sexp specify the range as one of the arguments? Or a list of preferred weapons?
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on July 30, 2010, 09:36:28 pm
Why not have the sexp specify the range as one of the arguments? Or a list of preferred weapons?

This isn't a SEXP, it's an AI order. But those are interesting suggestions for a related SEXP.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Colonol Dekker on July 31, 2010, 02:21:53 am
Just make two.
Ai-standoff-primary, and "-"-secondary.
 
You can set priority as needed.
 
 
If you ask the question, "What if an Ursa has a bank of rockeyes and a bank of helios. which will they use?" There's a preferred-secondary-use sexp or similar isn't there?
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: FUBAR-BDHR on July 31, 2010, 02:53:42 am
What about just an ai-chase-distance sexp (yea I know it's not actually a sexp).  It would be initially implemented via sexp only until wxFRED when the interface can be updated to take the distance field.  Giving this version of the attack order would cause the AI to match speed if behind, attempt strafe, or fall back when the given distance is reached.  Giving a value out of weapon range would just make the AI follow the ship and not attack.   Of course you can get fancy with min and max range and even a logical for switching to ai-chase if out of weapons useable from the range. 
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Fury on July 31, 2010, 04:50:31 am
how do you determine whether it should try to maintain Treb range or Maxim range?
Easy answer to this one. AI uses whatever weapon does most damage to the particular target, as it should especially when coupled with $smart primary weapon selection and $smart secondary weapon selection. This is the current behavior with those two flags enabled. Meaning AI will pick whatever weapon does the most damage to currently selected target depending whether it has any shields or not.

For example. If AI fighter is equipped with a weapon that does 50 DPS hull damage and 100 DPS shield damage and a weapon that does 100 DPS hull damage, 25 DPS shield damage and is currently targeting unshielded ship, then it uses the second weapon at 90% of the weapon's maximum range. Why 90%? Because larger value can make it possible for the weapon to miss depending on target's velocity and what the AI is targeting.

Of course, for maximum fredder flexibility you could control this behavior via sexps and this sexp could take weapon preference and range for arguments. I don't see it necessary to create two sexps, just one is enough. Only make this accept either weapon type as argument. You can even make it a list-type argument, the AI will attempt to use the first weapon, then second if first is unavailable, then third if first and second are unavailable and so on. Each listing will need its own distance preference however.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Mobius on August 04, 2010, 04:50:59 pm
AI standoff is exactly what I have been thinking about for a while to improve the efficiency of EAF Proteus fighters and other comparable spacecraft. Battuta has pretty much anticipated me at requesting this feature. :)

I would like it to be as much as customizable as possible, without letting the AI take full control of it. If raw damage is the only parameter taken in consideration, as evidenced in the first part of Fury's latest post, additional parameters like armor types, weapon types and effectiveness of the defenders risk compensating the awesomeness of standoff attacks.

I believe a SEXP with the following arguments would do the job:

1 - Ship or wing supposed to employ standoff attacks;
2 - Mininum range;
3 - Maximum range;
4 - Preferred weapon;
5 - "Risk" value;
6+ - Ship(s) or wing(s) to attack;

Before you ask - yeah, it's kind of based on good-secondary-time. :) Please note that 2 and 3 may be used to randomize standoff attacks, or attackers would end up positioning themselves at the very same distance. 5 would indicate how many risks the attackers are willing to take to employ standoff attacks, and may work by simply overriding the default courage (http://www.hard-light.net/wiki/index.php/Ai.tbl#.24Courage:) value of the attackers' AI class.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 04:53:11 pm
Cut #5 and I generally like it.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Mobius on August 04, 2010, 04:55:44 pm
Why? I think 5 is pretty useful if a FREDder wants standoff attackers to defend themselves instead of playing the role of sitting ducks. Would you sacrifice an entire wing of valuable attackers for, let's say, a single freighter?
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 05:01:10 pm
What you just said has absolutely no bearing on how this AI order should work. Dynamic goals will allow AI ships to defend themselves just as they do with other orders like ai-chase.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Snail on August 04, 2010, 05:20:31 pm
Yeah this would be very cool.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: The E on August 04, 2010, 05:22:41 pm
Mobius: You do know that "Courage" isn't used anywhere in the AI Code, right?
EDIT: Okay, it's used in two places. A ship with high courage has a greater probability of attacking turrets on a big ship, and a higher chance of staying on target during dogfighting.

Also, this is probably easier to code in using the standard ai order system, and letting the AI figure out what weapons to use by itself.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Mobius on August 04, 2010, 05:42:31 pm
What you just said has absolutely no bearing on how this AI order should work. Dynamic goals will allow AI ships to defend themselves just as they do with other orders like ai-chase.

But with dynamic goals you wouldn't have full control of AI behavior. Imagine to do the following in an escort mission:

12 heavy fighters jump in at safe distance and commence a standoff attack with long range missiles and primaries. The player, ordered to eliminate these threats, doesn't know that each one of them has a different "courage" value. The player gets closer, and 2 heavy fighters abort their strike to target the player and his attending wings. They get even closer, and more enemy fighters abort their attack to defend themselves. At some point, you may have 10 fighters trying to repel the player while the remaining 2 continue their attack.

This is just an example of customization that may be possible to see ingame with that SEXP. Realistic and almost certainly cool, I believe.

EDIT: The E, maybe not exactly the same as Courage but supposed to work pretty much like Courage would.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 05:45:40 pm
All of that can be done using existing FRED features. An additional argument to an already complex AI order is not required.

Furthermore the method you're suggesting, modifying courage, is not a great one because courage is barely called at all in the AI code (yep, The_E apparently confirms this.)

Don't overcomplicate things that can already be done. I want an AI order here, not a good-secondary-time analogue.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: The E on August 04, 2010, 05:48:47 pm
I would still maintain that using the current ai order system, in combination with the "courage" value and maybe a clever use of weapons.tbl flags would be preferable to using a sexp.
I mean, the good thing about the fact that courage is barely used is that we can easily add another use for it.

You may not be aware of this, but orders are processed quite a bit differently than sexps. Mixing the two, while not necessarily difficult, would also introduce a bit of complexity I, for one, would want to avoid.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 05:49:33 pm
What I'm asking for here is an ai order like ai-chase. Not a SEXP like good-secondary-time. I should've clarified that.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: FUBAR-BDHR on August 04, 2010, 06:25:47 pm
Yes I just suggested implementing via add-goal sexp first as the current gui doesn't have the fields required for the option. 
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 06:27:52 pm
Yes I just suggested implementing via add-goal sexp first as the current gui doesn't have the fields required for the option. 

Exactly my thought.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Mobius on August 04, 2010, 06:31:15 pm
By "Courage" I didn't meant the AI parameter itself, but rather something that would work like it. I don't know how hard it is to make it possible, but I'm still all for a customizable SEXP.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: General Battuta on August 04, 2010, 06:39:47 pm
By "Courage" I didn't meant the AI parameter itself, but rather something that would work like it. I don't know how hard it is to make it possible, but I'm still all for a customizable SEXP.

There is no reason to add a feature that replicates functionality already present.
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: The E on August 04, 2010, 06:41:24 pm
What's wrong with using a parameter that is already present for controlling a behaviour that sounds exactly like the kind of thing it is meant to represent?
Title: Re: Feature request: ai standoff attack (Sushi take heed?) and cap-speed SEXP
Post by: Sushi on August 04, 2010, 10:05:55 pm
What's wrong with using a parameter that is already present for controlling a behaviour that sounds exactly like the kind of thing it is meant to represent?

Nothing at all. IMO it would make sense, if this stand-off thing ever gets implemented, to use "courage" to influence how close the AI is willing to let the enemy get before retreating. I did this with the stalemate detection stuff: how long an AI pilot is willing to endure a "stalemate" situation before breaking is influenced by the patience attribute, which was previously actually not used for anything.

There's also nothing wrong with making it a completely new AI class parameter, maximizing flexibility. :)