Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Clouds impact on aircraft detection  (Read 86 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6066
Clouds impact on aircraft detection
« on: January 22, 2025, 01:44:33 PM »

In looking over FlightModel.class I see the following three methods in which aircraft detection is dependent on the cumulus clouds:

- isNightTargetVisible() hasn't yet been well enough deciphered by this non programmer, and so I can't comment on any potential weaknesses. Although I do note that for worse weather there is a differing scaling factor derived from sunMultiplier which is applied.

- isComingFromTheSun() and isTargetExposed() are functionally very similar, they dealing with the Sun and Moon, respectively. Both are inapplicable when the searching aircraft is less than a small, fixed threshold distance of 200m above the cloud base and when the cloud type is 4, 5 or 6 (poor, rain/snow or thunder.) This is an awfully small height range! When the weather worsens the cloud thickness between base and top increases. And if one uses a cloud mod that makes them larger than stock, this is further amplified. I would be inclined to increase this threshold, and vary it by cloud type. For instance, as a first guess for stock cloud types 4, 5 and 6 I might prefer threshold values of 400m, 600m and 800m, respectively (testing would be wise to undertake.) And for mods making the clouds bigger, even larger values would apply. For instance, in my own cloud mod where the stock size parameter of 2.5 is replaced by my value of 3.5, for thunder weather the cloud tops are several thousand meters above the base; a threshold cut-off of cloud base height + 3,000m would not be out of bounds.

Furthermore, these methods don't appear to consider the effect of the light source (Sun/Moon) altitude above the horizon. (They do consider how far angularly the target aircraft is from the light source.) As the Sun or Moon gets lower in the sky the line of sight through intervening cloud tends to increase This would imply a varying threshold height tied to light source altitude; Decreasing light source altitude leads to an increasing height threshold.

Finally, this line
                float f1 = cvt(f, 100F, 3000F, 2.9F, 3F);
would seem to be unnecessarily complex. For object f ranging between 100 and 3000, the resulting object f1 ranging between 2.9 and 3 is almost to not vary at all. Why not set this to a continuous 2.95? This line could be omitted, and the following would be written as
                if(d > 2.95D)
Unless there is a real significance in the tiny difference of 0.1 that I'm missing?


I raise these points as potential fixes for cases where aircraft detection by AI seems to be spookily good.  ;)

Code: [Select]
    private boolean isNightTargetVisible(Actor actor, float f)
    {
        float f1 = World.Sun().sunMultiplier;
        int i = Mission.curCloudsType();
        float f2 = Mission.curCloudsHeight();
        float f3 = 500F;
        if(((Actor) (am)).pos.getAbs().getZ() < actor.pos.getAbs().getZ())
        {
            if(actor.pos.getAbs().getZ() < (double)(f2 + f3))
                if(i > 2)
                    f1 *= 1.2F;
                else
                if(i > 3)
                    f1 *= 1.3F;
            f1 *= 1.1F;
        } else
        if(actor.pos.getAbs().getZ() > (double)(f2 + f3))
            if(i > 2)
                f1 *= 1.2F;
            else
            if(i > 3)
                f1 *= 1.3F;
        v3.sub(((Actor) (am)).pos.getAbsPoint(), actor.pos.getAbsPoint());
        float f4 = cvt(f, 0.0F, 3F, 0.75F, 1.2F);
        float f5 = cvt((float)v3.length(), 0.0F, 800F, 1.0F, 0.1F);
        float f6 = cvt(f1, 0.095F, 1.0F, 1E-005F, 0.06F) * f5 * f4;
        float f7 = World.Rnd().nextFloat();
        return f7 < f6;
    }

    private boolean isComingFromTheSun(Actor actor)
    {
        if((actor instanceof Aircraft) && ((Tuple3f) (World.Sun().ToSun)).z > 0.0F)
        {
            if(Mission.curCloudsType() > 3 && actor.pos.getAbs().getZ() < (double)(Mission.curCloudsHeight() + 200F))
                return false;
            v3.set(((Tuple3f) (World.Sun().ToSun)).x, ((Tuple3f) (World.Sun().ToSun)).y, ((Tuple3f) (World.Sun().ToSun)).z);
            v2.sub(((Actor) (am)).pos.getAbsPoint(), actor.pos.getAbsPoint());
            float f = (float)v2.length();
            v2.normalize();
            double d = v3.angle(v2);
            float f1 = cvt(f, 100F, 3000F, 2.9F, 3F);
            if(d > (double)f1)
                return true;
        }
        return false;
    }

    private boolean isTargetExposed(Actor actor)
    {
        if(actor instanceof Aircraft)
        {
            Aircraft aircraft = (Aircraft)actor;
            if(((FlightModelMain) (((SndAircraft) (aircraft)).FM)).AS.bLandingLightOn || ((FlightModelMain) (((SndAircraft) (aircraft)).FM)).AS.bNavLightsOn || ((FlightModelMain) (((SndAircraft) (aircraft)).FM)).CT.WeaponControl[0] || ((FlightModelMain) (((SndAircraft) (aircraft)).FM)).CT.WeaponControl[1])
                return true;
            if(((Tuple3f) (World.Sun().ToMoon)).z > 0.0F)
            {
                if(Mission.curCloudsType() > 3 && actor.pos.getAbs().getZ() < (double)(Mission.curCloudsHeight() + 200F))
                    return false;
                v3.set(((Tuple3f) (World.Sun().ToMoon)).x, ((Tuple3f) (World.Sun().ToMoon)).y, ((Tuple3f) (World.Sun().ToMoon)).z);
                v2.sub(((Actor) (am)).pos.getAbsPoint(), actor.pos.getAbsPoint());
                float f = (float)v2.length();
                v2.normalize();
                double d = v3.angle(v2);
                float f1 = cvt(f, 100F, 3000F, 2.9F, 3F);
                if(d > (double)f1)
                    return true;
            }
            return false;
        } else
        {
            return false;
        }
    }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: [1]   Go Up
 

Page created in 0.03 seconds with 25 queries.