v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

User:Larix/Minecart Collisions

From Dwarf Fortress Wiki
Jump to navigation Jump to search

I explored the physics of minecart collisions a bit. These are my findings:

1. if a cart attempts to move into a tile currently occupied by another cart, it transfers its entire movement pulse to that cart and comes to a stop.

  • If it was moving faster than derail speed, it will also let go of its cargo.
  • The pushed cart, if it is accelerated to above-derail speed from a standstill, will also spill its cargo.
  • A cart accelerated to less than derail speed will keep its load, even if it was hit by a derail-speed cart.

2. the speed at which the pushed cart will move is incoming speed * incoming cart's weight/pushed cart's weight.

  • Normally that speed is capped to be no higher than incoming speed. Apart from the cap, that's plain old conservation of momentum, i think.

2a) any potential speed of the pushed cart in the same direction is lost without a trace: a brass cart going east at maximum roller speed (50k) was chased by a high-speed (~120k) wooden cart, also going east. When the wooden cart caught up with the metal cart and pushed it, the wooden cart stopped and the brass cart slowed down to about 7k.

3. this speed transfer/speed erasure only applies to movement axes in which the incoming cart is actually moving at nonzero speed: if a cart moving S->N hits a cart going W->E, the eastward-heading cart will keep its eastward movement component and will gain an additional amount of northward speed, resulting in a north-east heading.

Addendum: when a cart going northeast pushes a cart going southeast, that cart will move off towards the northeast. Vectors are not combined, momentum just gets moved from the former to the new holder.

4. if two carts attempt to move into the same tile on the same turn, build order of the carts decides which one enters the tile first. See below.

The collision speed cap, applications and exceptions

The speed cap allows regulating speed/momentum: if the incoming cart pushes an aluminium cart, which then pushes a silver cart, which pushes the actual outgoing cart, momentum will be automatically cut to ~1/4, before taking incoming/outgoing cart weights into account.

If two carts collide head-on, there can be an exception to the speed cap:

a) if the pushed cart weighs at least half as much as the pushing cart and
b) if the pushed cart's momentum is a certain proportion of the pushing cart's (cut-off not yet know, it's above 32% and below 45%)

momentum will be fully conserved, potentially resulting in an increase in speed.

This has two interesting consequences:

  • Through collisions, it is possible to reach derail velocity when starting with roller-driven minecarts. I've tested and proven this thoroughly. In fact, i relied on this to determine if a collision had resulted in a speed increase or not.
  • When working with extremely high-speed carts, you can exceed the normal speed limit. Preliminary tests resulted in an output speed of well in excess of 400.000, while the acknowledged limit is 270.000. More rigorous work will be needed to examine what speeds exactly are achievable. The actual velocity reached may be close to 500.000 (that's five tiles per step); and i haven't tried tiered collisions yet.

Build order and minecart collisions

Tests showed that the older minecarts take their moves first during each step. Thus, if two minecarts take a collision-inducing move on the same step, which cart will move on and which will stop follows build order.

Two simple collision designs to sort minecarts by age:


I 1 I 2 I 1 I 2
r r r r
O 1 O 2 O 1 O 2
M o d e l A M o d e l B


I1, I2 - "Input", some construction allowing simultaneous cart release accelerating both carts to the same speed. A convenient example are highest-speed rollers, switched by the same gear assembly.

O1, O2 - "Output", the cart which gets pushed in the collision moves out of the circuit on this path. The cart coming from I1 will move off on O1 and vice versa.

r - "resting" places. The cart which pushes the other one and stops will end up standing still on one of these tiles (below the letter, on the stretch where the carts actually collide).

In Model A, both carts try to move into the empty tile in the centre on the same step. The older cart will move first, occupies the tile and then instantly gets pushed by the younger cart.

  • Result - the older cart leaves the circuit, the younger cart stops and remains.

In Model B, both carts try to move into each other's location. The older cart again moves first and pushes the younger cart, coming to a stop while the younger cart moves away.

  • Result - the younger cart leaves the circuit, the older cart stops and remains.

Caveat: due to momentum calculations, output speeds can vary wildly. A very light cart pushing an extremely heavy cart will only impart a very low output speed, which might be insufficient for proper operation. The speed cap exemption for head-on collisions (see above) can lead to above-derail output speeds, which can become a bit difficult to handle.