Jump to content

[Plugin] [0.90] WIP - G-Force v0.0.4-alpha - Experience the effects of G-forces on your Kerbals!


russnash37

Recommended Posts

G-Force - Development Thread

Version 0.0.4-alpha released 1/29/2015

G-Force is a plugin that aims to represent the effects of G-forces on your kerbals by applying visual effects, such as blackouts and redouts, to the flight camera. With the mod currently in alpha stage this thread aims to reach out to the KSP community for help and direction with it's development. This mod currently targets 9G's as a maximum limit, at which vision is completely obscured.

Javascript is disabled. View full album

What can I do to help?

I'm looking for all and any feedback that anyone is kind (and constructive!) enough to give, but especially with focus on the following:

  1. Accuracy of the g-force effects in relation to the g-force meter in KSP.
  2. Realism of the g-force effects, I've only been able to go off of wiki and other web information but anyone who has real world experience would be super helpful!

Planned features

  1. The effects are currently limited to applying either a black or red filter to the screen at varying levels of transparency, as this mod is developed I would like to improve on this with, for example, effects being more focused on restricting the field of view as the g-forces increase instead of just redding or blacking out the whole screen.
  2. Currently the effects will apply to all vessels, however, this should be restricted to manned vessels and not show the g-forces when piloting probes.
  3. Implement a GUI with options for toggling the G effects on and off and restricting them to IVA only.
  4. Delay startup of G effects until after the vessel is fully loaded.
  5. Tie G tolerance into the Kerbal professions and XP system.

Features implemented but still WIP

  1. Make G effects cumulative based upon time spent at a particular G, allowing for tolerance of G forces over certain periods of time.
  2. Implement negative G's.
  3. Reduce tolerance to negative G's.

Completed features

None as of yet!

I'm up for this! Where can I get the alpha?

Download the alpha from GitHub

Edited by russnash37
Updated plans list based upon feedback.
Link to comment
Share on other sites

This looks awesome! I've been hoping someone would make this! Downloading now.

Edit: regarding narrowing a field of view, I wonder if you could make a texture that's black, opaque on the outside and nearly transparent in the middle, and just increase the opacity of it based on g-forces until the whole screen is obstructed?

Link to comment
Share on other sites

This looks awesome! I've been hoping someone would make this! Downloading now.

Edit: regarding narrowing a field of view, I wonder if you could make a texture that's black, opaque on the outside and nearly transparent in the middle, and just increase the opacity of it based on g-forces until the whole screen is obstructed?

I think you're on the right track with that, I was thinking along similar lines. As far as I understand, g-forces affect your field of view and work their way towards the center of your vision so this would probably be more realistic. It would be nice though if someone with real world experience of high g-forces could confirm this though.

Link to comment
Share on other sites

I've only been in a carnival centrifuge that went up to about 2.5 G's, but I can confirm that at that range I started to lose peripheral vision if I sat up.

Also, I've been testing, and I notice that the blackout effects start immediately at 1 G, such that even being on the runway (with the engine off) there is a slight darkening of the screen. Maybe there should be a bit of a "dead zone"?

Link to comment
Share on other sites

I love this!

Suggestion: you might want to do something similar to the G-force code I wrote for Deadly Reentry, i.e. have a cumulative "G damage" meter that sets how dim the screen gets, have it reset to 0 when Gs get low enough, and increment it based on something like the G-force cubed, per tick. That means it takes a few seconds even at 8Gs to black out, and some minutes at 4Gs.

Link to comment
Share on other sites

I've only been in a carnival centrifuge that went up to about 2.5 G's, but I can confirm that at that range I started to lose peripheral vision if I sat up.

Also, I've been testing, and I notice that the blackout effects start immediately at 1 G, such that even being on the runway (with the engine off) there is a slight darkening of the screen. Maybe there should be a bit of a "dead zone"?

There does seem to be a sudden jerk in G's when a craft is initially launched, I'll look into what events I can tie into so that the G effects don't come into play until you're at the point where you can manipulate the controls.

I also think what you're saying about the G forces kicking in right away at 1G ties into NathanKell's comment which I'll answer further down under his quote.

Maybe an option to toggle whether the black/red out effects only work when you're in IVA (and First Person View of EVA) mode?

I definitely plan to add some configuration options via a GUI panel down the road, a toggle for IVA only is a great idea which I'll add to the list.

I love this!

Suggestion: you might want to do something similar to the G-force code I wrote for Deadly Reentry, i.e. have a cumulative "G damage" meter that sets how dim the screen gets, have it reset to 0 when Gs get low enough, and increment it based on something like the G-force cubed, per tick. That means it takes a few seconds even at 8Gs to black out, and some minutes at 4Gs.

I see what you're saying, I also think skykooler was referring to something similar. Right now the code is pretty basic and effects are based directly on G's but I like your idea of them building up over sustained forces, the wiki entries talked about standing high spikes in G's for example. I'm not sure what the 'real world' parameters are for this though, i.e. how long it takes at a given amount of G's for you to start seeing vision impairment. From what skykooler was saying about the centrifuge it sounds like it's all relative to position and with some positions, such as sitting up, the impairments start to creep in where as if you're in the 'right' position they don't.

The wikipedia entries mention the direction of G-forces in reference to your spine, i.e. if a pilot is accelerating down a runway he can experience G forces but because he is facing the direction of acceleration he will not see any effects. This is going to be tough to simulate in KSP, I shall have to dig around and see what I can find to tell me more in-game about the direction the G's are coming from.

Link to comment
Share on other sites

Stuff I'd like to see: Gradual G effects, instead of blacking out instantly at 9, have kerbals be able to hold 7-9 for a few seconds before the screen is completely dimmed. It would also be a cool to integrate this with the kerbal xp system. Where Pilot kerbals start with a higher G tolerance and gained it faster than the other kerbals classes on level up (say a max level kerbal could hold 9G's for well over 20 seconds with barely any dimming).

Also: lower tolerance for negative G's than positive (redout will usually quickly occur at -2 to -3).

Link to comment
Share on other sites

I see what you're saying, I also think skykooler was referring to something similar. Right now the code is pretty basic and effects are based directly on G's but I like your idea of them building up over sustained forces, the wiki entries talked about standing high spikes in G's for example. I'm not sure what the 'real world' parameters are for this though, i.e. how long it takes at a given amount of G's for you to start seeing vision impairment. From what skykooler was saying about the centrifuge it sounds like it's all relative to position and with some positions, such as sitting up, the impairments start to creep in where as if you're in the 'right' position they don't.

The wikipedia entries mention the direction of G-forces in reference to your spine, i.e. if a pilot is accelerating down a runway he can experience G forces but because he is facing the direction of acceleration he will not see any effects. This is going to be tough to simulate in KSP, I shall have to dig around and see what I can find to tell me more in-game about the direction the G's are coming from.

You could always track the G's yourself (instead of relying on the game's system) by comparing the velocity this frame to the velocity last frame; that would give you G's as a Vector3, which you should be able to get components of in each of a craft's directions.

Link to comment
Share on other sites

Stuff I'd like to see: Gradual G effects, instead of blacking out instantly at 9, have kerbals be able to hold 7-9 for a few seconds before the screen is completely dimmed. It would also be a cool to integrate this with the kerbal xp system. Where Pilot kerbals start with a higher G tolerance and gained it faster than the other kerbals classes on level up (say a max level kerbal could hold 9G's for well over 20 seconds with barely any dimming).

Also: lower tolerance for negative G's than positive (redout will usually quickly occur at -2 to -3).

I like the idea of tying G tolerance into the XP system and kerbal classes, definitely adding that to the future features list!

Better representation of G effects is going to be in the next alpha which may be ready for release later on today, this will also include the reduced tolerance to negative G's as you've suggested.

As a side note, I've not had a lot of luck triggering negative G's in KSP, my thoughts were that the lower half of an inside loop or rolling to a sideways orientation and pushing the stick forward (drop the nose) should produce them. Anyone have any advice for this?

You could always track the G's yourself (instead of relying on the game's system) by comparing the velocity this frame to the velocity last frame; that would give you G's as a Vector3, which you should be able to get components of in each of a craft's directions.

That's a possibility, if I can't find anything in the docs I may have to go that route.

Link to comment
Share on other sites

As a side note, I've not had a lot of luck triggering negative G's in KSP, my thoughts were that the lower half of an inside loop or rolling to a sideways orientation and pushing the stick forward (drop the nose) should produce them. Anyone have any advice for this?

It does, but the KSP G-force readout is absolute G's, so the reading will never be negative.

Link to comment
Share on other sites

It does, but the KSP G-force readout is absolute G's, so the reading will never be negative.

Are you sure? Doesn't the bar have readings south of the start position?

- - - Updated - - -

Version 0.0.3-alpha has just been posted over on GitHub.

This version implements cumulative G's, although it still needs a lot of tweaking. G forces are now tolerable for a time, depending on how intense the G's are, until a threshold when the effects start or G's drop sufficiently to allow the effects to reverse. Currently, it is possible to withstand about 4 G's without any effects, which will probably be the settings for a standard Kerbal once I've worked in the XP system.

The variables and thresholds are still very much guesswork in the code, but tweaking should be profitable over time and testing.

Link to comment
Share on other sites

  • 2 weeks later...

G-Force is a plugin that aims to represent the effects of G-forces on your kerbals by applying visual effects, such as blackouts and redouts, to the flight camera. With the mod currently in alpha stage this thread aims to reach out to the KSP community for help and direction with it's development. This mod currently targets 9G's as a maximum limit, at which vision is completely obscured.

  1. Accuracy of the g-force effects in relation to the g-force meter in KSP.
  2. Realism of the g-force effects, I've only been able to go off of wiki and other web information but anyone who has real world experience would be super helpful!

Planned features

  1. The effects are currently limited to applying either a black or red filter to the screen at varying levels of transparency, as this mod is developed I would like to improve on this with, for example, effects being more focused on restricting the field of view as the g-forces increase instead of just redding or blacking out the whole screen.
  2. Currently the effects will apply to all vessels, however, this should be restricted to manned vessels and not show the g-forces when piloting probes.
  3. Implement a GUI with options for toggling the G effects on and off and restricting them to IVA only.
  4. Delay startup of G effects until after the vessel is fully loaded.
  5. Tie G tolerance into the Kerbal professions and XP system.

Features implemented but still WIP

  1. Make G effects cumulative based upon time spent at a particular G, allowing for tolerance of G forces over certain periods of time.
  2. Reduce tolerance to negative G's.

Hmm, how trained are Kerbals? RL fighter pilots train to 9G also, but with vision unimpaired as the goal.

You can't really implement GLOC properly. You can do parts of it well, but part of having low oxygen at the brain is the brain stops working properly - so you can think you are on top of the G, and then the next thing you know, your instructor is pulling the plane out of the dive as you come to. The parts you can do well (IMO) are tunnel vision, vision starting to gray out as G is sustained, vision redding out as negative G occurs - and that will be quick, there really isnt much you can do to improve tolerance of negative G effects.

Another problem would be the seat inclination of each cockpit being different. For the plane cockpits, the seat is much as you would expect, with positive and negative G being in the normal axis. However, for most of the rocket cockpits, positive and negative G are in the longitudinal axis - eyes in and eyes out G, instead. Very different effects of that G, too. You wont get blood rushing to your eyes from eyes out G, but you will from negative G.

Id suggest tying your max G limit at which the screen blacks out, to a G endurance system. Realistically speaking, people can tolerate very high G for short periods, say a half second, quite well. Sustained G, is another thing entirely. G tolerance - ability to tolerate short spikes of G force. G endurance - ability to endure through periods of sustained high G force.

Trained pilots/astronauts/cosmonauts/kerbonauts, possibly wearing Combat EDGE or something similar, can sustain 9G for an extended duration, say 5 minutes... although this would require peak physical condition, and is physically very demanding.

I like the idea of tying G tolerance into the XP system and kerbal classes, definitely adding that to the future features list!

Better representation of G effects is going to be in the next alpha which may be ready for release later on today, this will also include the reduced tolerance to negative G's as you've suggested.

As a side note, I've not had a lot of luck triggering negative G's in KSP, my thoughts were that the lower half of an inside loop or rolling to a sideways orientation and pushing the stick forward (drop the nose) should produce them. Anyone have any advice for this?

Lower half of an inside loop - could you explain that one a little? Normally, all the G of a loop will be of the same 'sign' - either all positive G for a 'normal' loop, and all negative G for an outside loop.

Even upside down in a loop, you still have positive G - or its not a loop.

You dont need to roll sideways to get negative G, either.

If the plane is straight and level, you are experiencing 1G flight. Your radial G is 0G - you basically experience your planes radial G (its turning performance) plus gravity. If you are flying straight and wings level inverted, then you are experiencing -1G flight.

If you roll to set wings perpendicular to the horizon (90 degrees bank angle), correct your descent with rudder to maintain altitude, and bunt (push) the nose down to maintain a constant heading (i.e. fly straight), then you are experiencing 0G flight, with 0GR - BUT you are still experiencing gravity, just it is sideways G - like when you go around a corner in a car.

Good luck with the mod, seems like a good idea to have in KSP!

EDIT: Quote is from the thread linked:

So if you have 5g acceleration at a 45 degree angle forward and down, is that +5 or -5?

Better to just leave it as a scalar and make the gauge larger. Same with the throttle, remove the >100% area and give us more room on the gauge. Also, split it into 4 sections so KurtJMac stops saying he's at 50% throttle when he's actually at 33% or 66% k_cheesy.gif

Its neither XD

5G of acceleration for the craft, but radial G and cockpit G are the two types of interest - and while craft G is quite useful for the engineer, for the people wanting to worry about the effects of G on their kerbonauts, they (we) need cockpit G. Overall, its 5G in the direction forwards and down - and eyes in/eyes out G is not the primary concern, typically. Although, for a spacecraft, typical design is to set eyes IN G force as the rule. Anyway, 5G fowards and down is about 3 and a half negative G.

Of course, that all just assumes that forwards and down are relative to the pilots seating position... which I dont think is something you can assume, unless the parts describe the IVA seating position?

Edited by blu3wolf
Link to comment
Share on other sites

Another problem would be the seat inclination of each cockpit being different. For the plane cockpits, the seat is much as you would expect, with positive and negative G being in the normal axis. However, for most of the rocket cockpits, positive and negative G are in the longitudinal axis - eyes in and eyes out G, instead.

Not quite true. If you're looking at the cockpits when the rocket is flying horizontally - i.e. in the same position as the spaceplane cockpits - the Kerbals are seated upright. It's just that since rockets fly vertically the cockpits are usually tilted back at 90º from the horizon, so the Kerbals are too.

There are two exceptions to this: the two lander cans. In them, the Kerbals sit upright while the rocket is vertical, and face the ground if the lander can is put on the front of a spaceplane. But I wouldn't consider them as "most of the rocket cockpits", given that in most designs the capsules undergo the highest G's, not the lander cans.

Link to comment
Share on other sites

Hmm, how trained are Kerbals? RL fighter pilots train to 9G also, but with vision unimpaired as the goal.

You can't really implement GLOC properly. You can do parts of it well, but part of having low oxygen at the brain is the brain stops working properly - so you can think you are on top of the G, and then the next thing you know, your instructor is pulling the plane out of the dive as you come to. The parts you can do well (IMO) are tunnel vision, vision starting to gray out as G is sustained, vision redding out as negative G occurs - and that will be quick, there really isnt much you can do to improve tolerance of negative G effects.

There are definitely going to be limitations, simulating the full blackouts will literally have to be a blank screen, perhaps I could even restrict control input in such situations or make it random.

Another problem would be the seat inclination of each cockpit being different. For the plane cockpits, the seat is much as you would expect, with positive and negative G being in the normal axis. However, for most of the rocket cockpits, positive and negative G are in the longitudinal axis - eyes in and eyes out G, instead. Very different effects of that G, too. You wont get blood rushing to your eyes from eyes out G, but you will from negative G.

This is something I've been thinking about a fair amount, I figure there will need to be some trade-offs and assumptions which won't cover all situations. A fairly safe bet would be to assume the kerbal(s) are facing the direction of 'forward' according to the ship model. Past that, I could provide settings for a partmodule that would allow a modeler to set the facing direction.

Id suggest tying your max G limit at which the screen blacks out, to a G endurance system. Realistically speaking, people can tolerate very high G for short periods, say a half second, quite well. Sustained G, is another thing entirely. G tolerance - ability to tolerate short spikes of G force. G endurance - ability to endure through periods of sustained high G force.

Trained pilots/astronauts/cosmonauts/kerbonauts, possibly wearing Combat EDGE or something similar, can sustain 9G for an extended duration, say 5 minutes... although this would require peak physical condition, and is physically very demanding.

I was thinking of linking the endurance to the new XP system of the kerbals, more experience = better G training, probably with the top pilots being able to manage 9G for a certain length of time in line to a real highly trained human pilot.

Lower half of an inside loop - could you explain that one a little? Normally, all the G of a loop will be of the same 'sign' - either all positive G for a 'normal' loop, and all negative G for an outside loop.

Yup, you're right, I was thinking too much on this one. I'm assuming though that an outside loop where the pilot is essentially pushing the stick forward to perform the loop would result in negative G.

Even upside down in a loop, you still have positive G - or its not a loop.

You dont need to roll sideways to get negative G, either.

If the plane is straight and level, you are experiencing 1G flight. Your radial G is 0G - you basically experience your planes radial G (its turning performance) plus gravity. If you are flying straight and wings level inverted, then you are experiencing -1G flight.

If you roll to set wings perpendicular to the horizon (90 degrees bank angle), correct your descent with rudder to maintain altitude, and bunt (push) the nose down to maintain a constant heading (i.e. fly straight), then you are experiencing 0G flight, with 0GR - BUT you are still experiencing gravity, just it is sideways G - like when you go around a corner in a car.

Good luck with the mod, seems like a good idea to have in KSP!

EDIT: Quote is from the thread linked:

Its neither XD

5G of acceleration for the craft, but radial G and cockpit G are the two types of interest - and while craft G is quite useful for the engineer, for the people wanting to worry about the effects of G on their kerbonauts, they (we) need cockpit G. Overall, its 5G in the direction forwards and down - and eyes in/eyes out G is not the primary concern, typically. Although, for a spacecraft, typical design is to set eyes IN G force as the rule. Anyway, 5G fowards and down is about 3 and a half negative G.

Of course, that all just assumes that forwards and down are relative to the pilots seating position... which I dont think is something you can assume, unless the parts describe the IVA seating position?

I've been looking through the KSP API to see where I can obtain vector information that would allow me to know the type of G being experienced, i.e. positive or negative, but haven't had any time the past week or so to try anything out yet.

Thanks for all the input, it's definitely useful!

Edited by russnash37
Speeeling miztakes
Link to comment
Share on other sites

Time to work on this has been a little sparse the last few weeks, but I should have a batch of free time over next week to put some development in on G-Force. My main focus is going to be differentiating between positive and negative G's.

After digging around the KSP API:


public void Update()
{
// Retrieve the orbited celestial body.
mainBody = FlightGlobals.ActiveVessel.mainBody;

// Retrieve the position of the main orbited bodies COM in world coords.
mainBodyCOM = mainBody.position;

// Retrieve the current G forces.
currentG = FlightGlobals.ActiveVessel.geeForce;

// If we're experiencing 4G's plus, grow the cumulativeG with relation to the current G and ensure
// we don't wrap to a negative value.
if (currentG >= 4)
{
factor = currentG * currentG;
if (32767 - cumulativeG <= factor)
{
cumulativeG = 32767;
}
else
{
cumulativeG += factor;
}
}
// If we're experiencing between 0 and 4G's, reduce the cumulativeG with relation to the current G
// and ensure we don't drop below 0.
else
{
factor = 10 - currentG;
cumulativeG -= factor * factor;
if (cumulativeG < 0)
{
cumulativeG = 0;
}
}
}

...by retrieving the world coordinates of the COM of the currently orbited body I can then compare that Vector3d to the position of the COM of the vessel and the direction of acceleration with regard to an assumption that the kerbal(s) are facing the 'forward' direction of the vessel. This should allow me to determine positive or negative G's, I just need to get my head around vector math as it's something I haven't done in a LONG time! :blush:

Once I've achieved the +/- G distinction, next task will be to change the G effects from a basic alpha'd overlay to something that 'creeps in' from the edges of the display while slightly degrading the center of the view. Hopefully, this will be a little more realistic.

I also want to add a GUI for toggling the effects and to also provide a graphical representation of the G's and the current 'state of tolerance'.

Comments more than welcome, as always!

Link to comment
Share on other sites

Time to work on this has been a little sparse the last few weeks, but I should have a batch of free time over next week to put some development in on G-Force. My main focus is going to be differentiating between positive and negative G's.

After digging around the KSP API:


public void Update()
{
// Retrieve the orbited celestial body.
mainBody = FlightGlobals.ActiveVessel.mainBody;

// Retrieve the position of the main orbited bodies COM in world coords.
mainBodyCOM = mainBody.position;

// Retrieve the current G forces.
currentG = FlightGlobals.ActiveVessel.geeForce;

// If we're experiencing 4G's plus, grow the cumulativeG with relation to the current G and ensure
// we don't wrap to a negative value.
if (currentG >= 4)
{
factor = currentG * currentG;
if (32767 - cumulativeG <= factor)
{
cumulativeG = 32767;
}
else
{
cumulativeG += factor;
}
}
// If we're experiencing between 0 and 4G's, reduce the cumulativeG with relation to the current G
// and ensure we don't drop below 0.
else
{
factor = 10 - currentG;
cumulativeG -= factor * factor;
if (cumulativeG < 0)
{
cumulativeG = 0;
}
}
}

...by retrieving the world coordinates of the COM of the currently orbited body I can then compare that Vector3d to the position of the COM of the vessel and the direction of acceleration with regard to an assumption that the kerbal(s) are facing the 'forward' direction of the vessel. This should allow me to determine positive or negative G's, I just need to get my head around vector math as it's something I haven't done in a LONG time! :blush:

Once I've achieved the +/- G distinction, next task will be to change the G effects from a basic alpha'd overlay to something that 'creeps in' from the edges of the display while slightly degrading the center of the view. Hopefully, this will be a little more realistic.

I also want to add a GUI for toggling the effects and to also provide a graphical representation of the G's and the current 'state of tolerance'.

Comments more than welcome, as always!

You can get the acceleration vector from Vessel.acceleration, then use your cockpit's part transform to convert that vector into the cockpit's local coordinate system.

Finally process the result vector.

Link to comment
Share on other sites

Finally got some time to work on this, now that I have a weeks break from my studies. The 0.0.4 alpha release is available on GitHub (see the first post for a download link). In this release I've implemented the ability to distinguish between positive and negative G's and change the effects (and how hard they hit!) accordingly.

One downside that I have still to determine how to fix is that the positive / negative G's do not take into account the roll of the vessel, in other words it always assumes you are the correct way up!

Feedback welcome as always!

Link to comment
Share on other sites

  • 3 months later...
  • 4 years later...

  Greetings.

I have askied for @russnash37's permission to update / continue / adopt / release this wonderful mod.

@russnash37 has graciously agreed.

I intend to respectfully proceed with adoption as soon as the middle of April 2020, as permitted by the individual licenses of this mod.

I will provide recognition of original authors/maintainers; and I will gladly step aside should you ever want to continue this mod yourself.

Thank you kindly in advance!

G-Force!: Originally ARR - author has (privately) changed it to: license-WTFPL-red?style=plasticwtfpl-badge-4

Github-Indexed-blue.svg?style=plastic

https://github.com/russnash/G-Force

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