What is the train's damage collision formula ?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
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 »

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: 295
Joined: Thu Apr 21, 2016 3:17 pm
Contact:

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

Post by SyncViews »

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: 965
Joined: Thu Jan 21, 2016 9:29 am
Contact:

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

Post by BlakeMW »

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 »

Thanks for your replies. It's much clearer now !!
User avatar
BrunoRyb
Manual Inserter
Manual Inserter
Posts: 4
Joined: Thu Apr 28, 2022 7:12 pm
Contact:

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

Post by BrunoRyb »

Thanks. This helped a lot when getting the golem achievement.(Brought a tank to 29 kmh if I remember the speed correctly and ran in front of it on concrete and let it ram me with 6 energy shields in my power armor)
Post Reply

Return to “Gameplay Help”