Mods / Snow Cap Melt Fix

Tags:
Worldgen Hotfix Harmony Patching Fix
Author:
vostSive
Side:
Both
Created:
6 days ago
Last modified:
3 days ago
Downloads:
253
Follow Unfollow 43
Recommended download (for Vintage Story 1.22.0 - 1.22.3):
snowcapmeltfix-1.0.1.zip  1-click install

Tired of your mountains' snow caps being destroyed in 1.22? This mod is for you.

 

1.22 introduced a bug (#9539) that causes full snow blocks to melt. This mod is a fix for that issue until it is resolved by the developers.

This mod will not restore snow blocks that have already been removed, it will only prevent surviving ones from being deleted.

This mod also gives you the option to increase the vertical resolution of the snow accumulation system via the config option "SnowAccumVerticalResolution". This makes it so you can make snow accumulation more accurate to temperature changes at higher altitudes. The default value is 2, which is the same as vanilla. I recommend setting it to around 5 or 7. As long as you don't set it above 10 or so, the performance impact should be quite minimal, and going above 10 won't provide much benefit anyway.

Note that if you want to remove the mod and you have changed the snow accumulation vertical resolution, you MUST reset that value to 2 and load any worlds that you have used this mod with BEFORE removing the mod. You can remove the mod once you have loaded your worlds with the default mod config values. If you don't do this, the game will crash when loading your world (which can be fixed by re-enabling the mod and following the proper mod removal process). This is because the structure of snow accumulation data is edited by the mod and saved on world exit, and the unmodified game isn't set up to gracefully handle loading save data that doesn't fit the expected structure.

As of v1.0.1, you can now tweak the game's altitude temperature adjustment mechanic. In the base game, temperature decreases at a rate of 1 °C every 6.375 blocks above sea level. The config options "ScaleAltitudeTemperatureAdjustment" and "AltitudeTemperatureAdjustmentRate" allow this to be modified. The first option controls whether the altitude temperature adjustment rate is scaled according to how much taller/shorter the world is compared to the default world parameters (max height 256, sea level 110). The height of the world above the sea level is used to determine scaling than the total world height. The second option allows the base altitude temperature adjustment rate to be changed, which can make the temperature slope much sharper or gentler. Note that higher values will make the altitude temperature effect weaker, as the option is measured in blocks per °C (a value of 2 would be 2 blocks per degree, which is a much stronger effect than a value of 8 for 8 blocks per degree). You can even set it to a (very unrealistic) negative value if you like the idea of mountains being warmer than sea level, and do a playthrough where you live on warm mountaintops amid a sea of arctic.

The main purpose of the first option is to make taller (or shorter) worlds follow the same temperature distribution as the default world settings. It is fully compatible with mods like the Wilderlands Custom Sea Level mod. The second option allows the height at which snow caps form to be changed. If you want snow caps to form at a specific height, first make a world with the world parameters you intend to use and note down what the temperature is at sea level (usually around 8-12 °C at the default latitude) as well as the y value of the sea level. Then subtract the y value of the sea level from the y value you want snow caps to form at, which gives us a value we can call the snow cap altitude. Snow caps form at around -10 °C, so we want an altitude temperature adjustment rate that will cause the temperature to be -10 °C at the snow cap altitude. To find this, we first need to subtract the snow cap temperature (-10) from the sea level temperature to get our temperature delta. We can then divide our snow cap altitude by our temperature delta to get the value for the altitude temperature adjustment rate option. Note that if you have the option to scale the adjustment rate on, you will need to figure out what the scale is for your world settings [(world height - sea level) / (256 - 110)] and divide the adjustment rate by that value, or disable adjustment rate scaling. You can also just mess with the adjustment rate until you get something you like the look of.

Once a world has been generated, the altitude temperature adjustment options cannot be changed for that world. Worlds generated before this mod will be locked to the vanilla values. If you remove this mod and load a world that was generated with non-default altitude temperature adjustment options, your world will revert to the vanilla values, which will cause sudden seams between old chunks (generated with the mod) and new chunks (generated without the mod).

Version 1.0.1 also makes the mod able to run on the client and introduced a patch to a particular shader that interacts with the altitude temperature adjustment mechanic. If you run into any issues using this mod with shader mods, try disabling "PatchColormapShader" in the client config. Clients still don't need to mod to join a server that has it, and a client with the mod can join a server that doesn't have it.

 

Technical details

The issue is caused by an interaction between the snow accumulation system and the snow block class. The snow accumulation system, when setting (placing or removing) snow layers, asks each surface block for a snow covered variant. If the block has one, the block is replaced by the appropriate variant, otherwise a snow layer is added on top of the block. 1.22 made the snow block class provide snow layers as its snow covered variants (or air, in the case of no snow), which means full snow blocks (placed by worldgen) now get replaced by snow layers or removed entirely.

This mod patches snow blocks to provide no snow covered variants, which is how they worked prior to 1.22.

 

I intend to keep this mod around after the issue is fixed, at least until (and if) the snow accumulation system undergoes a significant rework. I may add more features to improve the snow accumulation system and related systems, though everything will remain optional and configurable.

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.0.1 snowcapmeltfix
1.22.0 - 1.22.3
122 3 days ago snowcapmeltfix-1.0.1.zip 1-click install

New feature: Altitude temperature adjustment (which, by default, decreases temperature as the vertical distance from the sea level increases) can now be tweaked

Added config options: ScaleAltitudeTemperatureAdjustment and AltitudeTemperatureAdjustmentRate, which control altitude temperature adjustment

New feature: The mod will now load on the client side in order to synchronize altitude temperature adjustment with the server and to patch the colormap.vsh shader to obey modified altitude temperature adjustment rates

Added client config with option: PatchColormapShader, which can be used to disable the shader patch in case it is causing compatibility problems or is otherwise unwanted


Several different combinations of scenarios have been tested:

  • Opening a singleplayer world that previously didn't have the mod enabled
  • Opening a singleplayer world with different config values than the world was generated with
  • Running a server with the mod and joining with a client with the mod
  • Running a server with the mod and joining with a client without the mod
  • Running a server without the mod and joining with a client with the mod

 

I am quite confident that there are no issues with the new features, but I can't guarantee that everything will work perfectly or that this release won't damage your worlds, so do back up your worlds before you update to this version, just in case

1.0.0 snowcapmeltfix
1.22.0 - 1.22.3
131 6 days ago snowcapmeltfix-1.0.0.zip 1-click install

First release


6 Comments (oldest first | newest first) (threaded | flat)

Willownezz, 5 days ago

Thank you for this

Pineas, 5 days ago

Bless you for creating this fix and bless you for throwing in the extra option to modify max snow layer heights. I hope after the bug's officially fixed this becomes a nice snow config mod.

vostSive , 5 days ago
@Pineas: Bless you for creating this fix and bless you for throwing in the extra option to modify max snow layer heights. I hope after the bug's officially fixed this becomes a nice snow config mod.

Thank you!

Right now the config option just makes snow placement more precise rather than changing the height at which snow forms, but I could definitely look into adding that feature if it's something people will use. The main reason I added it is because vanilla only checks the temperature at sea level and at max world height, and for every other height it just grabs a value from in between those two (linear interpolation), which can be imprecise. This basically means that the game won't put snow layers (which is from snowy weather, not worldgen) at certain altitudes they should be at, or vice versa.

Pineas, 5 days ago
@vostSive: Thank you! Right now the config option just makes snow placement more precise rather than changing the height at which snow forms, but I could definitely look into adding that feature if it's something people will use. The main reason I added it is becaus

I see, so it's a similar oversight to how food perish rates aren't affected by height even though they should be. Also great, then!

Do you think you could look into ways to make snowfall able to build up to full blocks and beyond if the weather is sufficiently harsh?

vostSive , 5 days ago
@Pineas: I see, so it's a similar oversight to how food perish rates aren't affected by height even though they should be. Also great, then! Do you think you could look into ways to make snowfall able to build up to full blocks and beyond if the weather is suffici

From my existing research into this area of the game, I can already say it would be fairly complex to do and require a more comprehensive overhaul of how snow/snow accumulation works in general, so it would probably take a fair bit of time to implement, but it's doable.

I also have the feeling that the developers might be looking into doing something similar (since, as far as I can tell, that would be the main reason for making the change that caused this bug in the first place), so I'll probably wait and see how the devs decide to fix the bug and go from there.

UsulMuadib, 5 days ago

lifesaver