Space Engineers

Space Engineers

View Stats:
Modify planets gravity field range
I just want to know if someone knows how to modify a planet, say such as the earthlike planet to have a longer range with its gravity field. I basically want near 1 g at higher altitudes
< >
Showing 1-12 of 12 comments
Well, I guess I can modify the .sbs file for the world and turn the gravity fall off of to zero... that works, but does that make the gravity field larger nor just make it 1g everywhere?
Ancient Feb 6, 2016 @ 5:45pm 
To my knowledge, the gravity well size is hardcoded and is a percentage based off the planet diameter. Planets bigger than 120km (default for earth-likes), will have relatively larger gravity wells depending on just how much bigger you've made them. But then, you get a planet that could cost a lot in terms of performance (unless you make the hollow core a lot bigger to cut down on voxel count) so it's going to be a trade-off.
Last edited by Ancient; Feb 6, 2016 @ 5:46pm
Ancient Feb 6, 2016 @ 5:47pm 
Originally posted by Punk:
Well, I guess I can modify the .sbs file for the world and turn the gravity fall off of to zero... that works, but does that make the gravity field larger nor just make it 1g everywhere?

I've never played with that tag in inside a save so I'm not sure what it does.
yah so if I set the gravity falloff to 0 it makes it so that its 1g forever..... that makes it easy to maintain an orbit about the planet, but I do want it to cut out at a certain distance. If I adjust to say 3 or 4, it makes the distance to about where I want it, but the problem is that thats too high for stable orbits, meaning that the change in gravity is happening faster than it can adjust my ships ships acceleration to the earth so I end up just esacping all the time. I need a modifying value that allows me to cut the gravity off at a certain point. as in have 1g up to a point and then it just shuts off. I mean, near the surface it is always 1g so im looking for a value that changes where the fall of starts occuring.
Last edited by EldenRingMaster523; Feb 6, 2016 @ 7:23pm
plaYer2k Feb 7, 2016 @ 9:38am 
The gravity formula is quite simple:
g(height) = surfaceGravity * ( height / maxHillRadius ) ^ -gravityFalloff

The surfaceGravity for earth is 1.
The maxHillRadius generally is the radius picked when creating a planet with a slight change. For earth that is radius * 1.12 iirc.
The gravityFalloff is 7 by default but for a good and realistic feeling you should use 2. This is in accordance to the inverse squred law https://en.wikipedia.org/wiki/Inverse-square_law which is also present in the gravities formula G(mass1 * mass2) / distance².

You could also take a look at http://forum.keenswh.com/threads/a-guide-to-escape-a-planet-and-are-orbits-possible.7371754/page-2 where i uploaded a graphic for the gravity graph.
Thanks for the info! That is what detailed info I am looking for. The sad thing is it doesn't look like I can shrink the gravity field and still have the falloff of 2 meaning have a smaller bubble so that the mooon isn't interacted by the earths gravity field, makes weird orientations while walking on the moon... so I have to create the moon at near 1000000m away, which is pretty far, I wish I could modify the field so that I have a nice .5-1 g gravity at a decent height above the planet, but then at asy 200000 meters from the center of the planet the gravity cuts off. Then I could still have the short itme it takes to get to jump drive ability, and have more realistic orbit mechanics.
plaYer2k Feb 7, 2016 @ 4:18pm 
Yeah indeed. More control over the gravity would be nice but then again less compareable.
I also forgot to mention that natural gravity cuts off at 0.05g.

Thus you can solve the distance at which gravity cuts off by rearanging the formula to heigt (distance from planets center):
height = maxHillRadius*(surfaceGravity/0.05)^(1/gravityFalloff)
with some example parameters for earth that would be
height_earth120km ~= 60km*(1/0.05)^(1/7) ~= 92 048 m
Mind you, the ~60km is because i am not 100% sure about the radius. It should be (diameter/2)*(1 + hillparam Max) and thus precisely 60*1.12 which subsequently means a height of 103 093 m when using the values <HillParams Min = "-0.01" Max ="0.12"/> from the PlanetGeneratorDefinitions.sbc. But as i never tested that myself, i cant guarantee it. Though as approximation that seems rather right.

If anyone however finds a flaw, please point it out so i can correct it aswell as not spread any wrong informations :-)

Anyhow, using the above function and set the height to 200 000 m, 120 km diameter settings, keeping 1g and assuming the (diameter/2)*1.12 for earthlike is correct we get:
200 000 m = 1.12 * 60 000 m * (1/0.05)^gravityFalloff
and thus to solve it for the gravityFalloff you get ~2.7.
See I have only been modifying the sandbox_0_0.sbs file to get the results I have been getting what file are you modyfying on your end to modify that equation? Also when I modify max height and min height of already created planet, it doesn't seem to do anything when I reload the world and fly straight up, seems to cutoff at the same distance.
Last edited by EldenRingMaster523; Feb 7, 2016 @ 6:54pm
plaYer2k Feb 7, 2016 @ 8:27pm 
You shouldnt change the min and max height as that changes the hill height.

The planets surface works as follows (roughly):
- the hillparameters min and max define the offset off the ideal diameter (19 km to 120 km)
- the heightmap defines the height of the planet at a certain position within an integer range (iirc from 0 to 255)
- each height definition from the height map gets directly mapped to the according position defined by the hillparameters min and max (thus 0 > min, 255 > max)

Or to give it a different approach. You could say that the hillparameters define two radii/diameter: minValue and maxValue.
Now you could cast two spheres minSphere and maxSphere with each minValue and maxValue.
Anything that is within the minSphere is a solid planet sphere. Everything within is solid and there is no free room, no cave, no river etc.
In addition everything that is outside the maxSphere is empty with no voxels at all (related to that one planet ofc as other planets, moons, etc are not affected).
Thus all the surface variation happens inbetween the minSphere and maxSphere.


Also planets got a "preset" of variables for their creation which is defined in the ...\SpaceEngineers\Content\Data\PlanetGeneratorDefinitions.sbc and only loaded once the planet gets instanciated. However as soon as a planet has been created in a world these settings are stored within the world and thus within the savegame.
However i heard from bugs where changes to the savegame have been reverted and the settings from the PlanetGeneratorDefinitions have been taken again.

That means that you should make sure to change the PlanetGeneratorDefinitions.sbc and load a new empty world in creative mode to spawn a new planet with Shift+F10 -> Planets. That should prevent running into bugs with inconsistent behavior.
You could also create a new planet definition for that so that you got the clean default planet.

What however is very important is that you keep a backup of your files when you change them. I generally pack the file to a rar with according name. That makes swapping them in and out easier.
Instead of altering the file itself you could also make a local mod. Though i wont go much into detail here unless you really want to.

In order to get the GravityFalloff into your PlanetGeneratorDefinitions you simply have to add the attribute <GravityFalloff> float </GravityFalloff> or <GravityFalloffPower> float </GravityFalloffPower> into your definitions right inside the <PlanetGeneratorDefinitions> tree.
I dont know which of the two is the correct one, with or without the Power, but when you use both it should work :-)

I hope that helps.
Thats quite a bit of info, thanks for letting me know I will have to look into the PlanetGeneratorDefinitions for fun. I hope that doesn't affect multiplayer aspects though becuase I run a family server with my bros and wouldn't want it to screw that up. More control over the enviornment is the goal so thanks for all your info!

It looks like though that to get 1g (I know unrealistic) above the max hill height, is impossible, that that height will always have a mountain at the same distance. It seems like I can keep a stable orbit at a falloff of 2 fairly easy though so I might just stick with that for now. It just seems as far as the engines capabilities that if I could keep it at 1 g farther out than when the falloff starts, it would be easier and more stable to orbit ... Though unrealistic because there is alawys some sort of falloff.
Last edited by EldenRingMaster523; Feb 8, 2016 @ 4:14pm
plaYer2k Feb 8, 2016 @ 5:15pm 
In that case you should certainly use a local mod then.
Mad_Hat Oct 7, 2024 @ 10:31am 
Just in case anyone wants to figure out the exact height to reach any X gravity value you can use this. I algebra'd plaYer2k's formula so I could figure out precisely what altitude gravity would reach 0.05 and stop affecting grids.

Target Height = MaximumHillRadius * ( SurfaceGravity / TargetGravity ) ^ ( 1 / GravityFalloff )

Eg Earth:
67200 * ( 1.0 / 0.05 ) ^ ( 1 / 7 ) = 103,093m

Subtract the base radius of earth of 60km and default gravity stops at 43093m above sea level.

If you're using the Real Orbits mod that changes the falloff to 2, the distance is 300,528m, 240,528m above sea level.
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Feb 6, 2016 @ 4:45pm
Posts: 12