JadeOfMaar

HazardousBody corrosion effect

Recommended Posts

I've been carrying this idea for a few months now and I figured it would be quite neat to have. Its customization and versatility would be at least on par with the Kopernicus feature: HazardousBody, which replaces HazardousOcean and does not require the hazardous body to possess an ocean or atmosphere. Its overall purpose is to add that missing aspect of challenge, of risk and reward to exotic planets in your favorite planet mod(s).

The idea first came to me while watching beaucoupzero's video of a KSPI shuttle entering into Deemo, the yellow acid moon in @AndrewDraws Extrasolar mod and sadly not taking damage from the atmosphere. (Video link starts at 10:00, you don't have to scrub it or watch the whole thing.)

 

HazardousBody can be applied and restricted by altitude regions, points with effect radius (making only the insides or immediate areas of volcanoes deadly in-game), latitude regions, possibly even complex toroidal regions. It can even accept a grayscale map texture (which needs investigation). It's an incredibly powerful feature just for manipulating heat. But there is more to a deadly planet that exposed lava.

So, what I'm envisioning is a cousin to HazardousBody. With how complex it can get and its deep involvement with parts, I doubt I can hope for it to be fully realized as a feature of Kopernicus, but as its own part failure mod or a sub-feature of another part failure mod, or a certain habitation mod. Suitable existing mods that come to mind are Kerbalism, Kerbal Health, BARIS and Oh! Scrap, owned by @Sir Mortimer @garwel @Angel-125 @severedsolo. Also paging @linuxgurugamer because why not?

How I imagine it will work in-game is:

  • Parts carry an HP gauge and a resilience factor (equivalent to this is the DEF or SP DEF stat in monster/magic battle games). Resilience is how reactive or non-reactive the part is to the acid around it, and HP scales with mass by default but can be influenced by one or two factors such as heat tolerance or part category. Depending on the resilience value given to a part, it is implied to largely consist of weaksauce Aluminum sheets...or consist of a very buff, complex Carbon lattice. Some parts, despite having a powerful outer hull composition, may still have exposed innards that aren't and can't be as well protected such as intakes or shrouded solar panels.
  • There will be facilities to refurbish parts and restore HP (very much like any maintenance process within a failure mod), but not all parts can qualify such as early-game crewed parts, delicate science instruments or certain classes of engine.
  • Kerbals would be most vulnerable to corrosion. Just as with EVA fuel, when a kerbal leaves the ship they may take from a limited, onboard supply of dispensable anti-corrosion coating, and when they board or disembark, the part possessing the hatch should have especially high resilience or should take corrosion damage.
  • Planets will have two or three corrosion factors, simply measures of how powerful its acid (or alkali) is. One for ground, for the ocean, and for the atmosphere. Why separate factors? It's possible for a planet to have a corrosive atmosphere and a neutral ocean, or a neutral atmosphere and corrosive ocean.
    • The ground factor will apply to anything immediately touching the ground (such as landing legs or EVA kerbals). The ground could be saturated by acid rain.
    • The ocean...pretty straightforward.
    • And to the atmosphere (basic, scaling in intensity with atmosphere pressure). Additionally, this ideally should also accept a float curve for atmospheric intensity and would enable such things as the boundary in Venus' atmosphere above which it's still completely safe to fly but below which are the acid cloud deck and sudden acid rain.
  • Ideally, the corrosion should only affect the outermost parts of a ship and work its way inward, giving substance to the concept of applying armor to your ship.
  • Advanced features:
    • Certain modules will break and become unavailable if the part bearing this module has sufficiently corroded (taken a certain fraction HP loss). This can easily help simulate breached cabins and greenhouse environments.
    • If a part has an ablator module then whatever resource is used by this would be consumed and would mitigate the corrosion damage.
    • Parts can be destroyed (critical failure) after taking a certain fraction of damage before losing all of their HP, such as a fragile tank full of highly reactive resource like CryoTanks and LH2 or Oxidizer.
    • Kerbals and certain parts can have upgrade-able resilience factor or HP.
    • Life support mods (Snacks, Kerbal Health, Kebalism) will respond to excess HP loss on the kerbal and apply their appropriate negative status (stress!, poisoned, panic, fainted) to the kerbal.

This, if it was realized as a mod could add much more immersion, when applicable, to an interplanetary or interstellar experience in KSP. Activate this alongside part pressure limits, and hostile worlds like Venus in RSS, and Deemo in Extrasolar will get that much more interesting and immersive.

Edited by JadeOfMaar

Share this post


Link to post
Share on other sites

Sounds awesome. How about an extra part at late/endgame which is basically like an entire craft anti-corrosion cover or coating with a variable mass and costs (let's say 5 or 10% of the entire craft mass, or possible depending on the surface area of the craft). Some parts like engines or antennae could be excluded for obvious reasons. This part would add HP to all parts. It should not make them invincible or completely immune to the effects, but still much more resilient.

Or how about galvanic anodes which protect the vessel by failing first and 'attracting' the chemical reaction (in layman's terms) - a technique also used by the shipbuilding industry, especially in military naval vessels.

Edited by caipi

Share this post


Link to post
Share on other sites
6 hours ago, JadeOfMaar said:

Also paging @linuxgurugamer because why not?

 

Interesting idea, but:

6 hours ago, JadeOfMaar said:
  • Ideally, the corrosion should only affect the outermost parts of a ship and work its way inward, giving substance to the concept of applying armor to your ship.

This is the hard part, identifying the outermost parts.

And, I don't have time for this right now, but thanks for bringing this up

Share this post


Link to post
Share on other sites
3 hours ago, linuxgurugamer said:

Interesting idea, but:

This is the hard part, identifying the outermost parts.

And, I don't have time for this right now, but thanks for bringing this up

Sadly I know that detecting the outermost parts would be tough to do and would be hard on the CPU. :(

It's no problem at all. I expect this to demand a great investment of time and energy. And I wouldn't want to force you and burden you (in particular) with how much you do for the community already. Just inviting you to see my idea is enough.

Edited by JadeOfMaar

Share this post


Link to post
Share on other sites

Whoa!!... nice concept...
reading the thread title tho, I was thinking this was just about *textures* for *craft* bodies... :P

Mebbe you could recruit @damonvv to make a after-effect, corroded exterior textures for *every* conceivable part in KSP... or mebbe just a translucent shader that gets applied...?? vOv :P
kinda like the grungy re-flown booster thing he did in Tundra... :P

Make sure to make all the OPT textures *top-priority*, since I know those are sooooo fun to work with... :confused: and you have that experince with them, too... :sticktongue:

Edited by Stone Blue

Share this post


Link to post
Share on other sites
1 hour ago, JadeOfMaar said:

Sadly I know that detecting the outermost parts would be tough to do and would be hard on the CPU. :(

It's no problem at all. I expect this to demand a great investment of time and energy. And I wouldn't want to force you and burden you (in particular) with how much you do for the community already. Just inviting you to see my idea is enough.

Ping me in a month or so if no one has picked it up

Share this post


Link to post
Share on other sites

So, thinking about this, I would say that parts inside bays and fairings would be protected, but if the bay is open or the fairing released, then the effects would start.

I would imagine that the corrosion factors would also be impacted by the temperature;  the colder it is, the less reactive it would be.  Also implies that on planets with large temperature swings from day to night, that the corrosion rate would change 

The mechanics are pretty simple, except for detecting which parts are touching the ground, and even that may not be too difficult.

Could you come up with a "normal" corrosion rate, and how long it would take to corrode a fairly standard part?

Share this post


Link to post
Share on other sites
10 hours ago, JadeOfMaar said:

Sadly I know that detecting the outermost parts would be tough to do and would be hard on the CPU. :(

Isn't this similar to how FAR uses its voxel model to derive an airflow over the entire craft?  A determination of the shape of the aircraft by the parts that determine that?

Share this post


Link to post
Share on other sites
2 minutes ago, Jacke said:

Isn't this similar to how FAR uses its voxel model to derive an airflow over the entire craft?  A determination of the shape of the aircraft by the parts that determine that?

Shape is different than exposure.

@JadeOfMaar do you have any ideas regarding the corrosion factors and the HP gauge and resilience factors?
Also, I would thing that the planets would have 5 factors:

  • high atmosphere
  • low atmosphere
  • Ground
  • surface liquid
  • submerged liquid.

 

Share this post


Link to post
Share on other sites

@Jacke I've thought of FAR, yes. Something like that would be the best option and would spare the troubles of "Corrosion Scale" which I'm outlining below to LGG.

@linuxgurugamer I've been thinking hard on this for the last few hours and I just did some scribbling in spreadsheets. In my pursuit to answer your question I came up with another new question: How do I make corrosion scale well (with respect to surface area without making things more complicated)? So I decided to derive from the bulkhead size and named this new factor simply "Corrosion Scale." This is so that while a Kerbodyne tank will obviously have a lot more material to corrode than a Mk1 tank, the two should still corrode at nearly the same speed since the Kerbodyne tank has a lot more surface area.

This method is still flawed as a double-length Mk1 tank will, by this rule, last twice as long as either of two single-length Mk1 tanks because it's still a Mk1 tank.

I think these baseline values (assuming a planet with atmo acidity of 1 and at least 1 atm of pressure) would be fine. The formulas here are:

  • HP = (Mass * Tolerance * Resilience * 0.1).
  • Lifespan = HP / Corrosion Scale. Measured in 6 hour days.

PBayQ30.png

Having those 5 factors seems nice actually. Someone on Discord additionally suggested having corrosion scale with the velocity vector while moving through atmo...but you already have it covered by scaling it with part temperature. Shock heating will lead to increased corrosion on its own. That's fabulous. :)

Share this post


Link to post
Share on other sites

Nice.  As you can tell, I am very interested.  My problem is that I don’t do parts. The idea of using a shader to alter parts is fantastic, but again, not my forte.  I would be interested in doing this as part of a group effort.

Share this post


Link to post
Share on other sites
17 minutes ago, linuxgurugamer said:

Nice.  As you can tell, I am very interested.  My problem is that I don’t do parts.

Yeah. I quickly noticed. :D I just asked someone about the possibilities of exploiting ModuleColorChanger{} which is used by the stock heatshields. I got a positive-but not-quite-sure answer, and an offer to write a shader if you can implement it into KSP.

Edited by JadeOfMaar

Share this post


Link to post
Share on other sites

I'd be happy even if there were no visual or heat based effects. Just a simple air/ocean/ground corrosion effect and some basic part tolerance thing would be fine for a start.

Share this post


Link to post
Share on other sites

I'd be glad to add compatibility with this mod (depending on how hard it is) for Kerbal Health.

Share this post


Link to post
Share on other sites
9 hours ago, JadeOfMaar said:

This method is still flawed as a double-length Mk1 tank will, by this rule, last twice as long as either of two single-length Mk1 tanks because it's still a Mk1 tank.

For tank, at least, you can adjust by the size of the tank;  ie: how much fuel it can carry.  Not perfect, but then again, KSP isn't perfect :D

I've looked at FAR in the past, but it was too much for me.  It would be great if someone could pull out the voxelization code such that I could pass in a single part and get back a size and/or a surface area.

Share this post


Link to post
Share on other sites

The Part class has a public attribute "skinExposedArea" that sounds like it might be what your after.

Share this post


Link to post
Share on other sites
4 hours ago, wasml said:

The Part class has a public attribute "skinExposedArea" that sounds like it might be what your after.

I’ve been thinking about this., and my conclusion is that it doesn't matter.  If ANY skin is exposed, that part of the skin will take damage at the same rate as the rest of the part.  It will fail at the same rate no matter what.

Share this post


Link to post
Share on other sites

My though was that if could be used to indicate if the part was exposed or not - if skinExposedArea  > 0 then it would be subject to corrosion. Wouldn't help for the "how fast is it going to disintegrate?" calculations. For the "how fast" question maybe a surface to bounding box area ratio? - dim recollection of seeing a bounding box somewhere - could easily be mistaken. On further thought that might be more effort than it's worth.

Share this post


Link to post
Share on other sites

The point is that the surface area cancels out, since it adds more to corrode but also makes it get eaten faster, and the overall time ends up the same. That's because basically all parts are hollow, so the amount there to go through depends on area rather than volume. Those solid all the way through parts can just have a higher tolerance set.

Share this post


Link to post
Share on other sites
10 hours ago, WarriorSabe said:

Anyone make any progress towards making this a reality?

Not by me.  I have a backlog of work, but am keeping it in mind.  It's not a simple mod to write

Share this post


Link to post
Share on other sites
7 hours ago, linuxgurugamer said:

Not by me.  I have a backlog of work, but am keeping it in mind.  It's not a simple mod to write

Yeah, I can tell  that. I was just curious if anyone was picking it up, or even if just more had been done in figuring I out. If I knew anything at all about .dll modding I would, but I don't.

 

Share this post


Link to post
Share on other sites
On 1/23/2020 at 3:34 PM, linuxgurugamer said:

This is the hard part, identifying the outermost parts.

This is what BDArmory does. Calculates what parts are exposed to explosion and damages them. Corrosion can work like explosion but a really SLOW explosion. And visual effects of corrosion can be just decals placed on the corroded part's collider like bullet holes in BDArmory. Also HullBreach can serve as an example how to apply various effects to the part when it's HP drops below a certain point.

P.S. I don't think that having BDArmory as a dependency for a planet pack is a good idea but it could save a lot of time because it provides (almost) all necessary mechanics for damaging parts. 

Edited by Manul

Share this post


Link to post
Share on other sites
51 minutes ago, Manul said:

This is what BDArmory does. Calculates what parts are exposed to explosion and damages them. Corrosion can work like explosion but a really SLOW explosion. And visual effects of corrosion can be just decals placed on the corroded part's collider like bullet holes in BDArmory. Also HullBreach can serve as an example how to apply various effects to the part when it's HP drops below a certain point.

I disagree.  An explosion causes kinetic damage, which means that only directly visible parts (think line-of-sight).  Gases and liquids, however, touch the entire part and affect the entire part.  The part that isn’t exposed doesn’t really matter, since from a practical matter even a small piece of a part which is exposed will have the visible surface damaged, and that part of the surface will get damaged at the same rate as if the entire part was exposed.

Share this post


Link to post
Share on other sites
On 2/4/2020 at 5:21 AM, linuxgurugamer said:

I disagree.  An explosion causes kinetic damage, which means that only directly visible parts (think line-of-sight).  Gases and liquids, however, touch the entire part and affect the entire part.  The part that isn’t exposed doesn’t really matter, since from a practical matter even a small piece of a part which is exposed will have the visible surface damaged, and that part of the surface will get damaged at the same rate as if the entire part was exposed.

Yeah, I agree. Corrosion doesn't care how much of the part is exposed; if even a tiny bit is it'll corrode through that tiny bit, and your crew probably doesn't care that the hole in the fuel tank is only half a centimeter across. I do wonder if FAR's out-of-airstream detection method (the thing that lets you build custom fairings and cargo bays that work like the real thing in FAR) can be ported over though, and work in a way that'd make sense for this.

Share this post


Link to post
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.