Jump to content

The KSP GPWS Dev Thread


SolarLiner

Recommended Posts

Don't know if I can post a whole new thread for that ... Sorry if I cannot !

Anyway, here goes everything about development of the GPWS for KSP. Thoughts, questions, tips and tricks ... Help on development is appreciated, especially if I have problems, like the first one:

I need to find a way to make a nice curve for the G-tolerance (ie: how many number of G before the alarm kicks in). I want it to be human-like: Max 30G for 1/4 sec, Max 10G for 1 min, Max 5G for 5 Minutes, Max 3G for 10 Minutes. Any G above 1 after 10 minutes of acceleration turns the alarm on.

Can anyone help me? Maths are my "downside" on coding ...

Thanks in advance to anyone that will (in)directly participate to the project ! :cool:

Source | Main thread

Link to comment
Share on other sites

If what you want is an easy way to interpolate between those points, I'd suggest a FloatCurve variable. It is what engines use for Isp and can be specified in part.cfg files.

FloatCurves are a list of points, time and value, but they are really just independent variable and dependent variable. Use FloatCurve.Evaluate(time) to get the dependent variable.

I would probably set it up so that G level is "time" and the max duration at that G level is "value"; so that maxDurationAtThisGLevel = FloatCurve.Evaluate(gLevel)

Extra info you probably don't need:

FloatCurves are a kerbal specific class which is based upon the Unity AnimationCurve, which in turn solves for points along the curve as a bezier curve.

Link to comment
Share on other sites

Alright, now I'm facing the Huge Problem of the Mod : GUI ! And I have absolutely no idea on how to implement a good one. It will be mostly for switching buttons, triggering alarms, stopping dem annoying imminent crash alarms if you crash very often ! And add a volume slider, because for now every alarm sound volume is binded to the Voice Volume in the Sounds settings, and I want to let you have more control on how loud to play the sounds. So yeah, as "always", if anyone can help me, would be awesome ! :cool:

Link to comment
Share on other sites

For some reason, on the Debug ThingyTM show "[GPWS]Bingo Fuel stuff !", but not the "Fuel calculated" ...

Debug.Log("[GPWS]Bingo Fuel stuff !");
float pLiquidAmount = (float)(LiquidFuel.amount / LiquidFuel.maxAmount);
float pOxiAmount = 1.0f;
if (Oxidizer.maxAmount > 0) pOxiAmount = (float)(Oxidizer.amount / Oxidizer.maxAmount);
Debug.Log("[GPWS]Fuel calculated");

And everything after is not done too ... like something unexcepted made the whole Update() stop right there. I thought at first it was a division by 0 (Oh Shi-) but no, because of the if statement.

Weird ...

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...