Nertea

[WIP] Radioactivity - test release 0.1.1 (Sept 7, 2016)

Recommended Posts

Radioactivity 

Raycast radiation for KSP

Test Release 0.1.1, September 7th 2016

This is a plugin whose goal is to add a relatively realistic radiation simulation system to KSP. The idea is to construct a reasonably comprehensive and informative system that will tackle the challenges of managing radiation exposure. You can read some stuff on the wiki

I'm developing three components: Local, Solar and Planetary (probably in that order). Local is focused on the simulation of radiation inside the physics bubble. So sources of radiation like nuclear reactors, engines, etc. Solar will simulate radiation from stars, properly attenuated by planetary atmospheres, magnetic fields, etc. Planetary would deal with radiation belts and trapped charged particles. 

Local operates on a source-sink concept. Sources of radiation, such as nuclear reactors, compute line of sights to sinks of radiation, such a crew pods. Radiation is emitted by these sources and attenuated along the ray paths and added to sinks. It's pretty simple! Here's a few talking points...

  • Radiation is attenuated by distance (inverse square law), part material (radiation attenuation constant) and part density (when it moves through a part)
  • Denser parts attenuate more radiation per unit length
  • Parts can have a specific material specified, with a particular radiation attenuation constant.
  • Terrain is currently opaque, so you can hide a reactor behind a hill

This means that most planned methods of actually dealing with radiation are possible. You can distance a source from a crew compartment, create a radiation shield out of dense materials, etc. 

 

I know that this is not fully realistic, so here's some caveats. 

  • Only one energy level of radiation (500kEV gamma) is simulated. This might change (just needs more attenuation constants) but for now it's sufficient
  • The peculiarities of raycasting result in some geometric bugs
  • Terrain being fully opaque is a simplification
  • No scattering, activation or embrittlement. 

A test release with the Local component is ready. Read on to get it!

Test release Info

Do not use this on a save you really care about. It might kill your Kerbals (by accident). If you find a bug, please log it on GitHub, and for heaven's sake provide information!

  • output_log.txt from the KSP_Data directory (this mod is currently very log-verbose so this very much helps)
  • List of installed mods, if any.
  • If it's a bug with the geometry of the situation (like a ship not recalculating ray paths correctly, or something not attenuating right) please provide screenshots of the ship with the overlay open

Balance

Not much has been balanced. 

Performance

I've tested this a bunch with sets of up to 10 radiation sources and 10 radiation sinks constantly changing position. Performance hit seems negligible here

Mod Compatibility

Not compatible with Kerbalism. Most recent release of Kerbal Atomics and Near Future Electrical (forgot to include the shadow shields for NFE reactors though) contain the right stuff and patches to enable emissions from reactors and engines, but that's about it. New crew containers, science instruments and the like from other mods are not integrated. 

If you want to write patches to add things to mods, please consult the documentation on the wiki, and keep in mind the fluctuating balance state.

Known Issues

  • The radiation overlay doesn't always load correctly when entering the VAB or loading a vessel in the VAB. To fix this, just move the root part around a bit.
  • Probe core degradation is not really in (my hacks have not worked yet) but probes do track exposure
  • Science experiment degredation is not well tested
  • Testing in career has been limited up to this point
  • Radiation sickness doesn't do anything, only death
  • Some elements of the UI aren't quite done so I'm aware of that, but I welcome suggestions on improving communication and stuff. 

After such a big stack of disclaimers, the latest test build can be acquired from the github page.

Source is on the Git page there. Licensed as ARR for now, until stability. 

Edited by Nertea

Share this post


Link to post
Share on other sites

This sounds like a very cool idea that I've heard people call for for a long time.  Good luck on development, I'll definitely be watching this.

Share this post


Link to post
Share on other sites

That's fancy! Are you considering a patch to give the Kerbal Atomics engines built in 'shadow' shields if installed? Does this mean docking a nuclear craft requires doing fancy maneuvers to keep the station shielded? Dedicated shield parts? So many questions, can't wait to see!

Share this post


Link to post
Share on other sites

One idea you may want to consider is a "radiation bunker" type part (basically a small crew compartment nested inside a water tank, to protect kerbals during solar flares , if there are any)

Share this post


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

Any plans to handle solar radiation?

Yes, it's mentioned in the post. 

1 hour ago, Starbuckminsterfullerton said:

That's fancy! Are you considering a patch to give the Kerbal Atomics engines built in 'shadow' shields if installed? Does this mean docking a nuclear craft requires doing fancy maneuvers to keep the station shielded? Dedicated shield parts? So many questions, can't wait to see!

The goal is to have a code-defineable shadow shield block that you can insert into a RadioactiveSource module by defining a position, a radius and a direction. This allows any part to have a built in shadow shield. And yeah, docking a nuclear craft would certainly need some complex maneuvers. It depends on how things end up being set up, but in the current implementation the reactor doesn't produce radiation when it's off, so you'd have to approach completely under RCS power or plan your burns to be far enough away and drift in. In a different implementation an idle reactor might be radioactive too (in NFE radiation will be tied to amount of waste in the reactor) so would require orientation constraints.

1 hour ago, MerlinsMaster said:

One idea you may want to consider is a "radiation bunker" type part (basically a small crew compartment nested inside a water tank, to protect kerbals during solar flares , if there are any)

I would like to avoid adding any parts at this stage, though a storm shelter is definitely a concept that is valid. Code-wise you can do that already, RadiationCrewContainer already contains a field for reducing exposure, so you would just set that to 90% or something. Ideally if I achieve my goals you should be able to work with radiation without introducing any new parts at all. 

Edited by Nertea

Share this post


Link to post
Share on other sites

This sounds so cool. I wish I could fast-forward to the point where you've finished it. :) The chance to design a more realistically constrained Mars mission might be enough to convince me to take the leap to Realism Overhaul (which I assume will have to include this eventually).

Will the fullness of fuel tanks matter? Will RTGs be sources?

I wonder if NASA would even consider doing docking with nukes IRL, given how insanely cautious and gradual the ISS approach procedure is. They couldn't really consider a plan where if you miss and the other craft drifts past, the contingency plan is for everyone to get irradiated.

Share this post


Link to post
Share on other sites

Very cool!

For solar and body radiation you can probably harness the existing occlusion system that flightintegrator uses, it sets up occlusion based on from-the-sun and from-the-celestial-biody directions.

Share this post


Link to post
Share on other sites

Solar wind is actually complex, but like cosmic radiation could be simply approximated as isotropic (it might not be worth bothering with either, frankly). Solar flares, OTOH roughly approximate to LOS from the sun, and are acutely dangerous. The player would need a mechanism to deal with them (if pointing was a solution). I'm not sure if KSP has the requisite tools to deal with such events (warn the player, or ideally have the crew deal with it (because there is no AI).

Share this post


Link to post
Share on other sites

I hope the mod will be modular enough it can be used other mods, I would realy love to integrate this in KSPI for all its radioactive engines. It should also finally make the use of shadow shield useful.

Edited by FreeThinker

Share this post


Link to post
Share on other sites

very nice :) I will be more than happy to help when it comes to solar/gcr/planetary/van Allen radiation when you move to them since I've done some research in those areas some time ago :)

edit: maybe it will be of use for you the spreadsheet I've made a while ago:

concept is as follows:

Kerbals have maximum allowable radiation limit (when it's exceeded Kerbal dies) with bonuses from stars and could be healed to certain extent (i.e. can heal 50% of accrued radiation when at KSC, or up to 25% in something like medical bay or using some medicines)

mlyUojM.png

so for example stupid kerbals could have 'hard skin' perk so can withstand more radiation (but then they are less useful for stuff like EPL in-situ construction etc),

you can 'heal' them up to certain threshold when they return from mission to KSC or in space using specialized part (med bay?)

thus radiation would give Kerbals a lifespan although it could be quite long if you buried them in special colony couple meters under regolith or in orbit behind couple meters thick water wall ;)  or inversely they could die quite quickly while being near nuclear equipment, inside Jool's deadly van Allen belt or when they are not propely shielded against spe (solar particle event:)

 

Edited by riocrokite

Share this post


Link to post
Share on other sites

The idea of lifetime limits hadn't occurred to me (in which case cosmic/solar radiation might make more sense... what would the mechanism be,though? Would they become tourists? (there is no "retired" due to reaching an exposure limit mechanism in game)

Share this post


Link to post
Share on other sites
19 hours ago, Nertea said:

Radioactivity 

Raycast radiation for KSP

Time to move this project out of skunkworks! This is a plugin whose goal is to add a relatively realistic radiation simulation system to KSP. The idea is to construct a reasonably comprehensive and informative system that will tackle the challenges of managing radiation exposure

Anyways, I'm developing three components: Local, Solar and Planetary (probably in that order). Local is focused on the simulation of radiation inside the physics bubble. So sources of radiation like nuclear reactors, engines, etc. Solar will simulate radiation from stars, properly attenuated by planetary atmospheres, magnetic fields, etc. Planetary would deal with radiation belts and trapped charged particles. 

The main component which is getting near a ready to test state is Local. 

Local operates on a source-sink concept. Sources of radiation, such as nuclear reactors, compute line of sights to sinks of radiation, such a crew pods. Radiation is emitted by these sources and attenuated along the ray paths and added to sinks. It's pretty simple! Here's a few talking points...

  • Radiation is attenuated by distance (inverse square law), part material (radiation attenuation constant) and part density (when it moves through a part)
  • Denser parts attenuate more radiation per unit length
  • Parts can have a specific material specified, with a particular radiation attenuation constant.
  • Terrain is currently opaque, so you can hide a reactor behind a hill

This means that most planned methods of actually dealing with radiation are possible. You can distance a source from a crew compartment, create a radiation shield out of dense materials, etc. 

Sources of radiation currently supported:

  • Nuclear reactors (through ModuleResourceConverter and through NFE's FissionReactor)
  • Engines (emit radiation from engine cores or from engine plumes)
  • Resources (have a resource be radioactive)

Currently, the only sink is a crew container (either a kerbal spacesuit or a crewed module). I plan on adding sinks for science instruments and probe cores (poor performance under radiation load). So here's some pictures! The UI is totally WIP but shows essentially what's going on. I probably won't put much work into the UI before 1.1.

 

The main thing standing between this and good testability is writing a tracking system to track Kerbal radiation exposure (I could use some pointers here). I plan to make this simple but configurable. At a base level, at a certain dosage, the Kerbal will get radiation sickness and become touristlike. At a further dosage, they'll die. Returning the Kerbal to the space centre will cause a slow recovery of their total exposure, and they won't be able to be used until the dose decreases enough. Another issues is getting the overlay working in the VAB - the method I'm using for density calculation is only valid in flight. These are to be overcome.

One big thing is performance impact. Casting all these rays will start causing problems fast, but I've hopefully written a system that only updates connectivity when it needs to be, and limits the number of raycasts that are done per frame. Current tests have been done with ~10 sources and 10 sinks on a craft (~100 links) with no performance problems.

Lastly, realism:

  • Only one energy level of radiation is simulated. This might change (just needs more attenuation constants) but for now it's sufficient
  • The peculiarities of raycasting result in some geometric bugs
  • Terrain being fully opaque is a simplification
  • No scattering, activation or embrittlement. 

Test release at some point, but not now! I'll keep this thread updated. 

Finally!  I've asked for something much simpler in the past, and you're delivering the goods ,only better! 

It would be nice although maybe not possible,  to have a heat overlay style system to check for exposure.

 

But as I've said ,I'm a huge fan of nuclear rockets, but I think this would be a better balance to the LV-National rather than an artificially poor TWR

15 hours ago, Starbuckminsterfullerton said:

That's fancy! Are you considering a patch to give the Kerbal Atomics engines built in 'shadow' shields if installed? Does this mean docking a nuclear craft requires doing fancy maneuvers to keep the station shielded? Dedicated shield parts? So many questions, can't wait to see!

I agree with this, or at least a module manager to reduce the weight of the engines by whatever the shield will weigh. Unless this would lead to drone abuse since you're not modeling non organic damage.

 

Maybe as a stop gap, give the heat shields high shielding, so you could stock a larger size heat shield on your command pod to provide extra shadow 

Share this post


Link to post
Share on other sites
2 hours ago, riocrokite said:

v ery nice :) I will be more than happy to help when it comes to solar/gcr/planetary/van Allen radiation when you move to them since I've done some research in those areas some time ago :)

edit: maybe it will be of use for you the spreadsheet I've made a while ago:

concept is as follows:

Kerbals have maximum allowable radiation limit (when it's exceeded Kerbal dies) with bonuses from stars and could be healed to certain extent (i.e. can heal 50% of accrued radiation when at KSC, or up to 25% in something like medical bay or using some medicines)

mlyUojM.png

so for example stupid kerbals could have 'hard skin' perk so can withstand more radiation (but then they are less useful for stuff like EPL in-situ construction etc),

you can 'heal' them up to certain threshold when they return from mission to KSC or in space using specialized part (med bay?)

thus radiation would give Kerbals a lifespan although it could be quite long if you buried them in special colony couple meters under regolith or in orbit behind couple meters thick water wall ;)  or inversely they could die quite quickly while being near nuclear equipment, inside Jool's deadly van Allen belt or when they are not propely shielded against spe (solar particle event:)

 

I really like the idea that ksc Can only heal to a certain percentage to simulate kifespans

Share this post


Link to post
Share on other sites
14 hours ago, HebaruSan said:

Will the fullness of fuel tanks matter? Will RTGs be sources?

I wonder if NASA would even consider doing docking with nukes IRL, given how insanely cautious and gradual the ISS approach procedure is. They couldn't really consider a plan where if you miss and the other craft drifts past, the contingency plan is for everyone to get irradiated.

Fullness already matters (attenuation is based on the amount of mass in the raypath), but RTGs will not generate radiation, they should be fully contained by their casing.

13 hours ago, NathanKell said:

For solar and body radiation you can probably harness the existing occlusion system that flightintegrator uses, it sets up occlusion based on from-the-sun and from-the-celestial-biody directions.

That's good to know - I was hoping to avoid doing more occlusion checking. I'll investigate this.

9 hours ago, FreeThinker said:

I hope the mod will be modular enough it can be used other mods, I would realy love to integrate this in KSPI for all its radioactive engines. It should also finally make the use of shadow shield useful.

At the moment, that would be pretty easy, assuming that the KSPI engines are all based on ModuleEngines. RadioactiveEngine just scales its output flux according to the engine's throttle setting or flow rate (cfg field), and multiple emission points can be handled (say for reactor and thrust plum). I can add more types of scaling as well, and am planning a passive rate  emitter component as well.You can let me know if that doesn't match your needs and I can add some stuff.

2 hours ago, riocrokite said:

very nice :) I will be more than happy to help when it comes to solar/gcr/planetary/van Allen radiation when you move to them since I've done some research in those areas some time ago :)

*snip*

That might be a little more complex than what I want to do with effects right now. 

2 hours ago, tater said:

The idea of lifetime limits hadn't occurred to me (in which case cosmic/solar radiation might make more sense... what would the mechanism be,though? Would they become tourists? (there is no "retired" due to reaching an exposure limit mechanism in game)

Dont' quote me here, but I think a kerbal can be "missing" or killed, so they could be flagged as missing until a certain time had passed.

2 hours ago, Buster Charlie said:

It would be nice although maybe not possible,  to have a heat overlay style system to check for exposure.

 

You can kinda see a rough system in the screenshots, but I don't want to spend much effort on this until after 1.1, as the UI will become obsolete. One of the problems is that I don't test every single part for occlusion so 

2 hours ago, Buster Charlie said:

I agree with this, or at least a module manager to reduce the weight of the engines by whatever the shield will weigh. Unless this would lead to drone abuse since you're not modeling non organic damage.

 

Most of my engines, reactors and such do have a limited shadow shield built into the top of the reactor housing (see http://www.aerospaceprojectsreview.com/blog/wp-content/uploads/2012/08/nerva-art-63.jpg ). This would be for free in the mass, and provides quite a narrow cone of attenuation and reduces the outgoing flux somewhat. I haven't implemented this yet in this plugin but I plan to. You'd therefore get a small shield for free, and could construct a large shield with fuel tanks, structural panels, or dedicated radiation shield parts. Heat shields would not be great as they are designed to be as light as possible, wheras gamma attenuation is basically 100% proportional to the density of the material. 

2 hours ago, Buster Charlie said:

Unless this would lead to drone abuse since you're not modeling non organic damage.

Ah but I am! Probe core efficiency will decay with lifetime dose as well ;). 

Share this post


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

You should add "Madame Curie" to credits. Also, I like that touristification seems to be catching on as a penalty mechanic.

Haha, I've been listening to that while deving!

Share this post


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

You should add "Madame Curie" to credits. Also, I like that touristification seems to be catching on as a penalty mechanic.

I don't know, I lile the sense of loss you get from a fatal mistake... Definitely make sure that death is an option!

Share this post


Link to post
Share on other sites

@Nertea There was a really interesting post written a few months back in development discussion about adding a shadow shield component for the NTR (and subsequently a radiation system). The common thought there was that while exposed to a "dangerous" dose of radiation, kerbals are rendered incapacitated. Radiation sickness (touristification). Once no longer exposed, they return to normal, based on the fact that kerbals seem to experience no detriments to long term radiation exposure from sitting on Laythe for years on end. :sticktongue: Probe cores would suffer reduced or zero functionality, dependent on their level of integrated shielding (the qube having a lot and an octo2 having zero, for example). I'd definitely be interested in seeing optional more permanent consequences (and there's always those sadists who want the threat of death for their intrepid crews) like skill regression, loss of guidance systems (reducing SAS level on probes), science instruments ceasing to function both temporarily or permanently, etc.

Share this post


Link to post
Share on other sites

@Captain Sierra, that's more or less what I said above ;).

Good progress today, I got the main components of the system working in the editor (at least not crashing things) and ensured that recalculation of attenuation values occurs properly with geometric and mass based changes. I also optimized the raycaster some more... starting work on kerbal tracking.  

Share this post


Link to post
Share on other sites

looking forward to this so much. Career dosage would be a great mechanic for me, even if I have to track it myself. I was going to simulate this anyways so having an actual ingame component to work with is even better. Been disappointed to see several other radiation mods come and go the past year or so, great to see you taking this on Nertea!

Share this post


Link to post
Share on other sites
17 hours ago, Nertea said:

At the moment, that would be pretty easy, assuming that the KSPI engines are all based on ModuleEngines. RadioactiveEngine just scales its output flux according to the engine's throttle setting or flow rate (cfg field), and multiple emission points can be handled (say for reactor and thrust plum). I can add more types of scaling as well, and am planning a passive rate  emitter component as well.You can let me know if that doesn't match your needs and I can add some stuff.

Well in your current model you seem to assume, the reactor itself is the source of the radiation but for other Engines like the Inertial Confinement D-T VISTA engines, the radiation is only present when it is fusing and only from a single point just behind the engine. THe engine itself acts as a shadow field

Edited by FreeThinker

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.