Sentinel weather

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Posts: 2884
Joined: Wed Jul 18, 2018 6:14 pm
Location: France

Sentinel weather

Post by pango »

Trying to understand why it rains so often in Sentinel, I noticed that
  • the climate displayed by "tdbg" (and which is, I think, responsible for stuff like architecture and textures) is based on

    Code: Select all

    which is "Desert";
  • whereas the weather is based on

    Code: Select all

    which is "Subtropical", hence the frequent rain and thunder
I guess it's based on classic, but that feels a bit strange...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Posts: 1772
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Sentinel weather

Post by Ralzar »

Sentinel should be subtropical. Does "LocalPlayerGPS.ClimateSettings.ClimateType" have a value for that?
Is it subtropical that makes it rain so much? I suspect it's during winter in particular, when instead of snowing, it rains.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."

User avatar
Posts: 111
Joined: Sun Nov 10, 2019 8:01 pm

Re: Sentinel weather

Post by DigitalMonk »

pango wrote: Thu Aug 20, 2020 12:33 am
  • LocalPlayerGPS.ClimateSettings.ClimateType
  • PlayerWeather.PlayerGps.CurrentClimateIndex
That would confuse me greatly as a maintenance programmer / modder. Both forms retrieve a climate based on the players position, so how would I know which to use? I'm guessing that the architecture styles and the weather system were implemented a considerable time apart? Or is there a subtle reason for these being kept separate that I don't understand because I've not been in the code?

I could see that architecture would track by general year-round climate, while local weather would track by immediate weather chosen from the surrounding climate. But both of those appear to be long-term climate values, not immediate weather values.

Would it make sense to pick one or the other as the most accurate value, remove the other one, and refactor code to always use the one that was kept?

(BTW, no judgment here -- I know my own code, and I don't have any soapbox or high horse to get up on :oops: . Just wondering if this would help clarify things for future modders.)

User avatar
Posts: 2680
Joined: Sat Aug 26, 2017 2:46 pm

Re: Sentinel weather

Post by Hazelnut »

I think you'll find that these are representation of classic data and that's why it may not seem logical, but Interkarma would have to confirm - I am guessing.
See my mod code for examples of how to change various aspects of DFU:

User avatar
Posts: 6211
Joined: Sun Mar 22, 2015 1:51 am

Re: Sentinel weather

Post by Interkarma »

The ClimateType field is of ClimateBaseType enum used for climate textures. It looks like below.

Code: Select all

/// <summary>
/// Climate base type enumeration for climate-swapping textures.
/// </summary>
public enum ClimateBaseType
    None = -1,
    Desert = 0,
    Mountain = 100,
    Temperate = 300,
    Swamp = 400,
These map directly to climate texture bases in TEXTURE files, e.g. TEXTURE.000 is base for Desert textures, TEXTURE.100 is base for Mountain textures, and so on. There is no such thing as a subtropical texture set for terrain and models. Rather, those four texture sets are shared across the various subclimates. That's why Sentinel is ClimateBaseType.Desert - it's the texture set Sentinel uses.

The ClimateIndex value is the subclimate read from CLIMATE.PAK for a specific map pixel. Other than determining the texture set above, it selects the sky, nature sprites, and used in weather inputs along with season. There are several subclimates with some variations between them, but they all use one of the four texture bases.

Weather was reverse engineered from classic by Allofich and functions identically as far as I know. See SetClimateWeathers() and SetWeatherFromWeatherClimateArray() in WeatherManager for this.

Everything climate-related ultimately hangs off ClimateIndex in some way. How that value is used depends on which system you're looking at. Texture swaps and weather are different systems.

Post Reply