Page 32 of 32

Re: Planetfall 2.0 (apparently)

Posted: Thu Jun 26, 2025 10:02 pm
by Cholmondely
phkb wrote: Thu Jun 26, 2025 3:32 am
A quick one:
Thanks for the tip.

While you are on, I have no idea as to what to do with the javascript for increasing turbulence and the javascript for changing the filters.

1) Where do they go? In the same javascript file with the landing site names, or another one or two files?
2) If in the same, how on earth do I add them in? Under the relevant planet site names or in their own separate sections? How do I stipulate which system I want it to apply to?

As you can see, this dumb pilot has no idea about any of this. My current .js file is just a cut and paste and tweak of your work inside your SuperSystems.oxp with a lot of worrying about how to add a second system to it without breaking anything.

AND! Could you please
1) just flesh out what I need for Larais (0,177) - orange haze (orange filter is labelled planetFall2_filter_orange.png)

I'm not too sure that this is quite what I was asking for - to envelop the entire planet in an orange miasmal atmosphere as I approach the surface which prevents me from seeing anything - even the beacon, so that I'm navigating in the blind...

Code: Select all

this.startUpComplete = function() {
    // overriding the landing VFX images is done on a per-planet basis.
    // pick the planet for which you want to override images.
    // this this example, we are using the main planet
    var pl = system.mainPlanet;
    // if there's no main planet, just return at this point
    if (!pl) return;

    pl._pf2_landingImageOverrides = {
        clouds: {
            // this is the filename used for the "clouds" when descending to dock on the sunlit side of the planet
            normal: "normal_clouds.png",
            // this is the filename used for the "clouds" when descending to dock on the dark side of the planet
            night: "night_clouds.png"
        },
        dock: {
            // this is the filename used for the "dock" image used when descending to dock on the planet
            normal: "normal_clouds.png"
            // there is no "night" side docking pad image. docks are assumed to be well lit
        },
        overlay: {
            // this is the overlay to use on top of the landing image on the sunlit side of the planet
            normal: "normal_overlay.png",
            // this is the overlay to use on top of the landing image on the dark side of the planet
            night: "night_overlay.png"
        },
    };
}
2) just flesh out what I need for Zaatxe (0,8) - vicious sandstorms

Code: Select all

this.startUpComplete = function() {
    // this this example, we are using the main planet
    var pl = system.mainPlanet;
    // if there's no main planet, just return at this point
    if (!pl) return;

    // this would increase the default maximum turbulence factor by 10%
    pl._pf2_turbulence = {scaleMax: 1.1};
}
and I should be able to take it from there!

Re: Planetfall 2.0 (apparently)

Posted: Fri Jun 27, 2025 1:11 am
by phkb
Cholmondely wrote: Thu Jun 26, 2025 10:02 pm
While you are on, I have no idea as to what to do with the javascript for increasing turbulence and the javascript for changing the filters.
OK, here we go: "PlanetFall 2 Additional Planetary Customisations 101"

Adjusting the clouds, landing pads and overlays used during the planetary landing is done on a per-planet basis. The logic being you are creating a custom experience for a planet, not the entire system. Theoretically, "severe storms" would only apply to a single planet in a system, and there would be not cross-over to others.

Because we want the planets to all be present when we're making the changes, the "systemWillRepopulate" event makes the most sense for adding these changes (which conflicts with the documentation I put in the PF2 package - I'll fix that later).

The thing we need to be careful of with the "systemWillRepopulate" event is that it fires frequently, about event 20 seconds or so. So, we need to include code that will prevent the changes from being constantly applied. Not that it wouldn't work if the code ran every time, but it's just a waste of system resources to have it fire all the time.

Here's the first pass on getting this code together. Add this to your existing world script, at the end of it if you like.

Code: Select all

this.systemWillRepopulate = function() {
    if (!worldScripts.PlanetFall2) {
        delete this.systemWillRepopulate;
        return;
    }
    if (this.PF2_tweaks) return;
    this.PF2_tweaks = true;
}
First, we're checking if PlanetFall2 is installed, and if it isn't, we're removing the systemWillPopulate function entirely. No point in doing something if the OXP isn't there.

Next, we've created a script-level variable called "this.PF2_tweaks". The first line is doing a boolean check, which in essence reads "if the PF2_tweaks variable exists and is true, then return". On the first run, the PF2_tweaks variable will not be present at all (ie the check for it will be false), and so it will fail the check and continue on to the next line.

What this is missing, though, is a reset for when we enter a new system. The most logical place to put this would be the "shipExitedWitchspace", so let's add that in.

Code: Select all

this.systemWillRepopulate = function() {
    if (!worldScripts.PlanetFall2) {
        delete this.systemWillRepopulate;
        delete this.shipExitedWitchspace;
        return;
    }
    if (this.PF2_tweaks) return;
    this.PF2_tweaks = true;
}

this.shipExitedWitchspace = function() {
    this.PF2_tweaks = false;
}
OK, that sets up the environment. Now we can start adding customisations. First, let's tweak the turbulence for Zaatxe

Code: Select all

this.systemWillRepopulate = function() {
    if (!worldScripts.PlanetFall2) {
        delete this.systemWillRepopulate;
        delete this.shipExitedWitchspace;
        return;
    }
    if (this.PF2_tweaks) return;
    this.PF2_tweaks = true;
    
    if (galaxyNumber == 0 && system.ID == 8) { // zaatxe
        // get the main planet
        var pl = system.mainPlanet;
        // set the turbulence customisation for this planet
        pl._pf2_turbulence = {scaleMax: 1.2}; // increase turbulence effect by 20%
    }
}

this.shipExitedWitchspace = function() {
    this.PF2_tweaks = false;
}
We've added a check for the correct system, and if found, we apply the customisation to the main planet of that system. On to Larais!
Cholmondely wrote: Thu Jun 26, 2025 10:02 pm
to envelop the entire planet in an orange miasmal atmosphere as I approach the surface which prevents me from seeing anything - even the beacon, so that I'm navigating in the blind...
The tricky part to what you're describing here is that it's all *before* you get to the landing sequence. To make a piloting experience where your viewscreens are essentially fuzzy is outside of what PF2 is in control of. It would certainly be possible to apply some sort of mask to each viewscreen (I think the Dangerous HUD does this for it's rear view). You'd need some way of scaling the effect as you descended deeper into the atmosphere, but it's possible. The difficulty level that would have on trying to line up the PF2 landing point is extreme, especially if you're aiming for "navigating in the blind".

Anyway, let's cover what PF2 can do for Larais. There are a couple of ways to achieve an orange filter effect to simulate sand storms. If you just want the orange filter to be applied, the easiest way to do that is to tweak the planetinfo entry for Larais, and make the air colour fit into the orange range. At that point, PF2 will apply the filter automatically and nothing else needs to be done.

So, in planetinfo.plist, do this:

Code: Select all

{
    "0 177" = {air_color = "0.995 0.64705 0.0 1";};
}
Or, you could do in in the code, like this:

Code: Select all

this.systemWillRepopulate = function() {
    if (!worldScripts.PlanetFall2) {
        delete this.systemWillRepopulate;
        delete this.shipExitedWitchspace;
        return;
    }
    if (this.PF2_tweaks) return;
    this.PF2_tweaks = true;

    if (galaxyNumber == 0 && system.ID == 177) { // larais
    	var pl = system.mainPlanet;
    	pl.airColor = (0.995, 0.64705, 0.0, 1);
    }
    
    if (galaxyNumber == 0 && system.ID == 8) { // zaatxe
        // get the main planet
        var pl = system.mainPlanet;
        // set the turbulence customisation for this planet
        pl._pf2_turbulence = {scaleMax: 1.2};
    }
}

this.shipExitedWitchspace = function() {
    this.PF2_tweaks = false;
}
If you want to apply more specific images and filters, you'd need to do the following. First, you'd need to create a "clouds" and "night" png file for the descent part of the animation, and then have a filter png file to apply over the top of the landing image.

Here's a link to a gallery of some images I put together quickly to showcase the process. PlanetFall2 example images
I'm sure someone with more graphical talent could come up with a better version, but these will do for demonstration purposes. There's 4 images in the gallery: 2 "cloud" images, and two overlays.

When you download these, the two cloud images need to be in the "Textures" folder of your OXP. The two overlays should be in the "Images" folder.

To make use of these, add the following code to your script:

Code: Select all

this.systemWillRepopulate = function() {
    if (!worldScripts.PlanetFall2) {
        delete this.systemWillRepopulate;
        delete this.shipExitedWitchspace;
        return;
    }
    if (this.PF2_tweaks) return;
    this.PF2_tweaks = true;

    if (galaxyNumber == 0 && system.ID == 177) { // larais
    	var pl = system.mainPlanet;
        pl._pf2_landingImageOverrides = {
            clouds: {
                // this is the filename used for the "clouds" when descending to dock on the sunlit side of the planet
                normal: "sandstorm_clouds.png",
                // this is the filename used for the "clouds" when descending to dock on the dark side of the planet
                night: "sandstorm_clouds_night.png"
            },
            overlay: {
                // this is the overlay to use on top of the landing image on the sunlit side of the planet
                normal: "sandstorm_overlay.png",
                // this is the overlay to use on top of the landing image on the dark side of the planet
                night: "sandstorm_overlay_night.png"
            },
        };	
    }
    
    if (galaxyNumber == 0 && system.ID == 8) { // zaatxe
        // get the main planet
        var pl = system.mainPlanet;
        // set the turbulence customisation for this planet
        pl._pf2_turbulence = {scaleMax: 1.2};
    }
}

this.shipExitedWitchspace = function() {
    this.PF2_tweaks = false;
}
And that's it! Let me know if something doesn't make sense.