Jump to content

[1.12.x] Modular Climate & Weather Systems (v0.9.8-TEST)


Recommended Posts

Modular Climate & Weather Systems (MCWS) is a plugin that provides a common interface for climate and weather data/simulations to interact with KSP's physics systems. 

The "Modular" part of MCWS comes from the fact that it allows climate and weather data to be easily added through an integrated binary file reader and a flowmaps system for those who prefer textures. An API also allows data to be added via external plugins, and this same API can also be used by other mods to read climate and weather data for whatever they want to use it for. This data is then used to influence various aspects of the game's physics systems, primarily through wind, temperature, and pressure.

Currently Supported Bodies:

  • Stock System: Kerbin, Duna, Eve, Laythe
  • Outer Planets Mod: Tekto, Thatmo
  • Tidally Locked Kerbin: Kerbin
  • Kcalbeloh System: Mehtna, Rouqea, Suluco

Anyone is free (encouraged, even) to add their own climate data sets to MCWS if they desire, up to and including replacing/overriding the included data sets. 

Installation
Download from:

Dependencies:

Source: 
https://github.com/CashnipLeaf/ModularClimateWeatherSystems

Mod Compatibility

Recommended Mods:

  • KSPCommunityFixes

Compatible with:

  • FerramAerospaceResearch: If installed, MCWS will defer all relevant aero/thermal calculations to FAR and supply it with wind, temperature, and pressure information.
  • Most, if not all parts mods

Conflicts with:

  • Other mods that modify the stock aerodynamics system.

General API Information
Below is a very brief overview of the API for anyone who may be interested in registering a plugin with MCWS. Far more detailed information can be found on the Github Wiki (linked below).

  • Multiple mods can provide climate/weather data for a given body, but no two mods can provide the same type of data for said body. For example: if mod A registers wind data and pressure data for Kerbin, mod B can only register temperature data for Kerbin, but it can register wind and pressure data for another body. 
  • There are no restrictions on how many bodies a given mod may register data for. 
  • Other mods can read data through the same API.
  • Externally-provided data will always be preferred over internal-stored binary data or flowmaps.

Documentation: 
https://github.com/CashnipLeaf/ModularClimateWeatherSystems/wiki
This wiki also includes information on using MCWS's flowmap system and integrated binary file reader.

Other Features
MCWS adds a few extra features to help you out when flying, including:

  • A GUI which displays wind, temperature, and pressure information, along with other relevant aero- and thermodynamic information.
  • A new pair of Navball indicators which display prograde and retrograde adjusted for wind, which will only appear if you are in an atmosphere, the Navball is set to "Surface" mode, the wind speed is greater than 0.5m/s, and the craft is in motion.
  • To make craft recovery easier (or perhaps even possible in some cases), MCWS's GUI includes a setting that disables the wind effects if the craft is landed or splashed down, and moving at <5m/s.

Gameplay
Valentina going sailing on Laythe.

Screenshot%20(2282).png?raw=true

Strong gusts in Eve's lower atmosphere take this lander for a ride as it descends towards the surface.
This actually seems like a half-decent way to get extra science.

Screenshot%20(2281).png?raw=true

Landing a VTOL is hard enough without the wind! (Admittedly, I'm not very good at this)

Screenshot%20(2283).png?raw=true

If you would like to join me in my climate modeling shenanigans, I now have a discord server! Invite link: https://discord.gg/SdSh8BVdCd

Changelog:

Spoiler

v0.9.7:
- New "blend-with-stock" feature for temperature.
- Wind variability is now calculated separately for all three wind components.
- Bug fixes and FAR compatibility fixes.

v0.9.6:
- Added a new debug mode.
- The integrated binary file reader can now read files encoded with double precision.
- Added the ability for external plugins to post-process MCWS flight handler data via the API.
- Minor performance improvements.

v0.9.5:
- Redefined 0 index on longitude axis to be the prime meridian
- Added timeOffset key
- Full OPM Support
- Various bugfixes and improvements.

v0.9.4:
- Partial OPM support
- Chinese Localization, donated by @Aebestach
- Bugfixes and other improvements

v0.9.3:
- Deprecated global data API
- Restructured plugin
- Added longitudeOffset and verticalWindMultiplier keys
- New Data Sets

v0.9.2:
- Multiple bugfixes.
- Added new "modelTop" key to configs, replacing the "virutalTop" key.
- Removed unused texture.

v0.9.1:
- Added integrated flowmaps system and integrated binary file reader
- Deprecated standalone ExoPlaSim reader plugin
- Slightly increased the effect that wind has on partially submerged craft.

v0.9.0:
- Initial release

Credits and Acknowledgements

  • @sarbian, @ferram4, and @Starwaster for making the Modular Flight Integrator that allows interfacing with KSP's physics system.
  • @R-T-B for lending a VM to run ExoPlaSim to generate climate data.
  • @Aebestach for donating Chinese Localization support.

License Information
Modular Climate & Weather Systems is licensed under the MIT license.

G0kG0b2.png

Edited by CashnipLeaf
update 0.9.8-test
Link to comment
Share on other sites

Posted (edited)

Modular Climate & Weather Systems has been updated to v0.9.1

  • The flowmap system from my previous wind-only mod, CPWE, has been ported to MCWS, with a few minor config structure changes. 
    Note: data from Flowmaps will be available to the point data API, but not to the global data API.
  • An integrated, general-purpose binary file reader has been added. This can also be configured through config files.
  • The standalone reader plugin for ExoPlaSim files has been deprecated, and the stock system data configs have been moved over to the integrated reader.
  • Slightly increased the effect of wind on craft that are partially submerged in an ocean.

Documentation has been updated with the flowmap system and integrated binary file reader.

Original post has been updated with the new changes, and now includes a changelog.

Edited by CashnipLeaf
Link to comment
Share on other sites

This looks amazing! I managed to get this working with @benjee10'sPlanetside Exploration Technologies Wind Turbines. Was super easy to splice in, and get working.

JglPRIt.png

I was planning on posting the change while I did some balancing on the power generation, but I noticed that the mod is All Rights Reserved, so I can't do it without Benjee10's OK. So for now, I'll keep messing around with it, and hopefully it can be made as a future addon!

Link to comment
Share on other sites

2 hours ago, jthero7 said:

This looks amazing! I managed to get this working with @benjee10'sPlanetside Exploration Technologies Wind Turbines. Was super easy to splice in, and get working.

JglPRIt.png

I was planning on posting the change while I did some balancing on the power generation, but I noticed that the mod is All Rights Reserved, so I can't do it without Benjee10's OK. So for now, I'll keep messing around with it, and hopefully it can be made as a future addon!

Welp, I was gonna ask him about mod integration at some point, but it looks like that's been done for me now LOL (not that this is a bad thing at all btw, this is cool)

Link to comment
Share on other sites

Posted (edited)

Modular Climate & Weather System has been updated to v0.9.2

  • Fixed several bugs caused by the hack job QC I did last update.
  • Restructured the binary file reader to make it easier to work with going forward.
  • Added a new "modelTop" parameter to the binary reader and the API to define the top of a model to make scaling with altitude easier.
    Dev Note: The eagle-eyed among you may have noticed that Eve and Duna did not come with pressure data. This is because I found it difficult to get things to scale appropriately with altitude. This new "modelTop" parameter is intended to solve that. This also replaces the "virtualTop" key in the configs.
  • Removed an unused texture.

 

7 hours ago, biohazard15 said:

Looks great! Any chance for KSRSS support in the future?

MCWS is fully compatible with modded/custom bodies, so I won't say "no" to this. I'm not sure when I'd do it, but it definitely is a thing that can happen.

P.S. If anyone wants to donate a data set (or several), I'd gladly add it to the pile.

Edited by CashnipLeaf
Link to comment
Share on other sites

Posted (edited)

And of course, I forgot to properly check all the test cases again. Found out that pressure doesn't scale correctly in the upper atmosphere. :valsad:

Just put out a hotfix for that.

Edited by CashnipLeaf
Link to comment
Share on other sites

Posted (edited)

Playing around with a tidally locked Kerbin data set (Tidally Locked Kerbin mod by @OhioBob).

Convection caused by the temperature gradient leads to some strong winds that can change pretty rapidly as you ascend through the atmosphere.

Screenshot%20(2291).png?raw=true

There's also a low-pressure zone in the substellar region, which I'm told actually lines up pretty well with what might actually happen.

Now I'm curious about other weird characteristics that might arise from things like spin-orbit resonance rather than straight tidal locking, or from bodies with short rotational periods (tidally locked or otherwise).

Edited by CashnipLeaf
Link to comment
Share on other sites

  • 3 weeks later...

It's been a hot minute since I posted here, so here's what's been going on:

I had my final exams a couple of weeks ago, and then went on a week and a half vacation, both of which meant I couldn't really work on MCWS (or anything mod-related, for that matter) at all. However, I am still supporting this thing. I will probably put out a small update with some new data sets soon, this time going beyond the stock bodies. 

I'm also branching out into some other projects and project ideas, so I will see how things go from there. 

Link to comment
Share on other sites

Posted (edited)

Modular Climate & Weather Systems has been updated to v0.9.3

  • Deprecated the ability to input global data into the API, instead opting for requesting data based on vessel location and time (see updated wiki). Global data from the binary files can still be exported, though. 
    Dev note: This allowed me to simplify many aspects of the plugin. Having the global data API was largely wishful thinking on my part anyways tbh.
  • Significantly restructured and simplified the plugin due to the removal of the global data API.
  • Added a few new config parameters:
    • verticalWindMultiplier: adds a multiplier to the vertical wind component for wind data. This can compensate for vertical wind motions being extremely small.
    • longitudeOffset: Shifts data on the longitude axis. This can help center data for tidally locked bodies.
  • Added data sets for:
    • Tidally Locked Kerbin: Kerbin
    • Kcalbeloh System: Rouqea, Mehtna, Suluco (includes compatibility for Homeswitch and Rescale)

(More to come in the future =D)

Edited by CashnipLeaf
Link to comment
Share on other sites

Posted (edited)

Modular Climate & Weather Systems has been updated to v0.9.3.1

  • Bugfixes and minor performance improvements. (note to future self: check *all* of your return codes!)

I'm gonna be making a whole bunch of data for this thing soon now that it's in a state where it's reasonably stable and I'm fairly confident that there's no major bugs. I'll also be making a guide based on the methods I used to create data for this thing in case anyone wants to contribute or just have some fun with this thing.

Edited by CashnipLeaf
Link to comment
Share on other sites

Wow. This looks incredible. The mods coming out these days truly make the game into something I never thought it could be when I first stared playing all those years ago. 
 

This looks like a lot of work, so thank you! I’ll be trying this out this week hopefully. Fingers crossed for Outer Planets Mod!

Link to comment
Share on other sites

9 hours ago, dylsh said:

Fingers crossed for Outer Planets Mod!

The one problem I ran into is that ExoPlaSim does not like very cold bodies. The few times I tried running a Laythe model ended in an early model crash. (I will come clean and say that Laythe’s data set in the mod is a kitbash of data from multiple models)

To be fair, this is not a problem that’s exclusive to ExoPlasim; a PowerPoint for using ROCKE-3D stated outright that oceans freezing to the bottom causes a model crash, for instance. But it does mean that very cold bodies will be challenging to do.

I’ll see what happens, and if (more likely “when”) the model crashes, I’ll see how much data I can salvage. Tekto might be somewhat doable, but I don’t have high hopes for Thatmo. Fingers crossed, though.

Link to comment
Share on other sites

Posted (edited)
On 5/3/2024 at 11:38 AM, jthero7 said:

This looks amazing! I managed to get this working with @benjee10'sPlanetside Exploration Technologies Wind Turbines. Was super easy to splice in, and get working.

JglPRIt.png

I was planning on posting the change while I did some balancing on the power generation, but I noticed that the mod is All Rights Reserved, so I can't do it without Benjee10's OK. So for now, I'll keep messing around with it, and hopefully it can be made as a future addon!

Pull requests can also be made on GitHub. @jthero7 By the way, can you please tell me if this change requires a change in the source code?

Edited by Aebestach
Link to comment
Share on other sites

Posted (edited)

Modular Climate & Weather Systems has been updated to v0.9.4

  • Added a data set for OPM's Tekto. Thatmo (hopefully) coming Soon™.
  • Fixed a bug that would cause wind to not actually be applied to craft. (it's always the one missing line of code that breaks everything)
  • Added Chinese Localization support, donated by @Aebestach.
  • Minor performance improvements.
Edited by CashnipLeaf
Link to comment
Share on other sites

43 minutes ago, CashnipLeaf said:

Modular Climate & Weather Systems has been updated to v0.9.4

  • Added a data set for OPM's Tekto. Thatmo (hopefully) coming soon.
  • Fixed a bug that would cause wind to not actually be applied to craft. (it's always the one missing line of code that breaks everything)
  • Added Chinese Localization support, donated by @Aebestach.
  • Minor performance improvements.

You’re banging these updates out my friend!

Link to comment
Share on other sites

Posted (edited)
On 6/5/2024 at 1:21 AM, Aebestach said:

Pull requests can also be made on GitHub. @jthero7 By the way, can you please tell me if this change requires a change in the source code?

True, I never got around to doing a balancing pass. The wind values have a much wider delta between high/low, than the current values do. So you either get no EC, or the turbines instantly break.

Yeah, you have to replace the current wind vector generator, with the hooks provided by MCWS. Only ended up being a couple lines. I'll push it up to a repo and link it here when I get a chance.

 

@Aebestach Here is the link to the repo I made for it. The changes were made in

 Source/Modules/ModulePETTurbine.cs

I think most of the balancing from here on can be done in the config files for each of the turbines though. I added an updated Gamedata with the new binary if you want to try it out, and/or play with the configs.

Edited by jthero7
Added link.
Link to comment
Share on other sites

5 minutes ago, dylsh said:

You’re banging these updates out my friend!

I do prefer a model of more rapid iteration to be fair lol (assuming life doesn't get in the way)

Link to comment
Share on other sites

On 6/6/2024 at 2:19 PM, jthero7 said:

I think most of the balancing from here on can be done in the config files for each of the turbines though. I added an updated Gamedata with the new binary if you want to try it out, and/or play with the configs.

I think the chargeRate should be adjusted to control this, otherwise it's generating too much power.

Link to comment
Share on other sites

21 hours ago, DarlesChickens said:

Wow! Any plans to add this to gas / ice giants? How well would it even work if it's struggling with Laythe?

I’m not 100% sure that ExoPlaSim has support for gas/ice giants. However, I’m pretty sure it can do transitional planets (aka Mini-Neptunes) and hycean planets, assuming they’re warm enough to not cause a model crash. 

Link to comment
Share on other sites

5 hours ago, CashnipLeaf said:

I’m not 100% sure that ExoPlaSim has support for gas/ice giants

Hi! I think same.  It's a simulator and not all KSP planets are, like, real. I've tried to add my old CPWE  flowmap-based config for Jool into  MCWS but hitting a strange bug, here is my test case where I try to assign a flowmap from CPWE to Kerbin with no MCWS_PlanetData folder.

[WRN 02:38:59.942] [MCWS][WARNING] Unable to load Flowmap object: Could not find a part of the path "E:\KSP1125\MCWS_Test\kerbin_highaltitude_flowmap.png".

This is when I set"map = MCWS_Test/kerbin_highaltitude_flowmap.png". The path in log is obviously missing Gamedata folder. 

But when I add it, like "map = GameData/MCWS_Test/kerbin_highaltitude_flowmap.png", it throws me another error.

[WRN 02:31:21.546] [MCWS][WARNING] Unable to load Flowmap object: Could not locate Flowmap at file path: GameData/MCWS_Test/kerbin_highaltitude_flowmap.png . Verify that the given file path is correct.

Either way, it doesn't load and I get no wind. Could you please make a sample working config with a flowmap? I can even "donate" you the map itself. https://github.com/hohmannson/jool_surface/blob/mcwsmap/Gamedata/JoolSurface/JoolWindMap.png

Link to comment
Share on other sites

16 hours ago, Hohmannson said:

Hi! I think same.  It's a simulator and not all KSP planets are, like, real. I've tried to add my old CPWE  flowmap-based config for Jool into  MCWS but hitting a strange bug, here is my test case where I try to assign a flowmap from CPWE to Kerbin with no MCWS_PlanetData folder.

[WRN 02:38:59.942] [MCWS][WARNING] Unable to load Flowmap object: Could not find a part of the path "E:\KSP1125\MCWS_Test\kerbin_highaltitude_flowmap.png".

This is when I set"map = MCWS_Test/kerbin_highaltitude_flowmap.png". The path in log is obviously missing Gamedata folder. 

But when I add it, like "map = GameData/MCWS_Test/kerbin_highaltitude_flowmap.png", it throws me another error.

[WRN 02:31:21.546] [MCWS][WARNING] Unable to load Flowmap object: Could not locate Flowmap at file path: GameData/MCWS_Test/kerbin_highaltitude_flowmap.png . Verify that the given file path is correct.

Either way, it doesn't load and I get no wind. Could you please make a sample working config with a flowmap? I can even "donate" you the map itself. https://github.com/hohmannson/jool_surface/blob/mcwsmap/Gamedata/JoolSurface/JoolWindMap.png

Looks like there’s a bug in the flowmap portion of the config reader. I’ll have that fixed next update. Thanks for reporting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...