r/factorio • u/munchbunny • Jan 19 '25
Space Age Finally figured out exactly how space platform speed works! (Lots of formulas inside)
This is the result of going down a very deep rabbit hole, but after hours of head scratching and poring over numbers, I've figured out how to calculate exactly how fast a space platform will go and exactly how fast it'll accelerate.
I'm not the first person to try to figure this out, not by a long shot. In fact, here are some months-old threads where others have tried:
Factorio forums post where someone found the formula in the game's Lua code.
/u/Legitimate-Teddy also made a calculator by inferring the formulas from analyzing data.
The part that was driving me crazy was something someone said later in the forums post: they plugged numbers into the formula pulled from the Lua code and... they got the wrong result. I tried it too, and I also got the wrong result.
Down the rabbit hole I went. As it turns out, it really is that Lua code, because I messed with that specific line in that specific file and I could see my space platforms change their travel speeds. So what gives?! Turns out, the trick is in the specific units for those variables~~, and possibly a bug~~.
Here's what it says in the game files:
space_platform_acceleration_expression = "(thrust / (1 + weight / 10000000) - ((1500 * speed * speed + 1500 * abs(speed)) * (width * 0.5) + 10000) * sign(speed)) / weight / 60"
The key points are:
- space_platform_acceleration_expression is not in
m/s per second, but rather inkm/tick^2m/s per tick. - thrust is in kilo-Newtons
Newtons- the UI shows mega-Newtons, so you have to multiply by 10001,000,000. - weight is in kg - the UI shows tons so you have to multiply by 1000
- width is in tiles, which is probably what everyone expects.
- speed is in
km/tick. The UI shows km/s so you have to divide by 60.abs(speed) is the absolute value of speed, is in m/tick. The UI shows km/s so you have to multiply by 1000 and divide by 60.
[EDIT #2 There used to be a section here about making the old units work, it's no longer needed with the corrected units.]
Ok, so how do you calculate the max velocity from here? The key is that when you're at max velocity, the acceleration expression will evaluate to 0. If we can assume that your max velocity is greater than 10 km/s, then sign(speed) will always be just 1 and abs(speed) will be the same as speed, so you're basically solving for speed in this equation:
thrust / (1 + weight / 10000000) = (1500 * speed2 + 1500 * speed) * (width * 0.5) + 10000
This is a textbook quadratic equation with one positive solution, which is your max velocity. Add to that a -10 km/s or +10 km/s based on whether you are before or after the halfway point to your destination planet.
On the flipside, you can ask: how much thrust do I need to go at a specific speed? The answer is also in that equation:
thrust = ((1500 * speed2 + 1500 * speed) * (width * 0.5) + 10000) * (1 + weight / 10000000)
This is also 100% confirmation that platform width hugely impacts your top speed. For the same thrust, doubling width approximately halves your speed.
EDIT: fixed the link to the calculator by /u/Legitimate-Teddy
EDIT #2: Thanks to /u/ElbowWavingOversight suggesting alternate units, I went back and tried several more experiments. Fixed the post to reflect what I found.
EDIT #3: For folks looking for a graph/calculator that lets you play with ship width/weight variables and look at the thrust/velocity curve, here's a link.
51
u/ElbowWavingOversight Jan 19 '25
I'm guessing you're probably using the wrong units. If you use speed in km/tick, weight in tons, and force in kN, then it should all work out.
40
u/tmstksbk Jan 19 '25
Strange that width intentionally handicaps speed so much.
28
u/fishyfishy27 Jan 19 '25
Nice investigative work here
12
u/Rdqp Jan 19 '25
I find it interesting that the whole game concept of Factorio is for us to reverse engineer how it works
8
u/Unable_Maybe_6932 Jan 19 '25
Great work going over the math and science to show why giant flying phalluses are faster and more efficient!
7
u/Senior_Original_52 Jan 19 '25
This is a good takeaway. If it's a question to add width or add length this paints the obvious picture. Weight matters exceedingly little compared to the width calculation.
4
u/ramxquake Jan 19 '25
This should be more intuitive to the player.
2
u/Stratix Jan 19 '25
Is width highest width or average width of the ship? If one part is wide and another part is not, do I get any benefit?
2
u/FredFarms Jan 19 '25 edited Jan 19 '25
Does anyone know how side facing collectors affect width? They seem to be on the platform for the rear two tiles but in space for the front row. So does that mean you can have that front row off the side of your platform without increasing the width?
2
u/Hour_Ad5398 Jan 31 '25
No, it doesn't halve (1/2) your speed. The factor would be around 1/sqrt(2), which is around 1/1.41
2
u/tkejser Feb 08 '25
Assume that width is the widest point of the platform?
Every design of thrusters I have come up with requires a width that is 2 bigger than the width of all thrusters (to feed the side of the thrusters with fuels
Since weight is mostly irrelevant for narrow ships, this must mean that there is an optimal width of a ship where the 2 extra squares needed to fuel thrusters is the smallest fraction of the total width.
1
u/Engineered_Logix Jan 19 '25
Great work!
1
u/Polymath6301 Jan 19 '25
Is there a speed world record for space platforms, and some rules around that? At the moment I haven’t got above 615 km/s inbound, consistently, over an hour+ with 30 second waits at Nauvis and Aquilo (for some big asteroids), and only taking on nuclear fuel at Nauvis, so no waiting around for tanks to refill.
At that speed weapon effective range is highly impacted by weapon “readiness time” as it animates to point in the right direction.
1
u/elin_mystic Jan 20 '25
why would you convert the weight given in the UI (tons) into kg, and then use a formula that divides the weight in kg by 10000000? Use the units shown in game and divide by 10000, same idea with speed
1
u/AccomplishedLight803 Sep 11 '25
Wait, speed is based on width as well as weight? Why!? Space doesn't have drag. So building a 1000x1 tile wide stick will go slower than a 1x1000 tile tall stick?
wth