Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: Zarax on November 09, 2023, 02:52:29 am

Title: Forcing capships to keep distance?
Post by: Zarax on November 09, 2023, 02:52:29 am
Hello,

is there any way to create an AI capital behaviour where while attacking they will keep a minimum distance from the target?

Thank you!
Title: Re: Forcing capships to keep distance?
Post by: Colonol Dekker on November 09, 2023, 03:04:17 am
I think there's a Sexp for that in the events editor.
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 09, 2023, 03:50:20 am
AI-keep-distance is greyed out if you're thinking about that one.
Title: Re: Forcing capships to keep distance?
Post by: wookieejedi on November 09, 2023, 06:44:49 am
Hello,

is there any way to create an AI capital behavior where while attacking, they will keep a minimum distance from the target?

Thank you!

Do you want the a capital ship to reach a certain distance and position relative to it's target, then stop and rotate to bring guns to bear? Then if the target moves do you want the capital ship to dynamically maintain that position relative to it's target?

If so, I might recommend trying these custom sexps:
https://www.hard-light.net/forums/index.php?topic=96082.0 (https://www.hard-light.net/forums/index.php?topic=96082.0)
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 09, 2023, 07:02:06 am
Hello,

is there any way to create an AI capital behavior where while attacking, they will keep a minimum distance from the target?

Thank you!

Do you want the a capital ship to reach a certain distance and position relative to it's target, then stop and rotate to bring guns to bear? Then if the target moves do you want the capital ship to dynamically maintain that position relative to it's target?

If so, I might recommend trying these custom sexps:
https://www.hard-light.net/forums/index.php?topic=96082.0 (https://www.hard-light.net/forums/index.php?topic=96082.0)

Yes, that's specifically the behaviour I'm looking for.
Thank you, I shall study those sexps and see how I can make them work.
Title: Re: Forcing capships to keep distance?
Post by: wookieejedi on November 09, 2023, 05:10:44 pm
Sounds great! Happy to answer questions here or on the Discord in the #fredding channel, too (https://discord.gg/kgYgknmmdu (https://discord.gg/kgYgknmmdu)).
Title: Re: Forcing capships to keep distance?
Post by: 0rph3u5 on November 10, 2023, 01:18:36 pm
AI-keep-distance is greyed out if you're thinking about that one.

That's propably because it is not permitted for the object-type of the ship in question. Which AI orders a ship can recieve is definined by its object-type, which is established by a related flag in its ships.tbl-entry, e.g. "fighter", "bomber" or "capital".
Objecttypes.tbl allows you to maniplulate which AI orders are valid for a ship with the respective flag.


While you should be good with the new SEXPs wookiejedi presented to you, I feel obliged to mention the legacy method to do this is using waypoints. However that requires a number of geometrical calculations (or lots of trial and error) each time but can be made to work dynamically, as waypoints can be moved using the coordinate manipulation SEXPs.
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 10, 2023, 01:38:20 pm
I'm very aware of the legacy method, I've been modding FS2 since the 20th century although never released anything relevant.
I'll take a look at objectypes, although I suspect putting small craft sized routines on destroyer size ships is bound to cause weird reactions.
Title: Re: Forcing capships to keep distance?
Post by: Colonol Dekker on November 10, 2023, 03:14:47 pm
How do you mean?   If a destroyer had the right flags, strike craft orders shouldn't apply to it.  Is this related to the VLS craft you mentioned in another topic?  :)


Is it a custom ship you're working with?
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 10, 2023, 11:50:06 pm
How do you mean?   If a destroyer had the right flags, strike craft orders shouldn't apply to it.  Is this related to the VLS craft you mentioned in another topic?  :)


Is it a custom ship you're working with?

Yes, it's in part related to the VLS concept and I wish I had something custom but in reality I'm working with heavily table modded versions of vanilla FS2 ships.
I have a concept in my head of a FS campaign where Sol basically got the other side of shivan tech, namely capital shields, and focuses on bombarding enemies from long range to deplete shielding before sending bombers to disable capital sub systems.

The balance is such that class for class terran ships are able to overcome capital shields with time but if a beam armed ship gets close enough to fire it's game over as you know what LRED can do to a destroyer, even when if you add 25k hitpoints of shields.

What I'm trying here is to make battles a lot less static when involving capital ships (after all even the battleships of old didn't sit and pound each other to death, quite the opposite) but FS2 AI even on FSO still makes capships very collision happy.
Title: Re: Forcing capships to keep distance?
Post by: Colonol Dekker on November 11, 2023, 02:55:07 am
Just trying to identify possible cause for your distance concern.

Heavily modded table may be a factor?
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 11, 2023, 03:59:21 am
Well, the ships mostly get the surface shield tag and in Orion's case higher turret FOV and new weapons, nothing too radical.

What happens is that if for example I order 2 orions to attack a lucy, they will get closer and closer, kind of orbit around it then collide.
Even worse if I order both ships to attack each other, they will "dodfight" until they collide...
Title: Re: Forcing capships to keep distance?
Post by: Mobius on November 11, 2023, 05:10:28 am
Nice question, and interesting answers.

This goes back to the good old debate on how to manage warship battles and escort duties in FreeSpace. Personally, due to turret FOVs, storytelling purposes, and event management issues, I prefer to use waypoints regardless of the situation. This way, the FREDder has full control on how the mission is going to turn out, and one major advantage in terms of mission balance is avoiding particular configurations where friendly ships are unable to bring their key armaments to bear on relevant targets (enemy warships and incoming bombers alike).

In poor words, I generally don't order warships to attack each other.
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 11, 2023, 05:25:43 am
Thank you Mobius, this has basically been the default FS2 community stance since forever, however I was hoping that after over 20 years there were easier ways to handle capship behaviour...
Title: Re: Forcing capships to keep distance?
Post by: Mobius on November 12, 2023, 04:40:51 am
To be fair, I think ordering warships to attack each other is still a rather common practice. I prefer waypoints for the reasons stated above, so it's up to you to do the same or not. :)

Personally, I think it's the best way to have direct control on a battle, as you can tell in advance what turrets can be brought to bear on the opponent, what turrets and subsystems are exposed to enemy fire, and how much time it takes to get the warships within a specific range. Also, should reinforcements from either side jump in, you can also tell in advance what they'll be doing, and how.
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 12, 2023, 07:08:02 am
I agree with you that this approach leaves you a lot more control, however it tends to encourage a "mission as a puzzle" approach, where too often the difficulty is in figuring out how the creator wanted the mission to be done rather than being just a challenging fight.

What ideally I'm aiming for is to have battles being cahotic and with luck having some influence, take into account that unlike the average FS2 missions in what I fred destroyer size ships aren't jumping close to each other but rather at 20-30km away, which leaves time for wings to deploy and plenty of room for reaction even on capital scale.

Title: Re: Forcing capships to keep distance?
Post by: 0rph3u5 on November 12, 2023, 10:56:30 am
I agree with you that this approach leaves you a lot more control, however it tends to encourage a "mission as a puzzle" approach, where too often the difficulty is in figuring out how the creator wanted the mission to be done rather than being just a challenging fight.

What ideally I'm aiming for is to have battles being cahotic and with luck having some influence,

In my eperience, the less control you excerise as a mission designer, the more possible permutations a mission will have - which will adds up as work during testing and complicates your ability to respond to feedback.

Unless you have huge QA workforce in the wings, I would encourage you to prioritize managable permutations.

If you want to still inject more player agency you can always run multiple waypoint paths for your capships and bombers and then have the player influence which one is used somehow (e.g. give the player limited time to perform scans along a possible path).
Title: Re: Forcing capships to keep distance?
Post by: Colonol Dekker on November 12, 2023, 11:07:14 am
Or if the capship damage is within a threshold at the time it reaches a way point.

Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 12, 2023, 11:41:16 am
I agree with you that this approach leaves you a lot more control, however it tends to encourage a "mission as a puzzle" approach, where too often the difficulty is in figuring out how the creator wanted the mission to be done rather than being just a challenging fight.

What ideally I'm aiming for is to have battles being cahotic and with luck having some influence,

In my eperience, the less control you excerise as a mission designer, the more possible permutations a mission will have - which will adds up as work during testing and complicates your ability to respond to feedback.

Unless you have huge QA workforce in the wings, I would encourage you to prioritize managable permutations.

If you want to still inject more player agency you can always run multiple waypoint paths for your capships and bombers and then have the player influence which one is used somehow (e.g. give the player limited time to perform scans along a possible path).

TBH it's easier for me to be my own QA than the other way, it's been around 20 years since I did serious FREDing (and Rise of GCA was definitely cringe worthy seen today) and players tend to break things a lot more than I can account for (like for example, disabling a Deimos with a Loki and HL7...)
Title: Re: Forcing capships to keep distance?
Post by: wookieejedi on November 12, 2023, 08:48:52 pm
Sorry, just poking in to say the custom movement sexps do use dynamic waypoints at their core  :)
Title: Re: Forcing capships to keep distance?
Post by: Zarax on November 13, 2023, 12:49:32 am
Oh, I will soon experiment with your capship dynmamic sexps, they might be exactly what I'm looking for...