Page 1 of 1

Request: Clarify the formulas on Page Locomotive

Posted: Fri Jan 17, 2020 2:50 pm
by scooter010
https://wiki.factorio.com/Locomotive wrote:train_speed = max(0, abs(train_speed) - train_friction_force ÷ train_weight)
train_speed = train_speed + (10 × number_of_locomotives_in_moving_direction × fuel_acceleration_bonus ÷ train_weight)
train_speed = train_speed × (1 - air_resistance_of_front_rolling_stock ÷ (train_weight ÷ 1000))
From the mathematical point of view, the formulas doesn't make sense. The same variable on both sides make no sense.

I'm pretty sure, that these formulas will be run on every tick to set the new value for train speed for each train, but thats not clear out of the wiki page.
The value for "air_resistance_of_rolling_stock" and "train_friction_force" aren't explained anywhere. E.g. does the summed up friction also uncludes additional friction for bends?

Re: Request: Clarify the formulas on Page Locomotive

Posted: Fri Jan 17, 2020 3:26 pm
by Bilka
scooter010 wrote:
Fri Jan 17, 2020 2:50 pm
From the mathematical point of view, the formulas doesn't make sense. The same variable on both sides make no sense.
It makes sense from a programming view:
https://en.wikipedia.org/wiki/Augmented_assignment wrote:x = x + 1

This means "find the number stored in the variable x, add 1 to it, and store the result of the addition in the variable x."
train_friction_force is explained on the page. I added a note on where to find air resistance and noted how the game does the calculations.