What is the train's damage collision formula ?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Gimlinus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Feb 26, 2019 2:24 pm
Contact:

What is the train's damage collision formula ?

Post by Gimlinus » Mon Mar 25, 2019 7:01 pm

Hello,

I was wondering if someone knows the exact formula of the damage delt by train on impact ? I'm trying to estimate how much locomotive I would need in the late game and having such formula would help 😊

From looking at forum / google and after doing some experiments, I understood that it depends on acceleration / speed / weight but that's about it...

thanks

SyncViews
Filter Inserter
Filter Inserter
Posts: 261
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

Re: What is the train's damage collision formula ?

Post by SyncViews » Wed Mar 27, 2019 3:03 pm

I think you will have to experiment.

You can find the "locomotive" data in Factorio/data/base/prototypes/entity/entities.lua.

As well as "weight", speed, etc. as mentioned, there is a "energy_per_hit_point = 5" that I am not sure on the purpose of. These are also present on the "tank" and "car", "cargo-wagon" and "fluid-wagon" objects.

The standard kinetic energy (KE) equation is 1/2 mv^2. So maybe, the damage is something like "KE / energy_per_hit_point" but I am honestly not sure.

EDIT: The prototypes wiki didn't say, but the Lua API ref does. https://lua-api.factorio.com/latest/Lua ... _hit_point
The energy used per hitpoint taken for this vehicle during collisions or nil.
So looks like my thinking is right, but you will need to see if I was about the energy equation.

BlakeMW
Filter Inserter
Filter Inserter
Posts: 951
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: What is the train's damage collision formula ?

Post by BlakeMW » Thu Mar 28, 2019 1:17 pm

Gimlinus wrote:
Mon Mar 25, 2019 7:01 pm
Hello,

I was wondering if someone knows the exact formula of the damage delt by train on impact ? I'm trying to estimate how much locomotive I would need in the late game and having such formula would help 😊
Empirically:

The damage formula for the Tank appears to be roughly: weight * v^2 / 23000 (where weight is 20000 and v is the speed in km/h)

The damage formula for Trains appears to be roughly: weight * v / 1075 (where weight is the total weight of the train)

For some reason Train damage seems to be based on momentum, wheras Tank damage is based on kinetic energy - I guess trains were much too wimpy at low speeds and much too murderous at high speeds for the quadratic scaling to work. Another difference is that Tanks lose velocity and hitpoints when they destroy a target. A train does not: if it deals enough damage to kill, the train murders the target losing no hitpoints nor velocity, that could be a bug or again it could be the devs decided it was unfun for trains to own themselves running into biters so they disabled taking damage and losing velocity.


Anyway. The important thing: A train needs a weight of 11000 to kill a Behemoth Biter when travelling at top speed, Locos have 2000 weight, Wagons have 1000 weight and Artillery have 4000 weight. Due to the murder train property a train of this weight will destroy any number of Behemoth Biters which gets in its way (though the biters can still bite the loco as it passes by). You'll tend to need 2 Locos using Rocket or Nuclear fuel to get an adequate top speed. The train needs to be heavier if using inferior fuels.

Gimlinus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Feb 26, 2019 2:24 pm
Contact:

Re: What is the train's damage collision formula ?

Post by Gimlinus » Thu Mar 28, 2019 8:10 pm

Thanks for your replies. It's much clearer now !!

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: Guilwin