Space Engineers

Space Engineers

61 ratings
A complete guide on the mathematics of optimal gravity drive constructions
By Jerry
Have you ever looked at a gravity drive and wondered just how “optimal” the gravity drive is? In other words, is a gravity drive with 50 mass and 50 generators better than one with 10 mass and 90 generators? In this article, I will be discussing in depth the mathematics of optimal gravity drive setups, their construction, and a few tips for easy installation specifically using my JRGD script. Included in this guide are details on what exactly makes a perfect gravity drive, how they are determined, and how they can be constructed. Keep in mind that all of the math bellow is valid only for drives with equal numbers of generators on each axis. Also note that two generators with fields in opposite directions count as being on the same axis.

JRGD – Jerry Rigged Gravity Drives: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=890464232
   
Award
Favorite
Favorited
Unfavorite
Introduction
Have you ever looked at a gravity drive and wondered just how “optimal” the gravity drive is? In other words, is a gravity drive with 50 mass and 50 generators better than one with 10 mass and 90 generators? In this article, I will be discussing in depth the mathematics of optimal gravity drive setups, their construction, and a few tips for easy installation specifically using my JRGD script. Included in this guide are details on what exactly makes a perfect gravity drive, how they are determined, and how they can be constructed. Keep in mind that all of the math bellow is valid only for drives with equal numbers of generators on each axis. Also note that two generators with fields in opposite directions count as being on the same axis.

JRGD – Jerry Rigged Gravity Drives: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=890464232
The definitions
Though gravity drives could take on any shape and composition, there are always two main metrics that can measure their effectiveness- power efficiency and thruster output. It is important to determine the primary objective to suit your need before proceeding with the design and construction phase. As space limitations are the primary concern when building gravity driven ships, both of these metrics work as an optimization function of available space.
The thrust output metric
The more basic metric of the two, the thrust output metric measures the maximum thrust output of the gravity drive on a single axis over the theoretical maximum. In this metric all three axis of the gravity drive is assumed to be built for the same output, as described below.

n = m + 3g, where n is the blocks of space available, m is the number of artificial mass, and g is the number of gravity generators on one axis

For the sake of simplification, the unit for measuring force will be in units of 490500 N, which just so happens to be 50000kg*9.81m/s^2. Working with this new unit, we can conclude that the force output of the drive on one axis can be described as so.

F = mg, where F is the force output in units of 490500 N.

Now, with both descriptions in mind and a little bit of calculus, we can see that the local maxima of the F function will be F = (n^2)/12 at m = n/2, and consequently g = n/6. These equations give us the theoretical maximum force a gravity drive can exert given a limited amount of space and how to achieve it. For example, we can find the optimal composition of a gravity drive with 100 blocks of space available.

F = (n^2)/12
We now know that the maximum theoretical force is 100^2/12, which is 833 units of force.

m = n/2
We now know that the optimal amount of mass to add is 50.

g = n/6
We now know that the optimal number of generators to add on each axis is 16.7

Notice how we got a decimal point from our equations. Unfortunately, space engineers does not allow us to place half a mass block, so I usually round the number of generators, in this case, to the nearest integer, 17. The optimal composition of a 100 block gravity drive is 49 mass blocks and 17 generators on each axis. One more or one less and the efficiency of the drive drops.
The power efficiency metric
The second metric is the power efficiency metric. This metric measures how power efficient the drive is by taking the thrust output over the power usage. To find an optimal solution for this metric, we borrow a few equations from the force metric,

n = m + 3g, F = mg

and add a new one that describes the power usage.

P = 0.6m + 3*0.56713g, where P is the power usage in megawatts.
Thrust/Power = mg/(0.6m + 3*0.56713g)

Again, we are looking for the local maximum, though this time for the thrust/power function instead. With some more calculus, we find that the local maximum is at m = 0.4929578280953054n and therefore g = 0.16901405730156485n. For example, we can find the optimal power usage composition of a gravity drive with 100 blocks of space available.

m = 0.4929578280953054n
We now know that the optimal amount of mass to add is 49.3

g = 0.16901405730156485n
We now know that the optimal number of generators to add on each axis is 16.9

P = 0.8028168687618777n
We now know that the most power efficient configuration will use 80.3 MW.

Again, we round to get 17 generators and 49 mass blocks, which, as you may have noticed, is very close to the thrust metric. It is for this reason that I usually just stick with the thrust metric, since it is a lot easier to do the math for.
Alternative metrics
Alternative metrics may involve different factors. Here is a quick list of optimal solutions for things other than thrust and power.

Thrust per gravity generator component
m = (Sqrt[6]-2) n

Thrust per steel plate
m = (5-Sqrt[15]) n/2

Thrust per computer
m = (2-Sqrt[2]) n

Thrust per construction component
m = (2-Sqrt[2]) n

Thrust per kg of gold ore
m = 0.35978 n

Thrust per kg of cobolt ore
m = 0.44949 n

Thrust per kg of silver ore
m = 0.44949 n

Thrust per kg of silicon ore
m = 0.585882 n

Thrust per kg of iron ore
m = 0.49494 n

For example, if we want a drive with the maximum thrust per steel plate that is 100 blocks big, we need (5-Sqrt[15]) n/2 or 56.4 mass blocks. We know that g = (n-m)/3, so g is then 14.5. Rounding the numbers, we get that need 55 mass blocks and 15 generators for each axis for the best thrust per steel plate ratio.
The space utility score
All those rules are nice, but sometimes the design just doesn’t work out the way you want it to. You might run of space for generators, or have too little mass blocks. The space utility score helps you determine if you should just scrap this drive and redesign a new one. The space utility score is a measure of how close to perfection a given drive is. Since I usually use the thrust metric for convenience, I base my space utility scores on the thrust metric. The score is the current thrust output over the theoretical max, or

4mg/(m+g)^2, where m is the number of mass you have, and g is the number of generators you have on all three axis this time.

A perfect drive will have a score of 1 and a crappy one will have 0. For example, a drive with 20 mass blocks and 90 generators will have a score of 0.595. It is not a very good drive. Personally, I usually aim for a space utility score of 0.98 or above when designing a gravity drive, though it really is up to you. Just keep in mind that your drive will be less efficient both power and thrust wise if you get too low of a score. Also keep in mind that the score does not take into account of uneven distributions of generators between the three axis.
Tips and tricks
Construction tips
  • When building a gravity drive, your goal is to fit in exactly the numbers of mass and generator you calculated above. If you really cannot do so, calculate the space utility score and see if it’s acceptable. If not, just scrap and redesign.
  • It is a good idea to make a space for the gravity drive but design the drive outside of the ship. Group the blocks for the script while outside of the ship so you can just select everything and group them together. Only then copy and paste the drive onto the ship and the installation would be complete painlessly.
  • Gravity drive output scales exponentially with the number of blocks you add. Doubling the number of blocks will quadruple the force output. This means that 3 large drives will be better than 10 small drives that are all separate. Though always have more than three drives.
  • The JRGD script can calculate the space utility score for you. Run “refresh” to rescan the drive and then run “analysis”. It will print out a list of stats, including the utility scores for your drives.
  • Protect the JRGD programming block well. If the script gets destroyed, your ship would basically be crippled. It might be wise to have multiple JRGD programming blocks and timers on different parts of the ship and use a backup computer bank script to bring extra ones online when others are destroyed.

Gravity drive placement tips
  • As the JRGD script operates on solving for systems of equations, gravity drives can be placed anywhere on the ship regardless of the position of the center of mass. It is strongly recommended to have three or above and follow these tips to get the best experience.
  • Place them as far apart as possible.
  • Place them in triangular formations.
  • Place them out of reach of the ships own artificial gravity for the crew.
  • If you really need to use them inside of another gravity field, place a generator close to the drive and set it to cancel out the ships field.
  • Don’t bother with gyros. 10 to 15 traditional gyros are good enough for 30+ millions kg ships. The JRGD smart gravity drives can also act as gravity gyros, kinda like KSP RCS thrusters.
Premade examples
Here are some examples I have put together if you need them. The gravity drives are named for their size. 556 is a 5x5x6 drive.

356 GD: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=906547954
445 GD: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=906548068
555 GD: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=906548182

And that should be it. Have a fun time breaking the game :D
12 Comments
JeSper 18 May, 2024 @ 7:11am 
What's the optimal ratio of generator to masses in a single axis drive?
Thanks for making this guide, cheers.
JeSper 3 Jan, 2024 @ 12:48pm 
Typo in the top description "bellow" > "below".
d0sboots 25 Jun, 2020 @ 3:24pm 
Your power efficiency calculations are oversimplified. Gravity generators have an adjustable field shape (although it's always a cuboid), and the power consumption is proportional to the volume. This means that if a gravity generator is on-axis (or especially doubly on-axis) with the artificial masses, the field can be very small and it has minimal power draw.

The optimally power-efficient gravity drive has very few artificial mass blocks, with many gravity generators clustered close by, mostly on the same plane in a narrow-curved-diamond shape. However, this sacrifices the ability to provide high torque, and often requires planning other things around the design.
Thentox 7 Dec, 2019 @ 11:45pm 
Seems it's actually more grav gens to mass than the other way around
kohonac 4 Dec, 2018 @ 11:02pm 
@Jerry i made this https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1582774426 and fit 3 on a test ship along with your grav drive script. the script makes wasd awsome but its a bit unstable when slowing down. was wondering if that is normal or if it has something to do with my design
Maphias 1 Aug, 2017 @ 4:19pm 
figured it out i have two 356 gd on the side and it was fast but it had rotation so i put a mass with 6 gravitys in the front and it stablized it but made it slow down like a snell
Maphias 1 Aug, 2017 @ 3:06pm 
maybe I set it up wrong then because i have way more then that on it and it still moves like a slug
Jerry  [author] 1 Aug, 2017 @ 1:00pm 
@Maphias. Moving 5,700,000kg to 100m/s in 15 seconds is actually a bit too slow to justify grav drives tbh. To do that in ~7 seconds, You would need only three tiny 3x3x3 drives, each with 12 mass and 5 generators facing each of the three axis. Even using the small three 4x4x5 drives above, you can accelerate at ~138 m/s^2 and get to 100 m/s in ~726 milliseconds or 0.726 seconds. So... yea.
Maphias 31 Jul, 2017 @ 10:11pm 
@Jerry hey I have a ship that is 5,700,000kg if I did the math right it requires 37,996,200 N to move it 6.666m/s to get to 100m/s in 15 sec my brain is kinda fried after figureing this out and i would like some help on how big of a gravity drive I need to set up for this
AutoMcDonough 29 Jul, 2017 @ 7:00am 
Nice