Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: dekal on April 20, 2010, 08:19:52 pm

Title: AI fires no missles?
Post by: dekal on April 20, 2010, 08:19:52 pm
I don't know if this is a bug or a new 'feature' or a personal screw-up but I remember that in Fs2_open 3.6.10 AI fighters (and bombers) were able to fire their secondaries at other fighters as well as capital ships.
But the AI in 3.6.12 RC.1 and now RC.2 just fires lasers at fighters and keeps its missiles for bigger ships (cruisers, corvettes, transports, etc...)
Has anyone else noticed this or am I going crazy :nervous:??
Title: Re: AI fires no missles?
Post by: Galemp on April 20, 2010, 08:51:03 pm
I think you're going crazy. You have any mods installed? Try posting your fs2open.log.
Title: Re: AI fires no missles?
Post by: dekal on April 20, 2010, 09:41:32 pm
OK, there is definitely a problem. I made a custom mission involving 2 wings, Terran vs. shivans, depleted their primaries, and filled their secondaries with harpoons and hornets. The mission plays fine but the fighters keep dancing around without launching anything until you get tired and end the mission. I tried the same thing using the debug build and it crashed at the start of the load screen... here's the log.

And for the mod question, I have the mediavps 3.6.10, fsport, fsport mediavps... Although I normally only use the mediavps when playing

[attachment deleted by admin]
Title: Re: AI fires no missles?
Post by: FUBAR-BDHR on April 20, 2010, 10:06:24 pm
You wouldn't happen to have difficulty set to very easy?  AI will almost never use missiles on very easy. 

As for the bug you have a weapon in the mission loadout that is not allowed for player ships.  Remove it and you should be able to get by that error. 
Title: Re: AI fires no missles?
Post by: dekal on April 20, 2010, 10:29:03 pm
Mmm...difficulty seems to be the problem, when i first tested the mission difficulty was set on easy. But still, you get the same result with medium difficulty (at least with the mission I made to test this) and only on hard and insane levels   fighters fire missiles.

I normally play with easy settings but, as I said, AI fired secondaries on easy with the 3.6.10 build. According to the 3.6.12 change log, AI has returned to behave more like retail but I clearly remember missiles when I played freespace 8 years ago  :nod:
Title: Re: AI fires no missles?
Post by: Vrets on April 24, 2010, 07:16:05 pm
I can confirm this. The AI, friendly or hostile, virtually never fires fires missiles at other fighters on medium difficulty. AI strikecraft have no problem using missiles against larger ships like freighters, cruisers, etc.

I've observed this playing both my own Fs2 campaign and Silent Threat: Reborn.

This should definately be investigated.
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:16:57 pm
I can disconfirm this, at least in Blue Planet. The AI fires missiles freely on Medium.

Bear in mind that this is using Fury's AI, but still.
Title: Re: AI fires no missles?
Post by: Vrets on April 24, 2010, 07:19:31 pm
Bear in mind that this is using Fury's AI, but still.

I think it would be helpful to confine discussion to 'vanilla' (mediavps as the only mod) settings. Given that this is an AI-related issue, running a custom AI profile just might invalidate your findings.

I switched from 3.6.12 RC2 back to 3.6.10 and the AI will fire missiles at me. There you go. :p
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:22:28 pm
Bear in mind that this is using Fury's AI, but still.

I think it would be best to confine discussion to 'vanilla' SCP (ie mediavps as the only mod) settings.

I switched from 3.6.12 RC2 back to 3.6.10 and the AI will fire missiles at me. There you go. :p

The fact that Fury's AI fires missiles freely indicates that this cannot be purely a codeside issue. It is therefore an important factor.

Running a custom AI profile is exactly what it takes to make these findings critical.

Let us do our jobs.
Title: Re: AI fires no missles?
Post by: Vrets on April 24, 2010, 07:29:44 pm
It is not my intent to offend. I should be less cavalier given my inexperience with computer science. By all means, good luck with your job.

If I remember correctly, either RC2 or RC1 included a change to 'move FSO AI closer to retail behavior.' Perhaps something went awry in that commit?

Edited for tone, edited again to reduce pointless nitpicking
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:35:26 pm
You're nitpicking, and about a critical piece of information at that. Shush.

Interesting findings. Under 3.6.10 MediaVPs friendly ships will fire missiles but hostiles will not (tested, confirmed on 'Place of Chariots' and 'Love the Treason'.)

With no mod set (no MediaVPs), neither friendlies nor hostiles will fire (tested on the same.)
Title: Re: AI fires no missles?
Post by: Vrets on April 24, 2010, 07:42:15 pm
You're nitpicking, and about a critical piece of information at that. Shush.

Yeah, sorry. I'll clean that up.

Interesting findings. Under 3.6.10 MediaVPs friendly ships will fire missiles but hostiles will not (tested, confirmed on 'Place of Chariots' and 'Love the Treason'.)

With no mod set (no MediaVPs), neither friendlies nor hostiles will fire (tested on the same.)

That's strange. You aren't still using Fury's AI, are you? I'm running 3.6.10, retail AI, and both friendly and hostile fighters/bombers use missiles against one another.
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:43:32 pm
This is really bizarre. I'm going to guess that some new 3.6.12 feature has changed the handling of retail vs. mediavps vs. Fury AI table data, but it's only a guess.

Quote
That's strange. You aren't still using Fury's AI, are you? I'm running 3.6.10, retail AI, and both friendly and hostile fighters/bombers use missiles against one another

I thought the issue here was with 3.6.12. Correct behavior under 3.6.10 isn't surprising.

And of course I'm not using Fury AI.

For reference I'm using the 20100422T-INF_SSE2 Taylor sound build.
Title: Re: AI fires no missles?
Post by: Commander Zane on April 24, 2010, 07:46:16 pm
Now that I think of it since I've been playing SGWP2 I haven't really dealt with fighter missiles either.
Title: Re: AI fires no missles?
Post by: Vrets on April 24, 2010, 07:49:34 pm
http://www.hard-light.net/forums/index.php?topic=68190.0

Quote
If you haven't used 3.6.11 nightly builds before, AI behavior indeed has changed. AI now behaves more like it did in retail. 3.6.10 (and maybe earlier) had somewhat broken standard AI behavior. You can consult QuantumDelta for specifics.
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:51:18 pm
Behavior replicated on 3_6_11r_INF_SSE2-20100131_r5862.

Observed occasional Rockeye fire from hostile fighters (two shots), but far below the rate it should have been at. Saw no fire at all during the opening sequence of Love the Treason, from friendlies or hostiles alike.
Title: Re: AI fires no missles?
Post by: FUBAR-BDHR on April 24, 2010, 07:52:56 pm
AI behavior was changed from retail behavior at some point.  This resulted in the AI firing all weapons as soon as they could and even if they were not in range.  This behavior is in 3.6.10.  This was fixed in 3.6.11 and now should act like retail.   The lower the difficulty and the lower the AI class position in the table the less missiles have a chance of being fired.  The higher the difficulty and the farther down the table the entry is (up to a point) the more likely the AI is to fire up to the point they will always fire.  

So to confirm if there is a bug you will need to run the mission with the same difficulty and ai settings with both the retail exe and 3.6.12 RC2.  
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 07:57:04 pm
Fook, I can't get at the retail missions as I don't have the CD handy.

Someone else will need to compare.

Also, jesus christ the retail AI is slow and dumb. I want to get out and push the enemy Hercs.
Title: Re: AI fires no missles?
Post by: Commander Zane on April 24, 2010, 07:59:49 pm
What about looking through the AI tables?
Title: Re: AI fires no missles?
Post by: General Battuta on April 24, 2010, 08:00:56 pm
It's possible that this is genuinely how it's supposed to be on retail. It's been so long that I hardly remember retail Medium.

But good god, I watched the friendlies on '...But Hate the Traitor' go through the entire opening sequence without a single missile shot.
Title: Re: AI fires no missles?
Post by: karajorma on April 25, 2010, 09:08:02 am
Fook, I can't get at the retail missions as I don't have the CD handy.

The HOTU Crack Pack on my FAQ's Downloads Page has a cracked 1.2 exe which should solve that issue.
Title: Re: AI fires no missles?
Post by: General Battuta on April 25, 2010, 09:20:03 am
Fook, I can't get at the retail missions as I don't have the CD handy.

The HOTU Crack Pack on my FAQ's Downloads Page has a cracked 1.2 exe which should solve that issue.

Thanks.

Difference confirmed on 'Surrender Belisarius', retail vs. build 5862 no MVPs. Friendly fighters fire Rockeyes on retail, but do not fire them on 5862. On both versions, enemy Hercs will fire some Rockeyes, but much more frequently on retail.

Something broke retail AI.
Title: Re: AI fires no missles?
Post by: Dilmah G on April 25, 2010, 10:12:10 am
:(
Title: Re: AI fires no missles?
Post by: General Battuta on April 25, 2010, 10:23:05 am
Mantised. Hope I did it right.
Title: Re: AI fires no missles?
Post by: Sushi on April 26, 2010, 09:02:26 am
Fook, I can't get at the retail missions as I don't have the CD handy.

The HOTU Crack Pack on my FAQ's Downloads Page has a cracked 1.2 exe which should solve that issue.

Thanks.

Difference confirmed on 'Surrender Belisarius', retail vs. build 5862 no MVPs. Friendly fighters fire Rockeyes on retail, but do not fire them on 5862. On both versions, enemy Hercs will fire some Rockeyes, but much more frequently on retail.

Something broke retail AI.

Unfortunately, there are quite a few places where FSO breaks retail AI. QuantumDelta probably knows the most about the differences. I've investigated a few and have fixed them where I could find/reproduce them.

I'll look into this one ASAP. One important question (posted on Mantis as well) is when exactly this buggy behavior appeared.
Title: Re: AI fires no missles?
Post by: Reprobator on April 26, 2010, 12:46:43 pm
I use to mantis it already six month ago and i used to find from which build exactly the bug appear.

It seems like everyone is playing on insane around here  :nervous:
Title: Re: AI fires no missles?
Post by: chief1983 on April 26, 2010, 02:03:11 pm
Not me, I can't even beat the game on Hard.  Medium is pretty intense.  Course it could be the way the AI have behaved in recent years.
Title: Re: AI fires no missles?
Post by: General Battuta on April 26, 2010, 04:46:56 pm
I only play on Insane on retail, and frankly I've been spending most of my time with Fury's AI recently (as have many others), so that might be why this problem has gone unnoticed for so long. Thank goodness people picked up on it.
Title: Re: AI fires no missles?
Post by: Sushi on April 26, 2010, 05:11:36 pm
I use to mantis it already six month ago and i used to find from which build exactly the bug appear.

It seems like everyone is playing on insane around here  :nervous:

You're right, you did. It's even assigned to me.  :nervous:

Title: Re: AI fires no missles?
Post by: Reprobator on April 27, 2010, 02:00:58 am
It has been assigned automatically  :p
Title: Re: AI fires no missles?
Post by: Sushi on April 29, 2010, 01:54:41 pm
Found the problem: it was a subtle type-casting error introduced when I was doing some AI updates.

The code before:

Code: [Select]
firing_range = MIN((swip->max_speed * swip->lifetime * (Game_skill_level + 1 + aip->ai_class/2)/NUM_SKILL_LEVELS), swip->weapon_range);

The (broken) code after:
Code: [Select]
float secondary_range_mult = (aip->ai_secondary_range_mult == FLT_MIN)
? (Game_skill_level + 1 + (3 * aip->ai_class/(Num_ai_classes - 1)))/NUM_SKILL_LEVELS
: aip->ai_secondary_range_mult;

firing_range = MIN((swip->max_speed * swip->lifetime * secondary_range_mult), swip->weapon_range);

The fixed code:
Code: [Select]
float secondary_range_mult = (aip->ai_secondary_range_mult == FLT_MIN)
? (float)(Game_skill_level + 1 + (3 * aip->ai_class/(Num_ai_classes - 1)))/NUM_SKILL_LEVELS
: aip->ai_secondary_range_mult;

firing_range = MIN((swip->max_speed * swip->lifetime * secondary_range_mult), swip->weapon_range);

Basically, the problem is that the expression involving game_skill_level (and other integer variables) was previously being implicitly cast to float before division because it was multiplied with another float (swip->lifetime). When I moved that expression, that implicit cast from int to float was lost.

This is fixed in trunk rev. 6077, along with a couple of other AI bugs.
Title: Re: AI fires no missles?
Post by: Galemp on April 29, 2010, 05:14:41 pm
Uh... good! *hands Sushi a Kelp-flavored Cookie*