Author Topic: Issue with A.I. and fighter mounted beams  (Read 3075 times)

0 Members and 1 Guest are viewing this topic.

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Issue with A.I. and fighter mounted beams
So the issue with fighter mounted beam weapons is this: If the A.I. has only beam weapons equipped, they will fire at targets far beyond the weapon's maximum range.
If the A.I. has one beam weapon equipped and one normal primary weapon, they do respect maximum weapon range.

This bug wouldn't be that big of a deal to work around, by just making sure the A.I. always comes equipped with primaries other than beams. But the A.I. can't handle having two target lead indicators either. They'll fire infront of the target because of the normal weapon, and end up missing most of their beam shots.

Please aid me, code wizards.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Issue with A.I. and fighter mounted beams
Workaround: can you disable primary linking on the beam weapon?

 

Offline JSRNerdo

  • [`_`]/
  • 29
  • Gone!
Re: Issue with A.I. and fighter mounted beams
What are velocity/lifetime/weapon range set to on the beam weapon? IIRC the AI determines range by velocity*lifetime or weapon range, not sure how exactly.
Former Inferno lead, BTA fredder-ish and DE fredder. Driven out by ordinary fascists the_e, aesaar and general battuta. Will return if they're ever removed.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Issue with A.I. and fighter mounted beams
What are velocity/lifetime/weapon range set to on the beam weapon? IIRC the AI determines range by velocity*lifetime or weapon range, not sure how exactly.

The AI respects the range (not velocity*life) you give it on normal primaries, dunno about beams.

 
Re: Issue with A.I. and fighter mounted beams
Do you have +Range: in $Beam info specified?

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Issue with A.I. and fighter mounted beams
Do you have +Range: in $Beam info specified?
What are velocity/lifetime/weapon range set to on the beam weapon? IIRC the AI determines range by velocity*lifetime or weapon range, not sure how exactly.
I mean, I get you guys are trying to be helpful, but can we just assume for a moment here that I know all of these things after years and years of modding, and have the weapons set up correctly and that this is an actual engine bug?  :p

But here, see for yourself:

Code: [Select]
$Name:                          Fusion array
+Title:                          XSTR("Fusion array (Medium)", -1)
+Description:
XSTR("Effective range: 2000
Damage type: Energy
Damage: 8 vs Hull, 5 vs Shield
Rate of Fire 0.75 - Beam | Power usage 3", -1)
$end_multi_text
+Tech Title:     XSTR("Fusion array (Medium)", -1)
+Tech Anim:     none
+Tech Description:
XSTR("The result of a series experiments with fighter-based beam weapons, the Fusion Array is a medium-powered fighter based direct line-of-sight weapon. The fusion-pumped laser beam connects nearly instantaneously, thus no leading of targets is required. The Fusion Array has an excellent damage rating, though it consumes significant amounts of weapon energy during sustained fire.", -1)
$end_multi_text
$Tech Model: Beammodel.pof
$Model File:                    none
@Laser Bitmap:                  laserglow01
@Laser Color: 220, 180, 30
@Laser Length: 0.0
@Laser Head Radius: 0.30
@Laser Tail Radius: 0.30
$Mass:                          0
$Velocity:                      4000
$Fire Wait:                      0.75
$Damage:                        8
$Damage Type:                    Energy
$Armor Factor:                  1.0
$Shield Factor:                  1.0
$Subsystem Factor:              1.0
$Lifetime:                      0.5           
$Energy Consumed:                5
$Cargo Size:                    0
$Homing:                        NO
$LaunchSnd:                      205           
$ImpactSnd:                      248             
+Weapon Range: 2000
$Flags:                          ( "beam" "player allowed" "no pierce shields" )
$Icon:                          wi_fusionarray
$Anim:                          wa_fusion
$Impact Explosion:              ExpMissileHit1
$Impact Explosion Radius:        8.0
$BeamInfo:
+Type: 0
+Life:   0.5
+Warmup:   100
+Warmdown: 0
+Radius:   1
+PCount: 0
+PRadius: 0
+PAngle: 0
+PAni: particle_yellow
+Miss Factor: 1 1 1 1 1
+BeamSound: 205
+WarmupSound: -1
+WarmdownSound: -1
+Muzzleglow: beamglow6
+Shots: 0
+ShrinkFactor: 0.2
+ShrinkPct: 0.3
+Range: 2000
+Attenuation: 0.96
$Section:
+Width: 0.1
+Texture: Beam-White2
+RGBA Inner: 255 255 255 255
+RGBA Outer: 150 150 150 10
+Flicker: 0.0
+Zadd: 2.0
$Section:
+Width: 0.3
+Texture: VasBeam2Core
+RGBA Inner: 250 160 50 255
+RGBA Outer: 250 160 50 10
+Flicker: 0.0
+Zadd: 1.0
$Section:
+Width: 0.5
+Texture: VasBeam2Glow
+RGBA Inner: 250 160 50 255
+RGBA Outer: 250 160 50 10
+Flicker: 0.1
+Zadd: 0.0

Workaround: can you disable primary linking on the beam weapon?
That's not a viable option here.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 
Re: Issue with A.I. and fighter mounted beams
I'm sorry for my blasphemy :D

Just tested around with fighterbeams and noticed something: which hierarchy are you using? I tried a ship with ("Shivan Fighter Beam" "Shivan Mega Laser"). The only bank firing was the beam, with deadly precision. The other bank fired next to never (only when I was directly in front of the ship and did not move). Apparently only the first bank is used for target calculation. Secondary banks worked normal.

 
Re: Issue with A.I. and fighter mounted beams
I know that the way $AI In Range Time: works is really weird and counter-intuitive(The AI will sometimes lock onto and fire missiles at targets beyond their maximum range for example), so maybe something's breaking there in regards to beam weapons or other weapons with very high $Velocity.

Have you tried lowering velocity(It only affects how hard you whack things anyway) and seeing if the AI underps itself? Does playing on a difficulty with $AI In Range time: of 1 or greater help at all?
[19:31] <MatthTheGeek> you all high up on your mointain looking down at everyone who doesn't beam everything on insane blindfolded

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Issue with A.I. and fighter mounted beams
I'm sorry for my blasphemy :D

Just tested around with fighterbeams and noticed something: which hierarchy are you using? I tried a ship with ("Shivan Fighter Beam" "Shivan Mega Laser"). The only bank firing was the beam, with deadly precision. The other bank fired next to never (only when I was directly in front of the ship and did not move). Apparently only the first bank is used for target calculation. Secondary banks worked normal.
Yes, I know, the A.I. leads with the first bank it has. I don't think it really matters regarding this bug, as long as any of its bank has a weapon other than the beam weapon it'll behave. What bank the weapons are set in doesn't seem to change anything.


I know that the way $AI In Range Time: works is really weird and counter-intuitive(The AI will sometimes lock onto and fire missiles at targets beyond their maximum range for example), so maybe something's breaking there in regards to beam weapons or other weapons with very high $Velocity.

Have you tried lowering velocity(It only affects how hard you whack things anyway) and seeing if the AI underps itself? Does playing on a difficulty with $AI In Range time: of 1 or greater help at all?
Changing $AI In Range Time: to any number doesn't do anything for this bug.

Velocity does matter though, that's how the game calculates the lead indicator. So if you want a beam weapon to actually have an accurate lead indicator for a beam weapon, it needs to have a high velocity.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Issue with A.I. and fighter mounted beams
I know that the way $AI In Range Time: works is really weird and counter-intuitive(The AI will sometimes lock onto and fire missiles at targets beyond their maximum range for example)
"$AI In Range Time:" has literally no effect on missiles; it only modifies how well the AI predicts where to aim its primary weapons.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Axem

  • 211
Re: Issue with A.I. and fighter mounted beams
Hey so after investigating this a bit, apparently the AI does not check lifetime or range of a primary before firing. Only weapon speed. (Which MageKing confirmed)

FreeSpace. Never change. :cool:

(I think an AI Profile flag like $Actually Use Weapon Range For Primary Firing: would be awesome)

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Issue with A.I. and fighter mounted beams
I think an AI Profile flag like $Actually Use Weapon Range For Primary Firing: would be awesome
Shouldn't be too hard to implement, either; compute the "do I want to fire at this distance" range like it currently does, then use the min() of that or the weapon's actual range. I'll take a stab at it.

EDIT: And done.
« Last Edit: June 28, 2018, 07:23:06 am by AdmiralRalwood »
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Issue with A.I. and fighter mounted beams
Yayifications
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them