Special Aircraft Service

Please login or register.

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

Author Topic: Some recent tweaking  (Read 645 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Some recent tweaking
« on: November 09, 2019, 10:03:16 PM »

[Added in edit, Dec 3, 2019]

For other modders who can work with Java, I include snippets of relevant code (starting in reply #10) that you can easily incorporate or experiment with.

[END of edit]


In a continuation of some 4.09 fiddling, I've been carrying things over to 4.12, and exploring some new stuff. Here are some little 'projects' recently done, via Java code poking about:

1) Increase the range of head swiveling with head tracking. In azimuth, from 150 to 180 degrees. Looking down, from -60 to -75 degrees. Looking up, from 89 to 135 degrees. All this means that it's now not so common to hit the 'hard stops', and so the experience is less constrained and more natural feeling.

2) Expand the range of 6DoF motion for a number of planes. The 4.12 (possibly earlier?) cockpit classes for some or most planes have a line entry setting for limiting the range of fore-aft, left-right and up-down head movement. In some cases this has been set conservatively in one or more directions, usually to hide cockpit gaps.

If a 'pit has no such line entry in code, it uses a set of global defaults defined in another class file. But I've added such a line for those planes cockpit classes that I've wanted to adjust and which formerly used the defaults.

In most cases, I've increased the forward range of movement by 10-15cm, and downward by easily as much. By expanding these ranges, it's easier to shift about so as to get canopy framing out of the line of sight.

3) Alter the fog intensity by cloud type. For blind weather, change from second worst to worst. For rain/snow, change from worst to second worst. I've left the others as is.

Because I use Mission Pro Combo Plus, I had to pull out and alter the nine class files related to Mission.class. The code changes are trivially simple. I *might"* look into incorporating a set of entries in the [mods] section of conf.ini, which of course would obviate Java code alteration. But right now other tidbits command priority. ;)
Logged

SAS~Malone

  • flying as #46 with the FAC
  • Editor
  • member
  • Offline Offline
  • Posts: 14502
  • proud member of that 'other' site
Re: Some recent tweaking
« Reply #1 on: November 09, 2019, 11:19:13 PM »

sounds great, mate! keep tweaking! :D
Logged
.....taking fun seriously since 1968.....  8)

tomoose

  • Modder
  • member
  • Offline Offline
  • Posts: 1145
  • Iiiiiiiit's ME! Hurrah!!
    • 71 "Eagle" Squadron
Re: Some recent tweaking
« Reply #2 on: November 11, 2019, 11:00:09 AM »

May I suggest more sideways movement for the 6DOF (i.e. to simulate leaning out of the canopy to see when your windshield is covered in oil).
cheers,
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #3 on: November 11, 2019, 02:07:38 PM »

'Moose,
When the canopy is closed one does not want to get too close to the sides, else clipping occurs. When the canopy is opened, then of course one can effectively 'lean' arbitrarily far via the positioning of the appropriate additional PoV in the ViewHooks section (usually in body.msh, or mainehull.msh).

For formerly closed-only 'pits, the addition of the openable canopy permits to add the additional PoV, which I've done in a couple of instances.

For open pits, then of course the side lean range could be much expanded.

What would be neat is if one could set two different range limits, based on whether the canopy is open or closed. I suppose a coder more capable than me could devise such a method?...
Logged

tomoose

  • Modder
  • member
  • Offline Offline
  • Posts: 1145
  • Iiiiiiiit's ME! Hurrah!!
    • 71 "Eagle" Squadron
Re: Some recent tweaking
« Reply #4 on: November 11, 2019, 03:13:55 PM »

WxTech;
Yup, exactly what I was getting at.  I just experienced the limitations while trying to land my damaged Spitfire with the windshield caked in oil.  Opened the canopy but only a limited ability to 'lean' out made for a very rough landing (although I still walked away). ;)
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #5 on: November 16, 2019, 05:00:41 PM »

In 4.08/4.09, when using my old AAA 6DoF mod and while 'head out' as the canopy was opened, I was able to still move my PoV L/R, fore/aft and up/down. It was great. Now in 4.12 I find that my position is locked down, where I can only swivel my virtual noggin. Anyone know how to get back the full 6DoF action when activating the 'head out' view with canopy opened?
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #6 on: November 16, 2019, 05:12:58 PM »

Yesterday I installed into my 4.12.2 game the Martlet I and II, and the Martlet IV mods available here (in US Singles, and UK Singles fora, respectively.) I put notice postings in those two threads, outlining the following:

- Updated to my Wildcat cockpit standard, with British GM-1 gun sights.
- Changed the base 'pit for the Martlet IV from F4F-3 to -4.
- Expanded the range of 6DoF movement limits.
- Incorporated the improved spinning prop mod (looks properly thick when seen from the side, and not as a zero-thickness disk), retaining the smoothed hub given these mod planes.

When I'm satisfied after tackling an outstanding issue or two, I'll release these mods as full standalones, to replace the originals. I don't know if the addition of 6DoF limit parameters impacts compatibility with earlier game versions (e.g, 4.09), and so I might have to supply an additional set of class files leaving this feature out--just in case.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #7 on: November 23, 2019, 11:46:52 PM »

Some other stuff, some recent and others over the past year (starting with 4.09/4.09, then carrying over to 4.12.)

- For the telescopic sights when playing on a 16:9 display ratio, changing the sight view FoV from the former 31 degrees to 45. The older value of 31 is fine for 4:3 screen aspects, but with wide screens there is much clipping of the top and bottom of the circular field. The additional benefit of the lesser zooming in is better flying control.

- This is a rather more involved project, requiring tens of hours at the keyboard. Namely, rationalizing the bullet/cannon values for "Power" in the gun classes, and coordinating these with the values in code with which to determine the called hit effects in Explosions.class. For my taste, there was a bit much 'scatter' in the values for Power among the gun classes. I devised a logical table of values for the different calibers (keeping pretty much in line with the basic scheme already established), and have most gun classes so altered. The class file code employs randomness, which I refined also. The aim also was to better differentiate among the hit effects for the various calibers. This involved tweaking all the hit effect files as well. For example, now the difference between .30 and .50 hits are more pronounced, with the flash and (occasional, random) smoke puffs for the smaller bullets being more subtle than previously.

- Toning down the intensity of light from explosions and rocket flames which illuminate their surroundings, and making the color warmer in hue.

- Making the light from landing lights a warm white, more like the color for the lamp's 'on' graphic. The stock cyan-blue color cast is just awful--I've seen many a real landing light in operation. (I might similarly alter the searchlights as well.)
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #8 on: December 02, 2019, 09:34:59 PM »

I just pretty much settled on my latest fiddling for aircraft lights:

- Reduced the intensity of the self illumination for the navigation lights. The stock effect was cartoonishly bright, with the plane exterior and interior being far too strongly lit up in green and red. Nav lights just don't do that.

- Also reduced the same self illumination for the landing light. The housing is after all designed to direct as much energy as possible in a focused beam. And for such lights *under* a wing, or otherwise shadowed, it's crazy to have the cockpit (and other shadowed areas) lit up to any great degree.

- Made both the landing light plane illumination and the ground spot of light it generates a warm-hued tone, as opposed to the utterly wrong bluish color we've suffered all these years.

- Increased the projection distance for the landing light from 1,000m to 3,000m. 1km is a bit short, given the fairly good degree of focusing for such lamps. The landscape illumination intensity is still constrained to the stock limits, albeit 'stretched' out over that longer range. But that's valid. I considered altering the scaling factor, so that at nearer range the intensity would be rather stronger. But the way different objects respond to the light source kept me from pursuing this track. The pop-up trees *really* glow brightly with this method (which is the very same as for the lightning ground strike effect.) And the layered forest textures don't respond whatsoever, remaining 'black.'

You see, the landing light scheme is a simple thing that's very much a fiction. The generated light is *not* from the landing lamp. Instead it's simply a source placed on or near the ground where the lamp is pointing. This light is just like a light bulb magically transported to that spot. And so the ground pattern of the lighting *is always circular* as seen from directly above that spot. And so the virtual pilot sees a highly foreshortened elliptical spot due to his shallow sight line on approach.

In reality, with the cone of light coming from immediately beside the pilot, he would see the scenery *always* as circularly lit up in projection. That is, at shallow approach angles the ground spot, as seen from directly above, would be a very highly elongated ellipse with the long axis aligned with the plane. But again, the pilot would see a circular pattern of illumination, just as you do when exploring a blacked-out house with a flashlight.

Anyhoo, the effect of a more properly colored landing light, operating over a rather longer range, is wonderful. And the plane itself not being lit up like near daytime by this and the nav lights is a further improvement, in my books.

These changes involve Aircraft.class and AircraftState.class. It's certain there are one or more other mods that have altered these classes, and so the best approach is for those mod authors to incorporate my additions into their work--if they're curious. ;)

I'll supply the relevant Java code snippets. Making the changes is dead easy, where just a few lines are involved.

But I suppose some players may well not have any mods already that have altered these classes. In such case I should make the classfiles available. They're  for 4.12, and I'll include the Java files so that other modding folk can make the changes for other game versions (like 4.09 in particular, where the classes differ significantly.)
Logged

shardana

  • member
  • Offline Offline
  • Posts: 491
Re: Some recent tweaking
« Reply #9 on: December 03, 2019, 09:54:25 AM »

Hi Mate! all your valuable work is making this old game absolutely update as a sim! I wonder if all these wonderful stuff will be released as an all inclusive stand alone Mod easy to install. that would be just great for us numb users!
Thank you again and keep on with this fantastic job of yours! Ciao!
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #10 on: December 03, 2019, 06:14:44 PM »

As promised, some code snippets:

First, from Aircraft.java (Aircraft.class), and the method, updateLLights(). This is from 4.12, but probably unchanged to any meaningful degree from early days of the game.

For changing the landing light illumination color on the ground, as well as the limit to its visibility. (In the next post I'll supply the code to alter the landing light illumination of its host plane, as well as for the nav lights.)

The stock color is rather bluish. I altered the RGB values to make the red a bit stronger and the blue a bit weaker than the green; this makes for a warm white. (If one desires a pure white, make all RGB values identical.)

The visibility is boosted to 3km, from the stock value of 1km. Nearer to reality, and makes for a better executed approach in darkest night. ;)

The original lines of code are retained, but disabled by the bracketing characters, /*     */. This speeds up finding the lines to edit.

Code: [Select]
    public void updateLLights() {
pos.getRender(_tmpLoc);
if (lLight == null) {
    if (!(_tmpLoc.getX() < 1.0)) {
lLight = new LightPointWorld[] { null, null, null, null };
for (int i = 0; i < 4; i++) {
    lLight[i] = new LightPointWorld();
/*     lLight[i].setColor(0.49411765F, 0.9098039F, 0.9607843F); */
    lLight[i].setColor(0.96F, 0.91F, 0.84F);
    lLight[i].setEmit(0.0F, 0.0F);
    try {
lLightHook[i] = new HookNamed(this, "_LandingLight0" + i);
    } catch (Exception exception) {
/* empty */
    }
}
    }
} else {
    for (int i = 0; i < 4; i++) {
if (FM.AS.astateLandingLightEffects[i] != null) {
    lLightLoc1.set(0.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
    lLightHook[i].computePos(this, _tmpLoc, lLightLoc1);
    lLightLoc1.get(lLightP1);
/*     lLightLoc1.set(1000.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F); */
    lLightLoc1.set(3000.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
    lLightHook[i].computePos(this, _tmpLoc, lLightLoc1);
    lLightLoc1.get(lLightP2);
    Engine.land();
    if (Landscape.rayHitHQ(lLightP1, lLightP2, lLightPL)) {
lLightPL.z++;
lLightP2.interpolate(lLightP1, lLightPL, 0.95F);
lLight[i].setPos(lLightP2);
float f = (float) lLightP1.distance(lLightPL);
float f_105_ = f * 0.5F + 30.0F;
/* float f_106_ = 0.5F - 0.5F * f / 1000.0F; */
float f_106_ = 0.5F - 0.5F * f / 3000.0F;
lLight[i].setEmit(f_106_, f_105_);
    } else
lLight[i].setEmit(0.0F, 0.0F);
} else if (lLight[i].getR() != 0.0F)
    lLight[i].setEmit(0.0F, 0.0F);
    }
}
    }


Incidentally, from the same Aircraft.class is the following error present from year dot (i.e., since around the game's release). The bail probability method has mis-spelled "Arone" as "Aroone"!!!

Here's my tweak, with two additional lines to further check on damage to the other aileron before the AI decides to bail when one aileron is destroyed. The original 2 lines are REM'ed out with /*  */ characters bracketing them, and the correct line follows the 2 new test conditions.

Code: [Select]
    protected float bailProbabilityOnCut(String string) {
if (string.startsWith("Nose"))
    return 0.5F;
if (string.startsWith("Wing"))
    return 0.99F;
/* if (string.startsWith("Aroone")) //bad spelling!
    return 0.05F; */
/*  start NEW  */
if (string.startsWith("AroneL") && !isChunkAnyDamageVisible("AroneR"))
    return 0.99F;
if (string.startsWith("AroneR") && !isChunkAnyDamageVisible("AroneL"))
    return 0.99F;
/*  end NEW  */
if (string.startsWith("Arone"))
    return 0.1F;
if (string.startsWith("Tail"))
    return 0.99F;
if (string.startsWith("StabL") && !isChunkAnyDamageVisible("VatorR"))
    return 0.99F;
if (string.startsWith("StabR") && !isChunkAnyDamageVisible("VatorL"))
    return 0.99F;
if (string.startsWith("Stab"))
    return 0.33F;
if (string.startsWith("VatorL") && !isChunkAnyDamageVisible("VatorR"))
    return 0.99F;
if (string.startsWith("VatorR") && !isChunkAnyDamageVisible("VatorL"))
    return 0.99F;
if (string.startsWith("Vator"))
    return 0.01F;
if (string.startsWith("Keel"))
    return 0.5F;
if (string.startsWith("Rudder"))
    return 0.05F;
if (string.startsWith("Engine"))
    return 0.12F;
return -0.0F;
    }
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 1381
Re: Some recent tweaking
« Reply #11 on: December 03, 2019, 06:40:55 PM »

From AircraftState.java (AircraftState.class), we can alter the color and intensity of the illumination upon the plane exterior and the cockpit from both nav lights and the landing light. This code is from 4.12.

First, to adjust the color of the lighting (NOT the color of the textures that represent the lamps, but rather the color of the light they emit and thus illuminate their surrounds.)

I've subtly altered the color for the red and green nav lights, making the color a little less pure. Hardly enough to notice without a careful comparison. Look right about at the midpoint of the following listing; the original values are commented after // characters.

But the landing light illumination color has been more obviously altered, matching that for the ground lighting, as outlined in the previous post.

Code: [Select]
    public void set(Actor actor, boolean bool) {
Loc loc = new Loc(0.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
Loc loc_2_ = new Loc();
this.actor = actor;
if (actor instanceof Aircraft)
    aircraft = (AircraftLH) actor;
else
    throw new RuntimeException ("Can not cast aircraft structure into a non-aircraft entity.");
bIsMaster = bool;
for (int i = 0; i < 4; i++) {
    try {
astateEffectChunks[i + 0] = this.actor.findHook("_Tank" + (i + 1) + "Burn").chunkName();
astateEffectChunks[i + 0] = astateEffectChunks[i + 0].substring(0, (astateEffectChunks[i + 0].length() - 1));
Aircraft.debugprintln(aircraft, ("AS: Tank " + i + " FX attached to '" + astateEffectChunks[i + 0] + "' substring.."));
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < aircraft.FM.EI.getNum(); i++) {
    try {
astateEffectChunks[i + 4] = this.actor.findHook("_Engine" + (i + 1) + "Smoke").chunkName();
astateEffectChunks[i + 4] = astateEffectChunks[i + 4].substring(0, (astateEffectChunks[i + 4].length() - 1));
Aircraft.debugprintln(aircraft, ("AS: Engine " + i + " FX attached to '" + astateEffectChunks[i + 4] + "' substring.."));
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < astateNavLightsEffects.length; i++) {
    try {
astateEffectChunks[i + 12] = this.actor.findHook("_NavLight" + i).chunkName();
astateEffectChunks[i + 12] = astateEffectChunks[i + 12].substring(0, astateEffectChunks[i + 12].length() - 1);
Aircraft.debugprintln(aircraft, ("AS: Nav. Lamp #" + i + " attached to '" + astateEffectChunks[i + 12] + "' substring.."));
HookNamed hooknamed = new HookNamed(aircraft, "_NavLight" + i);
loc_2_.set(1.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
hooknamed.computePos(this.actor, loc, loc_2_);
Point3d point3d = loc_2_.getPoint();
astateNavLightsLights[i] = new LightPointActor(new LightPoint(), point3d);
if (i < 2)
    astateNavLightsLights[i].light.setColor(1.0F, 0.2F, 0.0F); //(1.0F, 0.1F, 0.0F)
else if (i < 4)
    astateNavLightsLights[i].light.setColor(0.1F, 0.8F, 0.0F); //(0.1F, 1.0F, 0.0F)
else
    astateNavLightsLights[i].light.setColor(0.85F, 0.8F, 0.75F); //(0.85F, 0.8F, 0.75F)
astateNavLightsLights[i].light.setEmit(0.0F, 0.0F);
this.actor.draw.lightMap().put("_NavLight" + i, astateNavLightsLights[i]);
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < 4; i++) {
    try {
astateEffectChunks[i + 18] = this.actor.findHook("_LandingLight0" + i).chunkName();
astateEffectChunks[i + 18] = astateEffectChunks[i + 18].substring(0, astateEffectChunks[i + 18].length() - 1);
Aircraft.debugprintln(aircraft, ("AS: Landing Lamp #" + i + " attached to '" + astateEffectChunks[i + 18] + "' substring.."));
HookNamed hooknamed = new HookNamed(aircraft, "_LandingLight0" + i);
loc_2_.set(1.0, 0.0, 0.0, 0.0F, 0.0F, 0.0F);
hooknamed.computePos(this.actor, loc, loc_2_);
Point3d point3d = loc_2_.getPoint();
astateLandingLightLights[i] = new LightPointActor(new LightPoint(), point3d);
/* astateLandingLightLights[i].light.setColor(0.4941176F, 0.9098039F, 0.9607843F); */
astateLandingLightLights[i].light.setColor(0.96F, 0.91F, 0.84F);
astateLandingLightLights[i].light.setEmit(0.0F, 0.0F);
this.actor.draw.lightMap().put("_LandingLight0" + i, astateLandingLightLights[i]);
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < aircraft.FM.EI.getNum(); i++) {
    try {
astateEffectChunks[i + 22] = this.actor.findHook("_Engine" + (i + 1) + "Oil").chunkName();
astateEffectChunks[i + 22] = astateEffectChunks[i + 22].substring(0, astateEffectChunks[i + 22].length() - 1);
Aircraft.debugprintln(aircraft, ("AS: Oilfilter " + i + " FX attached to '" + astateEffectChunks[i + 22] + "' substring.."));
    } catch (Exception exception) {
/* empty */
    } finally {
/* empty */
    }
}
for (int i = 0; i < astateEffectChunks.length; i++) {
    if (astateEffectChunks[i] == null)
astateEffectChunks[i] = "AChunkNameYouCanNeverFind";
}
    }


Now to adjust the intensity of the nav light emitters:

The method, setEmit(0.35F, 8F); has the first number representing intensity and the second the distance (in meters) over which the light intensity falls to some fractional intensity (perhaps zero?). As you can see, I dimmed the emitters for the nav lights to about 1/4 the old value. I also reduced the illumination range a bit. This makes for a much more subtle illumination level both externally and internally.

Code: [Select]
    private void doSetNavLightsState(boolean flag)
    {
        for(int i = 0; i < astateNavLightsEffects.length; i++)
        {
            if(astateNavLightsEffects[i] != null)
            {
                Eff3DActor.finish(astateNavLightsEffects[i]);
                astateNavLightsLights[i].light.setEmit(0.0F, 0.0F);
            }
            astateNavLightsEffects[i] = null;
        }

        if(flag)
        {
            Loc loc = new Loc(0.0D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);
            Loc loc1 = new Loc();
            for(int j = 0; j < astateNavLightsEffects.length; j++)
            {
                Aircraft.debugprintln(aircraft, "AS: Checking '" + astateEffectChunks[j + 12] + "' visibility..");
                boolean flag1 = aircraft.isChunkAnyDamageVisible(astateEffectChunks[j + 12]);
                Aircraft.debugprintln(aircraft, "AS: '" + astateEffectChunks[j + 12] + "' is " + (flag1 ? "visible" : "invisible") + "..");
                if(flag1)
                {
                    bNavLightsOn = flag;
                    String s = "3DO/Effects/Fireworks/Flare" + (j <= 1 ? "Red" : j <= 3 ? "Green" : "White") + ".eff";
                    astateNavLightsEffects[j] = Eff3DActor.New(actor, actor.findHook("_NavLight" + j), null, 1.0F, s, -1F, false);
/*                    astateNavLightsLights[j].light.setEmit(0.35F, 8F); */
                    astateNavLightsLights[j].light.setEmit(0.09F, 6F);
               }
            }

        } else
        {
            bNavLightsOn = flag;
        }
    }

Finally, to set the intensity of the landing light emitter (which illuminates the plane and cockpit.) Again, I diminished this to 1/4 the former intensity, but slightly increased the illumination range.

Code: [Select]
    private void doSetLandingLightState(boolean flag)
    {
        bLandingLightOn = flag;
        for(int i = 0; i < astateLandingLightEffects.length; i++)
        {
            if(astateLandingLightEffects[i] != null)
            {
                Eff3DActor.finish(astateLandingLightEffects[i]);
                astateLandingLightLights[i].light.setEmit(0.0F, 0.0F);
            }
            astateLandingLightEffects[i] = null;
        }

        if(flag)
        {
            Loc loc = new Loc(0.0D, 0.0D, 0.0D, 0.0F, 0.0F, 0.0F);
            Loc loc1 = new Loc();
            for(int j = 0; j < astateLandingLightEffects.length; j++)
            {
                Aircraft.debugprintln(aircraft, "AS: Checking '" + astateEffectChunks[j + 18] + "' visibility..");
                boolean flag1 = aircraft.isChunkAnyDamageVisible(astateEffectChunks[j + 18]);
                Aircraft.debugprintln(aircraft, "AS: '" + astateEffectChunks[j + 18] + "' is " + (flag1 ? "visible" : "invisible") + "..");
                if(flag1)
                {
                    String s = "3DO/Effects/Fireworks/FlareWhiteWide.eff";
                    astateLandingLightEffects[j] = Eff3DActor.New(actor, actor.findHook("_LandingLight0" + j), null, 1.0F, s, -1F);
/*                    astateLandingLightLights[j].light.setEmit(1.2F, 8F); */
                    astateLandingLightLights[j].light.setEmit(0.3F, 9F);
                }
            }

        }
    }
Logged
Pages: [1] 2   Go Up
 

Page created in 0.015 seconds with 27 queries.