Jump to content

How would you go about designing a Living Space heuristic?


Headhunter09

Recommended Posts

I'm working on a plugin that requires you to give your Kerbals ample space for long journeys. I've got most of the technical backend setup, but I'm struggling with creating a realistic/fun algorithm for space requirements.

Currently, each Kerbal has a level of "sanity" from 0 to 1. Bad things happen if sanity levels fall too low. How should sanity correlate to mission time and living space?

In my mind, a full Hitchhiker pod should degrade sanity slower than a full Mk1 pod; even though the ratio of Kerbals to spots is the same, the Hitchhiker still has more "space". Additionally, if a stupid Kerbal is stuck with a brave Kerbal, I feel like the brave Kerbal's sanity would degrade faster than if he was paired with another brave Kerbal.

So far I've been looking at logistic functions as the basic building block (because linear functions are passe), but I'm not sure how to quantify the interplay of the qualities mentioned above.

Any opinions would be appreciated.

Link to comment
Share on other sites

Any opinions would be appreciated.

Whelp, I'm the king of opinions...

I've been roleplaying additional living space for long missions as a ratio of kerbals to total seats. Anything inside Kerbin's SOI is 1:1, Duna and eve is 2:1, etcetera.

Would you be able to do something like that? Assign each pod a 'minimum flight time' where any kerbal is guaranteed to not lose sanity (a day or two for the Mk1, a week for the MK1-2, a month for the hitchhiker, whatever), but then Divide that out by the number of kerbals in the pod? So, as an example, I could send my hitchhiker out for Duna fully loaded, and my kerbals begin to go a bit batty after two weeks. But if I sent only two guys, it would take a month, and a single dude, while lonely, wouldn't be climbing the walls for two months.

...Are you going to simulate loneliness in this? I'd imagine no matter the living space, a kerbal would go a little nuts flying out all on his own.

As for the math behind it... I'm not a programmer, so I'm talking out my butt on this. I would imagine each pod to have a sort of 'resource' of sanity; a duration that's multiplied by the number of seats in the thing, and then evenly distributed amongst the passengers. That takes care of the ratio bit, and you should be able to fine-tune it for each pod (personally, from shortest duration to longest I would go Mk1 command, the Mk 1 and 2 cockpits, the Mk1 landercan, the Mk3 cockpit, the Mk1-2, the cupola, the Mk2 lander, and the hitchhiker).

Then as a modifier to that degradation, I'd apply the bravery bit (average of the crew should be enough, though you could consider multiplying it by 1.X, were X is the total crew. Strength in numbers and all that) with a straight bonus for any badass flags (if you wanted to), and a flat penalty if the kerbal is alone.

As for stupidity... not sure how or if you should model that. I mean, sure, idiots might panic more, but they might be too stupid to realize the danger and thereby increase morale with their brave, ignorant little face.

Again, not a programmer, so no idea if this actually helped... :/

Link to comment
Share on other sites

Love the concept! Finally a use for those useless stats :)

I think hard coding per module isn't a good idea. Your thing won't work with mods without each one adding the stuff. How about something like a living space affords sanity equal to the number of seats minus 1? Or number of seats*1.5, rounded down. So your hitchhiker would give you 6 "sanity points" while the Mk1 would only give you 1 "sanity point". THe 3-seater would give you 4 (4.5 rounded down) points.

That way, Joe Schmo's 6 Seater Lander Can will just work, giving you 9 "sanity point"s.

Link to comment
Share on other sites

Here's an idea:

  1. Get the total part volume (which can be the absolutely roughest Collider.bounds box for the purposes of this calculation) for every part with seats in it per vessel, divide by number of kerbals present, you get living-space-per-kerbal.
  2. Produce some arbitrary sanity drain value based on reasonable assumptions that a Mk1-2 capsule is supposed to be sufficient for, say, a couple of weeks with full complement -- after all, that was good enough for Apollo -- so that it's equal to the half-life of a kerbal's sanity, and modulate that drain based on the amount of space actually available. Apply this drain over time.
  3. Modulate sanity by whee and panic levels. (look into kerbalExpressionSystem, which is what governs whee and panic levels when kerbals are IVA, these determine their facial expressions). When kerbals have high whee levels, their sanity should receive a boost, when they have high panic levels, their sanity should drop. Modulate that by courage and stupidity -- courageous kerbals lose less sanity when panic is high, stupid kerbals get more sanity when whee is high.

That should get you a nice starting formula. :)

Link to comment
Share on other sites

Idea - Instead of Sanity a boolean value, make it a integer. Lets say it is from 0-11. So, if the number is less than 3, kerbals are sane. If its between 3 and 6, kerbals will do something else, lets say boredom. 6-8, can't EVA, time to maneuver and control the pod is slower. 9-10, kerbals wont control craft at all. 11. They die

Link to comment
Share on other sites

Consider though that a Kerbal ought to require some level of social interaction to remain sane. Otherwise, your Kerbals are basically just in solitary confinement which has been referred to before as the "maniac maker."

The more Kerbals are on a craft, the slower the drain on sanity should be as with each Kerbal sent, you send a larger pool of information/culture which sustains the other members of the crew. The benefit gleaned from the number of Kerbals on a craft should definitely be logarithmic.

In addition, there ought to be a bit of a sweet spot regarding just how much volume/Kerbal is ideal. After all, stick someone inside a house by themselves for an extended period and they'll likely be much more sane than if you stick them in a warehouse for the same length of time.

So as far as math goes...

The following is effectively a recursive function for determining the sanity of a Kerbal on a given day.

n=number of kerbals

c=sanity drain reduction due to company

d=distance from Kerbin, with a given unit being the distance between Kerbin and the Mun.

ds=sanity modifier accounting for distance away from home (and thus communication lag)

v=sum of the volumes of all habitable parts of the craft

vpk=volume per Kerbal

ivpk=idea volume per Kerbal (we'll assume this to be 30m^3 in this)

vs=sanity modifier accounting for the difference between vpk and ivpk

p=sanity of the given Kerbal on the previous day

iepk=ideal entertainment per Kerbal (we'll assume 1)

e=entertainment sum (provided that you have entertainment equipment on the ship)

es=sanity modifier due to entertainment

f=natural sanity falloff. We'll assume 0 for now.

s=sanity [0,10] (0=suicidal,0.25=homicidal,0.5=vandalization,1=disobedience during maneuvers, 2=delayed reaction during maneuvers, 3=disobedience when performing science, 4=delayed transmission of data, 6=minor impairment of actions, 8=minor reduction in science points from a given experiment, 9=normal, 10=slightly increased science points from experiments). Kerbals start at 10 on the launchpad.

bravery=how brave the Kerbal is [0,1]

stupidity=how stupid the Kerbal is [0,1]

ab=average bravery on the craft

bm=bravery modifier

as=average stupidity on the craft

sm=stupidity modifier

wp=whee/panic modifier which is derived from the kerbalExpressionSystem discussed by a previous poster. It is to be bounded by [-1,1]. wp is to be the most extreme whee/panic incident during the day added to the average whee/panic divided by 2.

c=log2(1+n)

ds=log(1+d)/10

ivk=30

vpk=v/n

f=0

iepk=1

es=normal(iepk, iepk/3, e)*2-1

vs=normal(ivpk,ivpk/3,vpk)*2-1

bm=bravery-as

sm=ab-stupidity

s=p+vs+es+c-ds-f+bm+sm+wp

Hopefully that should be something close to what you're looking for? Change constants as necessary obviously. In addition, certain events should impact sanity as well. Hitting the gravity well of the target planet ought to have a huge boost in sanity as should getting back to Kerbin's SOI. Having another crew member commit murder or suicide ought to dramatically reduce their sanity. Coming in contact with new Kerbals that the crew hasn't met before also ought to increase their sanity.

When it comes time to implement the system, do so incrementally and test each layer to see if it works and makes sense before moving on to the next level of complexity.

Edited by Volt Cruelerz
Link to comment
Share on other sites

"Social" mods like Chatterer should give a boost to morale :) . The same if a greenhouse module is detected on the ship. Also distance: IMHO morale should drop faster when you are in deep space, than in Kerbin's SoI.

yeah shouldn't also slow down when in view of a moon or planet as they would marvel at the sight

Link to comment
Share on other sites

Any opinions would be appreciated.

What I wouldn't do is make it too complicated... it's easy to design complicated algorithms that only a mathematician could understand. But most players aren't mathematicians. Or Comp Sci majors. Simple, reasonably represents the situation, reasonably easy to grasp, and results in reasonable ship designs and/or mission durations.

Link to comment
Share on other sites

"Social" mods like Chatterer should give a boost to morale :) . The same if a greenhouse module is detected on the ship. Also distance: IMHO morale should drop faster when you are in deep space, than in Kerbin's SoI.

I dont really know how to govern various pods and living modules influence on kerbal sanity because there are many options. Distanmce from kerbin, size of crew, comfort of command pods and size nd number of living modules, time of mission..

But i have some ideas what shoudl mmomentary boost their mood:

- Various tasks that brake their boredoom. Eva in space (smallest gain), arriving in SOL of other planet, landing, driving rover (largest gain).

- Landing on Laythe or Duna gives especially large boost because these are earth like.

- If no kerbal (in this savegame) landed on some planet/moon before, doing it gives strong "exploler" moorale bust.

- Docking with another ship and meeting with kerbal that wasnt on board before. This is to prevent just undocking part of the ship and redocking right away to boost morale in cheat way.

- Death of one of the crew members. This woudl of course decrease morale.

Also, communiation equipment. These parts coudl boost morale in similar way that living modules do.

SImpliest antennas allow to talk to mission control, mmore sophistiated allow video-chats, downloading mmovies and games fromm kerbal-net. Farther from kerbin ship is, more power antennas drain.

Edited by kiwiak
Link to comment
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.

×
×
  • Create New...