Author Topic: Missiles in FSO, a horror story.  (Read 2141 times)

0 Members and 1 Guest are viewing this topic.

Offline Doko

  • 26
Missiles in FSO, a horror story.
I've noticed that sometimes while dogfighting, an enemy AI craft will manage to disengage, either due to manouvers or speed, and will then be face to face with the player. Everything is normal so far. What is not normal is the fact that it can sometimes get an aspect lock in what appears to be under a second and instantly kill you.
So I decided to do some testing and the results are... interesting to put it mildly.

--------------------------------------------------
TEST Mission SETUP:

- NO mod FSO, 3.7.2 SSE2 -

player Hercules, default primary banks, 1 tornado bank, 2nd empty bank. - coordinates 0,0,0 - Initial velocity: 0
Enemy  Hercules, default primary banks, 1 tornado bank, 2nd empty bank. - coordinates 0,0,3000 - Initial velocity: 0

Player in wing Alpha
Enemy in wing Aries (wing order, attack Alpha 1)

I literally lift my hands off the keyboard when the mission starts.

As expected the enemy will close in on the player and start launching missiles.

@insane difficulty:

- The AI will launch missiles at aprox. 1850-1875 metters away from the player. With no lock warning. It goes straight to incoming missile warning. (these missiles appear to have no lock)
- At the above distance the player doesn't even have an aspect lock.
- The player will start getting a lock at aprox 1600-1625 metters.
-

And here is where it gets really weird.

If the player continues to do nothing. The first 3 or so volleys of tornados will detonate (from running out of fuel) in front of the player with the 4th set correctly impacting the player.
Instead, if the player decides to try and evade the missiles once they are launched by setting a course perpendicular to the enemy fighter's vector. Those same missiles that would've detonated in front of the player will instead hit him.
Furthermore if the player accelerates, then stops, well before the enemy missiles are fired (i.e. D > 2500), the missiles will now lock correctly.
If the mission is modified to set the initial velocity of the player to > 1, missiles will hit the player, although the AI will still fire without a lock.

@hard same problem
@medium same problem, but (see at the end) staying at coordinate origin (0,0,0) will still allow these missiles to hit, even though they lack lock.


----------------------------------------------

2nd test mission

The enemy fighter is now at 1000 metters away facing away from the player. His wing ordered to play dead until 5 seconds into the mission and set to immobile via SEXP . 5 seconds in, his orders cleared and ordered to attack the player's wing.

The AI will face the player (for some reason there is a short warning lock as the enemy ship starts to turn, yet never faces me directly). And as soon as a lock is acquired by the enemy fighter it will start firing its tornados at me, except not a single one will ever reach me. Presumably from the initial velocity 0 bug mentioned above.

Should the player try to evade these missiles that would otherwise never hit him, they will connect. Modifiying your speed by only a few m/s will make the missiles hit correctly. It's almost like if they were smartly seeking your thrusters! (except I'm pretty sure they arent!)


----------------------------------------------

3rd test mission

Enemy fighter starts with its engine disabled at 3000 metters, facing away from the player, its wing ordered to attack the player. 5 seconds in, its engine is repaired via repair subsystem sexp. The fighter will turn, face the player and once again shoot from 1850-1875 metters. Missiles will not connect at the difficulties the same problem presented itself in test1 (insane/hard)

----------------------------------------------

What do all of these have in common?

The player is at 0,0,0 in the world grid. Moving the player out of that magical spot allows missiles to actually lock on to him.
Another mission I tried with an enemy fighter disabled, at 0,0,0 will allow the player to get a lock, but missiles will never head towards it until you hit it with a primary that pushes it from exactly 0,0,0

------------

Conclusions:

- Coordinate origin breaks things.
- The ai seems to be able to ignore aspect locks, but not always.
- The ai can fire missiles further away than the player at insane difficulty and have its missiles lock mid flight, which could cause some unpredictable behavior at closer range.
- This is not something critical, but someone might want to take a look at the code.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Missiles in FSO, a horror story.
The origin can be represented as a null vector (IIRC), which could cause some interesting behaviours unless it's specially catered for, you may have hit one of them. I think this is a consequence of the co-ordinate system/vector maths that FSO uses (that's, um... Euler angles (?), also see gimbal lock in wikipedia?), I *think* using quaternions is an alternative that avoid this issue... or rotation matrices which FSO *does* use anyway... *scratches head* (watch me flail around with terms I don't fully understand!! :))

ANYWAY, regarding insta-lock I do know that the AI doesn't have to get the lock-tri over the target to get a lock - all that stuff is done in the HUD code which is player only, so the AI can achieve missile lock from oddball angles that the player can't. This also manifests at the AI firing bombs "off axis" at their targets, especially when they're close, I'm guessing that they're targeting a subsystem which is off to one side but which is still within missile view cone...
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Missiles in FSO, a horror story.
The homing code treats the null vector/mission origin as "not locked" or otherwise unset for a variety of things, so that will cause oddities (and is considered an acceptable tradeoff for not having to rewrite the entire homing code right now, since the probability of a ship being at exactly 0,0,0 without the FREDer putting them there is slim to none).
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.

 
Re: Missiles in FSO, a horror story.
Just FYI - it's always been like this,  since FS1 pre-release :P
"Neutrality means that you don't really care, cuz the struggle goes on even when you're not there: Blind and unaware."

"We still believe in all the things that we stood by before,
and after everything we've seen here maybe even more.
I know we're not the only ones, and we were not the first,
and unapologetically we'll stand behind each word."

 

Offline Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
Re: Missiles in FSO, a horror story.
Also, this happened while testing ships moving at 500 m/s, and missiles moving five times than the former. Regardless of any difficulty, they seem to fire missiles at 2 km or less.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Missiles in FSO, a horror story.
The AI is hardcoded for the speeds and ranges prevalent in FS2. Making those values moddable has been on the to-do list for a while.
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 Bryan See

  • Has anyone really been far as decided to use even go want to do look more like?
  • 210
  • Trying to redeem, but under Tiger Parents
    • Skype
    • Steam
    • Twitter
Re: Missiles in FSO, a horror story.
In addition to making those values moddable, it can be scripted via lua, making it dynamically as the game goes.
Bryan See - My FreeSpace Wiki User Page (Talk, Contributions)

Full Projects:
Shattered Stars

Campaigns:
Lost in the Mist - Cyrene vs. Psamtik
FreeSpace: Reunited

Ships:
GTS Hygeia, GTT Argo, SC Raguel

Tools:
FSO TC/Game template

I've been under attack by Tiger Parents like Jennifer Pan...