Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: KeldorKatarn on July 05, 2009, 12:27:12 pm

Title: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 12:27:12 pm
I just found this in the code:

if (current_goal->ai_mode != AI_GOAL_DESTROY_SUBSYSTEM) {
    if (aip->target_objnum != -1) {
        //   Only protect if _not_ a capital ship.  We don't want the Lucifer accidentally getting protected.
        if (!(Ship_info[Ships[shipnum].ship_info_index].flags & SIF_HUGE_SHIP))
            Objects[aip->target_objnum].flags |= OF_PROTECTED;
        }


Is it possible to deactivate this behavior via ai_profiles flag? This is a very strange behavior maybe needed for retail but really bad for certain mods including Saga.

if I order my wingmen to attack a subsystem on a capital ship this basically results in a total protection of that ship until I change my orders. This is .. disturbing.
I might order certain ship to support an attack by destroying the engines or a weapon system and the result is that the ship will no longer be attacked...

I'm not sure everyone is aware of this...
Title: Re: Destroy subsystem = target protected??
Post by: The E on July 05, 2009, 12:31:36 pm
Doesn't that code pretty much state that it will only kick in on non-capital ships?
Title: Re: Destroy subsystem = target protected??
Post by: General Battuta on July 05, 2009, 12:33:05 pm
Seems like it says right there it only works on non-capital ships.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 12:43:43 pm
Probably HUGE != capital ship.

I stepped through the code during runtime... it DOES get executed for a corvette class ship in Saga.

Retail had several different types of capships, several of which we don't use. This does get executed for certain capships, which is bad.
Title: Re: Destroy subsystem = target protected??
Post by: General Battuta on July 05, 2009, 12:44:27 pm
That is bad.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 12:47:17 pm
The code says:

#define   SIF_SMALL_SHIP            (SIF_FIGHTER | SIF_BOMBER | SIF_SUPPORT | SIF_ESCAPEPOD )
#define   SIF_BIG_SHIP            (SIF_CRUISER | SIF_FREIGHTER | SIF_TRANSPORT | SIF_CORVETTE | SIF_GAS_MINER | SIF_AWACS)
#define   SIF_HUGE_SHIP            (SIF_CAPITAL | SIF_SUPERCAP | SIF_DRYDOCK | SIF_KNOSSOS_DEVICE)


Which means not only small ships will be protected but also all big ships, cruisers, freighters, transports, corvettes, gas miners, and awacs.  I consider that very very bad.
Especially for corvettes and cruisers.

Edit: Maybe an ai_profiles flag or something that includes SIF_BIG_SHIP in there.

Somehow it does seem ok for transport, freighter, awacs , but cruiser and corvette?

If this is really wanted beavior then this should really be WELL documented somewhere so people stay away from "corvette" and "cruiser" type ships and declare them "capital" instead.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 01:06:28 pm
Another thing about this is... if an order to attack subsystems results in a protection...

that kinda implies that protected ships are NOT protected against subsystem strikes? Which means I can order my wingmen to destroy practically all systems of a protected ship?

That is... STRANGE... to say the least.

This this results in behavior that can sometimes look like bugs, I'd really like to see an ai_profiles flag to turn this off entirely. It seems... wrong somehow and probably results in very strange AI behavior every now and then.
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 05, 2009, 01:19:42 pm
It's not a bug at all. It's definitely deliberate and if you stop to think about it for a while you'll see exactly why.

First, this doesn't affect AI_GOAL_DESTROY_SUBSYSTEM. Re-read that first line again.

Code: [Select]
if (current_goal->ai_mode != AI_GOAL_DESTROY_SUBSYSTEM) {
Notice the ! It affects the other two goal modes this case includes, i.e AI_GOAL_DISABLE_SHIP and AI_GOAL_DISARM_SHIP. And it should be fairly obvious why you'd want the AI to stop attacking a ship when you've ordered them to disable/disarm it and they have done so. :p
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 01:49:02 pm
Well then we cannot use those affected ship classes anymore because for us this is not wanted behavior. We have several missions in which fighters are supporting a huge strike by disarming certain ships and the last thing we want is everybody else stopping to fire on that ship.

I guess we'll just have to ignore all BIG category ship classes then.
Title: Re: Destroy subsystem = target protected??
Post by: Wanderer on July 05, 2009, 02:25:21 pm
This seems something that probably should have been placed into the objecttypes.tbl
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 05, 2009, 02:27:29 pm
Well then we cannot use those affected ship classes anymore because for us this is not wanted behavior. We have several missions in which fighters are supporting a huge strike by disarming certain ships and the last thing we want is everybody else stopping to fire on that ship.

I guess we'll just have to ignore all BIG category ship classes then.

And it never occurred to you to simply unprotect the ships when they are disabled/disarmed like people have been doing since retail? :p


I swear, having access to the code is making all of us so damn lazy. :p
Title: Re: Destroy subsystem = target protected??
Post by: Aardwolf on July 05, 2009, 02:33:51 pm
Isn't this supposed to be there? To keep your wingmen from destroying stuff in capture missions?
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 05, 2009, 02:39:41 pm
That's exactly the point I made. :)

If this wasn't present your wingmen would disable the transport you were after and then blow the crap out of immediately afterwards. Instant failed mission.
Title: Re: Destroy subsystem = target protected??
Post by: Aardwolf on July 05, 2009, 02:42:50 pm
Ha. I wasn't even thinking about the 'after' part. I was just thinking about the "SHIVA H. VISHNU! generic profanity Don't use a Helios to take out the turret subsystem of a freighter!" part.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 02:51:29 pm
Well and it never occured to you that this might not be wanted?
Transport ok.. but this also goes in effect for corvettes and cruisers.

And unprotect it once it is disarmed.. well... yeah.. if this was documented anywhere. So far I didn't even know this happened for certain ship types.

And for us it makes no sense for fighting ships like corvettes and cruisers, since we order some wings to destroy the turrets to help the bombers. That doesn't imply that the bombers should stop attacking while the other wing is trying to disarm.

The only reasonable course of action for us right now is to classify cruisers and corvettes also as "capital" since we definately do not want the attack to stop only because some fighters are disarming at the same time.

if I want a ship to be protected and not accidently blown up, then I check for that in FRED and protect or guardian it. The engine shouldn't do stuff like that for me.


Anyway, since this is considered WAD, we'll just have to avoid the ship classes affected by this. All I'm really saying is: This should be documented somewhere.
Title: Re: Destroy subsystem = target protected??
Post by: FUBAR-BDHR on July 05, 2009, 03:00:30 pm
That's exactly the point I made. :)

If this wasn't present your wingmen would disable the transport you were after and then blow the crap out of immediately afterwards. Instant failed mission.

Would the fact that they do this all the time in multi be a bug then?
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 05, 2009, 03:24:32 pm
Well and it never occured to you that this might not be wanted?

It's the way Freespace has always done it. And as I said it should be pretty obvious why it did it. If you want to change the behaviour, feel free. I won't be because there are plenty of ways to work around it.
Title: Re: Destroy subsystem = target protected??
Post by: Goober5000 on July 05, 2009, 08:16:07 pm
Agree with karajorma.  This is not only expected behavior, it's required behavior.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 10:43:43 pm
All I'm saying is that lack of documentation of this 'feature' lead to false-negative bug reports and to us not assigning different ship classes in the first place. i stumbled over this by accident trying to debug a turret 'malfunction'.

This could just as well have made it into release and nobody would have known what the hell the AI is doing.

stuff like this should really be documented somewhere.

It's the same as the "how do I correctly make subsystems rotate" in the other thread I opened. nobody really knows where to find any information about how it is done or what certain flags REALLY do.

I know this is really more a concern for the wiki project but this is something only the developers really know.

Just a suggestion from a modder's point of view.
Title: Re: Destroy subsystem = target protected??
Post by: Trivial Psychic on July 05, 2009, 11:01:05 pm
Could this behavior be responsable for a bug in some earlier versions (haven't played latest one) of the FSPort during the Ramses mission, where the Shivans will refuse to attack the Ramses?  The player's mission is to disable and disarm the Ramses, so the Protect-Ship defaulting status could have filtered over to the Shivans treatment of the Ramses.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 05, 2009, 11:47:41 pm
if he ramses is a big ship, not a huge one, then yes its possible
Title: Re: Destroy subsystem = target protected??
Post by: Goober5000 on July 06, 2009, 12:54:49 am
All I'm saying is that lack of documentation of this 'feature' lead to false-negative bug reports and to us not assigning different ship classes in the first place. i stumbled over this by accident trying to debug a turret 'malfunction'.

This could just as well have made it into release and nobody would have known what the hell the AI is doing.

stuff like this should really be documented somewhere.
Yes, you're right, it really should be documented.  Not everything is; that's one of the risks a person takes when working with FreeSpace (or really, any large software project).  We apologize for the inconvenience.

I have added some additional sexp help text in SVN.


Could this behavior be responsable for a bug in some earlier versions (haven't played latest one) of the FSPort during the Ramses mission, where the Shivans will refuse to attack the Ramses?  The player's mission is to disable and disarm the Ramses, so the Protect-Ship defaulting status could have filtered over to the Shivans treatment of the Ramses.
Hypothetically, yes; but I just checked that mission and there is already an unprotect-ship sexp in the proper place.

EDIT: Although without the FS1 mission in front of me, I can't be sure whether that sexp was there from the beginning.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 06, 2009, 06:05:04 am
@Goober. Thanks for the documentation but it isn't 100% accurate yet. It only results in protection for SMALL and BIG ships, not for HUGE ones.
If SMALL; BIG and HUGE are nowhere else documented you better list the single ship types.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 07, 2009, 11:42:25 am
Btw.. I'm still voting for a FLAG in FRED:

"disable or disarm results in protection"

In my opinion the decision of the AI stops attacking that ship or continues to is a matter of mission design, hence the power to influence this should be in the hands of the FREDer and not hardcoded for certain ship classes. I mean sometimes I want to also protect a huge ship.. right now that is just as impossible as not protecting a big ship.

Maybe an additional flag would be necessary which activates the second one, to keep retail behavior of falling back to the hardcoded version. But it should be possible to influence this somehow.
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 07, 2009, 12:04:11 pm
Then add the flag. I've already said I'm not doing it cause this is absolutely do-able in FRED. But if you believe that it is less effort for you to add the flag and make sure it is correctly set in every mission from now on, go for it.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 07, 2009, 12:14:14 pm
OK, I'd still like to discuss the best way of implementing this.

I'd say a ship should have a ship-flag in the MISC dialog of the ship editor saying "Disable/disarm command results in protection".

To keep retail behavior intact I'd say an additional ai_profiles.tbl flag is needed "$Use retail behavior for disarm/disable ship protection:" which is set to TRUE/YES by default and must be set to false for the FRED flag to have any effect.

Is that ok or does anyone have a better idea. I have no problems with implementing this, I just want to make sure everything is ok with the way it is done.
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 07, 2009, 12:25:22 pm
Do it as a ship flag. Do it as an ai_profile/mission flag and you'll see this turn around and bite you on the arse soon enough. What happens if during a mission where you've set the mission flag the player has to actually capture an enemy ship?
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 07, 2009, 12:30:35 pm
Where did I say I wanted a mission flag? I clearly stated I want to set in as a flag in the ships dialog.

You know what? Go sleep off your alcohol level or do something to lower your stress level or whatever it is that's causing your totally unprovoked attacks.
You act as if I was asking anything of you. I don't really give a **** if you even read this.

I suggested a change that Saga would benefit from and I'm fully able and willing to implement it myself. I just wanted to discuss here with the rest of the developers the best way of doing stuff
so that everyone is happy with usability.

Instead you come here and insult me and our project in several places for being stupid, moronic and whatever else. I do not appreciate that and I suggest you appologize.

until then this discussion has ended. I have better things to do than come here and be insulted for making a suggestion.
Title: Re: Destroy subsystem = target protected??
Post by: General Battuta on July 07, 2009, 12:38:34 pm
Keldor, as a neutral observer, I can see why you've perturbed Kara.

I think it's wise to keep in mind that a lot of the quirks in Freespace have been around since retail and are not the responsibility of the FSOpen coders. If they have been left in, it's probably for a reason.

I think you gave the impression of being a bit antagonistic even from the start - sort of an 'us vs. them' thing. Ease up, everyone's on the same team here.
Title: Re: Destroy subsystem = target protected??
Post by: KeldorKatarn on July 07, 2009, 12:49:08 pm
Where please did I attack the SCP team? I said certain decision of the engine code were not the best solution in my opinion. I absolutely didn't care who made them, the original developers at Volition or the SCP, nor did I place any blame.
I merely states that there are hardcoded limits in the code that make mission design less easy and flexible than it could be and offered a solution for discussion. As a result I and my modding team are attacked for making moronic decisions and come crying here.

That in the light of the fact thta in the past it was US who implemented most of our concerns because nobody was willing to do it for us, sounds more than a little ridiculous.

I thought that over the past few weeks cooperation had improved a lot, which is why I got more involved with other issues and also tried to help out with new features of other developers even though Saga isn't using them.

But right now I'm more than a little pissed to be honest.

If one cannot comment on the engine and make suggestions without somebody feeling hurt because someone critisized their baby, maybe some people should retire from doing open source or any software at all.

And spare me with any more comments on this, since I'm sure as hell not going to discuss this crap any more.
Title: Re: Destroy subsystem = target protected??
Post by: Snail on July 07, 2009, 12:55:02 pm
Am I the only one who thinks there's been enough drama for this year?
Title: Re: Destroy subsystem = target protected??
Post by: General Battuta on July 07, 2009, 01:07:35 pm
Yeah, let's all chill out.

Like I said, we're all on the same team here.
Title: Re: Destroy subsystem = target protected??
Post by: karajorma on July 07, 2009, 01:14:16 pm
Where did I say I wanted a mission flag? I clearly stated I want to set in as a flag in the ships dialog.

And that is all you need. There is no need for an ai_profile or mission flag. I know you only suggested one of those but I pointed out why neither were needed.

Quote
I suggested a change that Saga would benefit from and I'm fully able and willing to implement it myself. I just wanted to discuss here with the rest of the developers the best way of doing stuff
so that everyone is happy with usability.

You suggested a change, I told you that one wasn't needed as this problem could be solved easily in FRED without the need for code changes, you ignored me, you insisted that the only way to solve the problem was a table change, a table change that is retarded because I guarantee you it will swap a minor, easily fixed inconvenience for major AI issues. And then despite that you did it anyway.

I reacted rather explosively to your other thread cause that was the first in a long line of posts about similar "bugs" that would only come to light because you'd done something stupid in the first place.

Quote
Instead you come here and insult me and our project in several places for being stupid, moronic and whatever else.

I definitely didn't insult WCS. And to be honest I didn't insult you. I called your decision to change the tables in that way moronic because it was. And I would have referred to anyone making a similar change in the same way.

What makes me laugh is that you have probably the biggest expert on object types and their effect on AI on the planet on your team. So why you didn't ask Wanderer if that was a good idea before you did it is beyond me. Although I would pay money to see the horrified expression on his face when he heard that. :p

Quote
I have better things to do than come here and be insulted for making a suggestion.

Feel free to suggest things all you like but don't demand SCP changes. Especially when the changes you demand are already in code and you only think you need them because you've completely ignored previous advice.

Am I the only one who thinks there's been enough drama for this year?

Yep. You are. I'm selling tickets and I've let the other regulars in for a cut. :p
Title: Re: Destroy subsystem = target protected??
Post by: Goober5000 on July 07, 2009, 10:31:45 pm
I reacted rather explosively to your other thread cause that was the first in a long line of posts about similar "bugs" that would only come to light because you'd done something stupid in the first place.
QFT.  Keldor, we're all a little tired of you coming in and demanding SCP code changes to compensate for things you didn't account for when FREDding your missions.

EDIT: I had a rather large rant here all ready to post, but I deleted it out of respect for the WCS team, because they're generally decent, friendly, and hard-working members.  I suggest you clean up your arrogant and demanding attitude, Keldor, because it reflects extremely poorly on the WCS team and strongly discourages us from working with you guys.