Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: CommanderDJ on August 31, 2010, 03:20:50 am

Title: Support ship behaviour
Post by: CommanderDJ on August 31, 2010, 03:20:50 am
An idea just occurred to me: support ships don't usually look out for themselves at all. When under attack, they just stand there and take it (well, duh, they have no weapons). But seeing as how you can just call in another one whenever you want, would it be possible to make it so that if a support ship isn't currently under orders to rearm anybody or stay near anyone, could it depart when its hull integrity falls below a certain value? Or perhaps just when under attack? I think this would make it their behaviour more realistic and believable.
Title: Re: Support ship behaviour
Post by: Snail on August 31, 2010, 03:25:57 am
It's easily possible with argument SEXPs.
Title: Re: Support ship behaviour
Post by: CommanderDJ on August 31, 2010, 03:32:31 am
I didn't mean in a specific mission, like you said, that's easy. I meant could we make this default behaviour? And would it be worth it?
Title: Re: Support ship behaviour
Post by: Goober5000 on September 01, 2010, 12:07:33 am
It already is the default behavior.
Title: Re: Support ship behaviour
Post by: Snail on September 01, 2010, 01:58:18 am
It already is the default behavior.
what
Title: Re: Support ship behaviour
Post by: CommanderDJ on September 01, 2010, 02:36:11 am
It already is the default behavior.

Um. No it isn't. Well, at least, not in my experience. When a support ship is being attacked (which doesn't happen often, I'll admit), it just sits there and does nothing. Sometimes it flies attempts to fly away, obviously to no avail. Any pilot in that situation would have the common sense to jump back to base.
Title: Re: Support ship behaviour
Post by: Enigmatic Entity on September 01, 2010, 07:27:47 am
I have seen them try to go back to base, though mainly when I get bored in a silly self created BoE and turn traitor. They wait too long though and get destroyed sometimes even after they are in the warp hole, but the hole is still open, so the weapons fly straight through...

If they aren't attacked, they sit there pretending to be an asteroid. They move for 1/2 a second upon receiving fire, then stop until they get hit again :doubt:
Title: Re: Support ship behaviour
Post by: Goober5000 on September 01, 2010, 02:10:41 pm
Read the source code and learn:

Code: [Select]
// If a support ship with no goals and low hull, depart.  Be sure that there are no pending goals
// in the support ships ai_goal array.  Just process this ships goals.
if (sip->flags & SIF_SUPPORT) {
if ( timestamp_elapsed(aip->warp_out_timestamp) ) {
ai_process_mission_orders( OBJ_INDEX(objp), aip );
if ( (aip->support_ship_objnum == -1) && (get_hull_pct(objp) < 0.25f) ) {
if (!(shipp->flags & SF_DEPARTING))
mission_do_departure(objp);
}
}
}
Title: Re: Support ship behaviour
Post by: CommanderDJ on September 02, 2010, 12:57:49 am
I just got pwned.

But still, as Enigmatic Entity pointed out,
Quote
If they aren't attacked, they sit there pretending to be an asteroid. They move for 1/2 a second upon receiving fire, then stop until they get hit again.
Now I'm obviously not demanding that this be looked into RIEET NAO (as I'm obviously not in a position to), but I'm asking if it could possibly be evaluated sometime in the future?
This is especially visible when you turn traitor. The support ship is a sitting duck. I just think it would make for a more realistic game experience if the support ship jumped out as soon as it was attacked if it has no active goals. Or for example when it's hull is less than 50%, because by the time it gets to 25% (as in that code snippet you have there), it's going to take about two seconds for the support ship to be destroyed if it's continuously under fire.
Title: Re: Support ship behaviour
Post by: Goober5000 on September 02, 2010, 01:15:05 am
I just got pwned.
You took it equably enough. :)

Quote
I just think it would make for a more realistic game experience if the support ship jumped out as soon as it was attacked if it has no active goals. Or for example when it's hull is less than 50%, because by the time it gets to 25% (as in that code snippet you have there), it's going to take about two seconds for the support ship to be destroyed if it's continuously under fire.
The problem here is not the AI but the departure mechanism.  It takes so long for a ship to depart that small ships are usually destroyed before they can complete the jump.  Under sustained fire a support ship can be destroyed even if it's set to jump out at 75%.

The solution is probably to implement a new warpout type that can complete very quickly.  In X-Wing and TIE Fighter, for example, ships going into hyperspace would escape weapons range in less than a second.
Title: Re: Support ship behaviour
Post by: CommanderDJ on September 02, 2010, 02:32:56 am
Yes. What you say makes a lot of sense. Would you guys actually consider implementing this? Maybe specifically for support ships by default and then available as a SEXP or feature that can be toggled for other ships in FRED? Because that would be awesome.
Title: Re: Support ship behaviour
Post by: General Battuta on September 02, 2010, 08:06:01 am
I dunno about that. I definitely wouldn't want it in the core campaigns. If a 'fast jump' drive exists, why don't fighters get it?

It'd be an interesting mod option, but I don't think it should be applied to support ships, especially not on the code level.
Title: Re: Support ship behaviour
Post by: Goober5000 on September 02, 2010, 02:15:01 pm
It would definitely be an interesting mod option, for balance purposes.  Especially if a campaign creator wants his fighters to be able to escape on a regular basis, instead of fighting to the death.

Implementing a new warpout type is non-trivial, however, and there doesn't seem to be a campaign which currently needs this.
Title: Re: Support ship behaviour
Post by: Retsof on September 02, 2010, 06:43:20 pm
You could just set the warpout speed higher in the ship tables.  Harder to shoot a ship that's being sucked into subspace at 200 m/s.
Title: Re: Support ship behaviour
Post by: The E on September 02, 2010, 06:54:16 pm
Wrong, I think. The problem is that the ship needs to accelerate (or decelerate, as the case may be) to the warpout speed, and that takes time. IIRC.