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.

2b) any cargo inside the carts prior to the collision will be factored into the momentum/speed calculation. Any shooting of the cargo effectively takes place after the collision.

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[edit]

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. A short closed track loop filled with identical-weight carts can "reflect" a cart bumping into the circle from the side, at a characteristic speed reflecting the weight differences between carts involved.

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 at least 31%(+-1%) of the pushing cart's

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. And carts propelled to such speeds still properly calculate momentum and propagate it, so it's possible to "stack" such collisions even further.

Exploring the possibilities of acceleration through collisions, i soon arrived at this: http://www.bay12forums.com/smf/index.php?topic=137557.msg5145499#msg5145499

With three tiers of collisions, i managed to accelerate an adamantine cart to a speed of over 17 tiles per step, over six times the 2,7 tiles per step commonly cited as limit. Alas, such speeds can only occur in short bursts - carts moving that fast are subject to extreme friction, slowing them down about 1/10 tile per step, every step while travelling along a flat minecart track; for reference, that's 1000 times the friction a saner-speed cart will encounter on track.

Build order and minecart collisions[edit]

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.

If both carts are propelled by medium-speed rollers, derails should be very rare. To be absolutely sure, you'd need to combine medium-speed rollers with track stops (three medium friction should suffice) or go right to low-speed rollers. Speed-reducing collisions will become even more sluggish if you do this.