OpenXcom Forum
OpenXcom => Troubleshooting => Topic started by: Sander Bouwhuis on August 11, 2019, 10:16:07 am
-
When I turn on the 'Project predicted trajectory' setting, my interceptors go to the predicted UFO location, but then don't attack it. So, the UFO will just fly off and the interceptor just sits there idle.
Am I misunderstanding this feature? As it is now it is very annoying to constantly micromanage the interceptors (especially when you have 3 or so going to different UFOs at the same time).
-
You are not misunderstanding this feature. It is a bug that has been reported multiple times but turned out to be very hard to reproduce.
Most veteran players even advice against the feature (it has some other drawbacks as well according to them), even to the point that OXCE (a fork focused on more modding options and with Quality of life improvements) decided to remove that functionality.
-
Hard to reproduce?
Just send me a debug/logging build I can reproduce it 100% of the time. I have NEVER seen any time it actually worked.
-
It's hard to reproduce and fix because the behavior changes very subtly between platforms, and even if we can reproduce it we can't exactly determine why it happens, nobody knows how to implement the feature 100% effectively. Perhaps I should add an (experimental) to the description.
Anyways let me know if the latest round of "fixes" helps. If not post your 100% reproducible save.
-
Sup,
i'm not sure but ...
/**
* Gets the radian-angle to another Target on the Globe.
* @param target - pointer to other target
* @return, distance in radians
*/
double Target::getDistance(const Target* const target) const
{
const double lonTarget (target->getLongitude());
const double latTarget (target->getLatitude());
if (AreSameTwo(
_lon, lonTarget,
_lat, latTarget))
{
return 0.;
}
// else the formula below returns NaN <-----
return std::acos(
std::cos(_lat)
* std::cos(latTarget)
* std::cos(lonTarget - _lon)
+ std::sin(_lat)
* std::sin(latTarget));
}
might be worth a shot,
EDIT: I ended up writing this and sprinkling it around in various places (not necessarily the predict-destination routines exclusively)
/**
* Checks if val1 or val2 (lon,lat) is NaN or Inf.
* @note Checks validity of Globe coordinates.
* @param val1 - x-coordinate
* @param val2 - y-coordinate
* @return, true if either val1 or val2 is NaN or Inf
*/
template<class _Tx>
inline bool isNaNorInf(
const _Tx& val1,
const _Tx& val2)
{
if ( std::isnan(val1) || std::isnan(val2)
|| std::isinf(val1) || std::isinf(val2))
{
return true;
}
return false;
}
-
Sup,
i'm not sure but ...
might be worth a shot,
Nice catch. I'm pretty sure we always use reachDestination first but can't hurt to add an extra check. I don't wanna add too much though because this is code that has to run repeatedly each tick.
In most cases a NaN will just return false anyways so it's mostly harmless.
-
ok, just something to keep a mind on i guess
-
Ok, I tested some versions (and attached a save game).
v2019-08-08 21:43
100% fails. The ufo coming from Antarctica overshoots the UFO and stays idling for a while until continuing pursuit.
v2019-08-12 03:30
Sort of works. I see the engagement window flashing but not actually opening. It then immediately pursues the UFO.
v2019-08-12 22:21
Sort of works. I see the engagement window flashing but not actually opening. It then immediately pursues the UFO.
v2019-08-13 12:58
Sort of works. I see the engagement window flashing but not actually opening. It then immediately pursues the UFO.
Is it because the UFOs are flying so fast that there will be a millisecond of engagement before the UFO outruns the Interceptor again?
-
You guessed correctly.
The crafts is able to intercept (because it is approaching from the front).
However the ufo speed is 2200, you interceptor can only do 2100, e.g. the ufo outruns your interceptor immediately.
-
But why does it happen only when Predict UFO Trajectory is turned on?
And not when it is turned off...
-
Because the prediction is too good at it's job ;)
Joking aside, as far as i understand from the code (supsuper can probably explain it much better):
Predict Ufo Trajectory sets the destination of the craft to the exact point where they would meet, satisfying the condition for "interception" when both the craft and the ufo arrive there at the same moment.
Default behavior (option off) is for the craft to set it's destination to the last known position of the ufo.
For this collision course case it is highly likely for the craft destination to lie behind the actual meeting point. E.g. craft has to turn around and start chasing the ufo again. The condition for "interception" is not met, and since the ufo is faster we see the classic chase we all know too well.
-
New fix is up, let me know if it's more consistent between both modes. Mainly if there's still any cases where a craft gets "stuck" and stops chasing the UFO.
-
anyone?
-
Ok, I tested it with the new 2019-08-14 02:02 version.
It seems to work significantly better now. For me, it seems like this is fixed.
Maybe there are some edge cases, but now I can turn this option on again. Thanks for the swift fixes!
-
You are not misunderstanding this feature. It is a bug that has been reported multiple times but turned out to be very hard to reproduce.
Most veteran players even advice against the feature (it has some other drawbacks as well according to them), even to the point that OXCE (a fork focused on more modding options and with Quality of life improvements) decided to remove that functionality.
I'm assuming the downsides aren't just "makes the game easier through use of Actually Sensible Interceptor Pilots" and has more to do with implementation (or the pilot AI needing to cheat by reading the UFO's planned moves). I mean, it feels good to tell your pilots "Don't go where the X-Ray is, follow the damn flight pattern!" but if it doesn't actually help, or it cheats for you...
(yes i prefer 1rn in fire emblem why'd you ask)
-
I'm assuming the downsides aren't just "makes the game easier through use of Actually Sensible Interceptor Pilots" and has more to do with implementation (or the pilot AI needing to cheat by reading the UFO's planned moves). I mean, it feels good to tell your pilots "Don't go where the X-Ray is, follow the damn flight pattern!" but if it doesn't actually help, or it cheats for you...
(yes i prefer 1rn in fire emblem why'd you ask)
It doesn't cheat.
But there's a multitude of subtle problems with it, making it basically unusable (without carefully checking what it is doing, which defies its purpose). In OXC.
In OXCE, it's even worse.
(or would be... I just removed it completely)
-
It doesn't cheat.
But there's a multitude of subtle problems with it, making it basically unusable (without carefully checking what it is doing, which defies its purpose). In OXC.
In OXCE, it's even worse.
(or would be... I just removed it completely)
So implementation then. Gotcha.
-
The vanilla behavior goes to where the UFO is, the predicted behavior goes to where the UFO will be. The latter is more effective if the UFO keeps flying in a straight line.
But UFOs randomly change direction, which neither behavior can guess (that would be cheating), so you're always at the mercy of the RNG.
-
Maybe a stupid/obvious idea, but why don't the airplanes simply constantly adjust their heading so as to fly directly to the UFO's current position? That wouldn't be cheating, and the player wouldn't have to micromanage the multiple airborne vehicles to make sure they don't stand still without actually pursuing their targeted UFO.
-
Maybe a stupid/obvious idea, but why don't the airplanes simply constantly adjust their heading so as to fly directly to the UFO's current position? That wouldn't be cheating, and the player wouldn't have to micromanage the multiple airborne vehicles to make sure they don't stand still without actually pursuing their targeted UFO.
That's exactly what happens when you have the "predict UFO trajectory" turned off.
Perhaps the way to improve the prediction option would be to have it turn off automatically when the interceptor and the target are under a certain distance from each other. That distance could even me related to the relative speeds of the interceptor and the UFO to help prevent overshooting the target when the interceptor is much faster.