Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5]

Author Topic: SCIENCE: Quantifying minecart physics  (Read 38988 times)

zuglar

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #60 on: August 16, 2012, 11:40:49 pm »

Non-track tiles seem to have a uniform friction of 0.05 m/s/s.

I think this is wrong. I'm trying to verify with the following setups, where the top is purely rough stone and the bottom two are stretches of rough followed by track:
■....................
■..........==========
■.........========================================

Pushing each cart, the top one travels 11 tiles, the middle travels 18, and the bottom 37.

Assuming vIn=0.2, that the push skips the first half tile, and that position is updated before velocity***, that's a friction of roughly 0.002m/s/s, but not exactly: it predicts travel of 10.4/18/31; using friction of 0.00185m/s/s instead predicts 11.2/14.9/31. Again that numerical instability shows up, which makes me suspect the computation is based on ticks/tile rather than tiles/tick. I'll try to work out numbers that way and report back.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #61 on: August 17, 2012, 09:31:54 am »

Creatures can move "partial" tiles, in that if they don't have a speed of an integer number of ticks per tile, it'll average out correctly. Could that explain the numerical instability?
Logged

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #62 on: August 17, 2012, 01:14:42 pm »

And, speaking of loss of energy, how much does a minecart lose when derailing or going off end of track?I've noticed that the following loop can skip over the gap outbound, but not on the return trip, when pushed east from the track stop:

   ▼╔═╗
≡══·╝╞╝

Corners drain speed. Try pushing a cart along a track vs. along a track with channels vs. along a track that derails at every tile (you might want to construct that last one...).
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

expwnent

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #63 on: August 17, 2012, 03:27:53 pm »

I've discovered something strange. I use a linear accelerator as described, with 20 NE ramps to accelerate a pushed minecart. After the 20 NE ramps, there's an EW ramp to launch the cart. One tile above it and to the east, there's another EW ramp, but the higher ramp does NOT have a wall to the right of it, so it's unusable.

Minecart is pushed from the far west:

Side view:
Code: [Select]
       R
...AAARW

A = accelerator = NE

The effect: the minecart stops in midair after launching off the second ramp. With a wall placed after the second ramp, the minecart launches as you would expect. With the wall after the first ramp removed, it just ignores the first ramp.

This is still quite unsafe for dwarves riding in the cart. They tend to take damage in midair just before the cart falls, probably due to the rapid acceleration.

Strangely enough, you can get splatterings of blood in midair in this way. I'm sure this can be weaponized somehow. If you can launch a creature with poisonous blood in this way, you can use it as defense against flying creatures maybe.

edit: It will also launch its contents, if any.
« Last Edit: August 17, 2012, 04:17:35 pm by expwnent »
Logged

zuglar

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #64 on: August 17, 2012, 05:18:23 pm »

Down ramps have an acceleration of 0.068 m/s/s. Since a fast moving cart will spend few ticks on the ramp, this means that it will accelerate less than a slow moving cart. As a point of reference, a cart started from rest on the 8th ramp up will reach the bottom travelling at 1.0 m/s, five time faster than a Dorven push.

Quote
While I haven't tried it, there is a maximum speed set by the fact that ramps don't add a constant increment of speed. If my numbers are correct, then even a 200 z-level straight ramp will only get the minecart moving at just over 5.2 m/s.

What's the fastest anyone's ever actually observed a cart going? If the model I'm working on is correct, the absolute upper speed limit approaches two tiles/tick. A 100-z down ramp would give enough velocity to make a cart skip a tile very few tiles traveled. Caveat: this does *not* incorporate the half-tile skippage that was recently pointed out, so occasional "glitch" tile skips are probably possible at lower speeds.

Another prediction of my model: a 2x2 all-corners downward spiral should be somewhat self-regulating, with v approaching 0.67m/s and taking about 80z for a cart to pass 0.6m/s.

Only problem: my model predicts that an 8z down-ramp should only accelerate a cart to 0.4m/s; I haven't tested this prediction explicitly, but it is fairly consistent with my observations of a spiral down-ramp (diameter 3) I had dropping 30z.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #65 on: August 18, 2012, 08:05:56 pm »

I can confirm electrobadger's main results. I used CheatEngine to look into the game. The minecart has a variable for speed. Speed is measured in tiles/100000 per tick, so a speed of one hundred thousand means one tile per tick. Since the game internals use these units, this is what I will use.

The maximum speed is 270,000. You can hit it exactly by going down enough ramps.

Every tick, your speed goes down by some constant based on what tile you are currently on.

Distances: if you push a cart, you start in the MIDDLE of the next tile, not the far end of it, so it takes half as much for you to get past it. Normally, once you've accumulated 100000 distance units, you move to the next tile. This DOES carry over to the next tile.

Tile: friction
Tracks: 10
ground/floor: 200
unusable ramp: 10
going up a ramp: 4910
going down a ramp: -4890

A dwarven push starts the minecart at 19990 in the middle of the next tile, in that the first nonzero speed that the cart has is 19990.

Corner tracks are 10, but on leaving the corner tile, you get penalized another 1000 (in addition to the friction of the next tile).

Track stops:
highest: 50000
high: 10000
medium: 500
low: 50
lowest: 10

Empty space is entirely frictionless.

You CAN phase through walls if both flying and moving faster than one tile per tick, but you stop immediately on the other side. Cue everyone's secret fortress entrances behind walls.

---
WATER

Take the water level (out of seven), then subtract one, then multiply by 100. Add this to the tile's normal friction to get the friction of the tile in that much water.

MAGMA

Take the magma level out of seven, then subtract one, the multiply by 500. Add this to the tile's normal friction to get the friction of the tile in that much magma.

If the cart at least 6/7 deep, and it has room, it will take 2/7 into itself.

I'm (finally) tired of this. I'll put it in a more digestible format on the wiki later.

edit: Different water/magma levels have different maximum speeds. Research for later.
« Last Edit: August 18, 2012, 08:19:57 pm by expwnent »
Logged

Snaake

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #66 on: August 24, 2012, 08:16:08 am »

So, if I'm reading all of this right, a short list of facts we now know based on your testing:
...
Upward ramps are wonky; they can decrease or increase the distance traveled by a cart.
...

Is this right?  I may have misread or misinterpreted some things.

The rest was correct: upward ramps do always decrease the distance traveled from what it would've gone on the lower z-level; however, if minecarts go down, then up a ramp, that's unpredictable. Probably because both vary around some identical(?) average (due to some integer rounding or something in the physics), so sometimes you get a net gain, sometimes a net loss. Looking back at the data (post #21), the most common result I got was an increase in kinetic energy.

Other than that, I'd like to thank at electrobadger for doing some independent testing; from a quick(ish) look, it seems that portions of both xmoffitt's and my research were validated. Looking at his results, I'm especially happy that the abovementioned mystery of ramps is solved (points 9-11, post #45): up ramps do take away more energy from a cart than a down ramp gives, but this is per tick, not per tile, and so, since the cart is traveling faster after the down ramp than it was before, it spends less time on the up ramp than it did on the down ramp, and hence, often has some speed "left over". Also an interesting note about the existence of an asymptotic maximum speed, even for megaramp-powered carts.

Also, kudos to zuglar and expwnent (why on earth didn't someone check what the actual internal units were before... *facepalm*). This is starting to look more or less "solved". I think I'll have another look at all that weird-looking data I got for turns, would be satisfying to see it match simulations based off the values mentioned recently.
Logged

taptap

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #67 on: June 13, 2015, 04:27:34 am »

Track stops:
highest: 50000
high: 10000
medium: 500
low: 50
lowest: 10

Is this still correct?

A minecart coming out of a speed limiter (i.e. 45-50k speed) when going through a series of high friction track stops on the second, indicating 25k friction if I am not missing anything. Wait, per tick not per tile?
« Last Edit: June 13, 2015, 05:01:38 am by taptap »
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #68 on: June 13, 2015, 05:28:05 am »

It is per tick, not per tile. I have not checked the results since I originally produced them.
Logged

taptap

  • Bay Watcher
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #69 on: June 13, 2015, 06:22:07 am »

It is per tick, not per tile. I have not checked the results since I originally produced them.

Sorry, I realised it a little later.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #70 on: June 13, 2015, 04:13:44 pm »

Huh, I think I bumped into the 270k speed cap from the other direction while screwing with launch.lua, I was opening gm-editor in mid-air and screwing with the projectile speeds and I recall that setting it over something like 2.5 million tended to result in death, superdeaths whereupon even if you cheat and resurrect yourself you immediately slam into something again.

Oh and at speeds that high you can grind yourself against the roof of the skybox it looks like. I didn't think to try 2.7 exactly, I just know 3.0 = death, 2.5 = generally ouch, ~2.25 = usually safe.

...BAHAHAHAHAHAHAHAHAHAHAHAHAHAHA... ok, yeah, I confirmed that 2.7 million is a safe speed for a unit in flight, and was going to see what happened if I touched down with the flag toady told me lets you do a safe jump to land on your feet, well, this is also the save I was testing artifake and names with right?
Spoiler (click to show/hide)
So yeah, I hit a tree (and went through to the other side, painfully >.<) but that isn't why I'm laughing.

I named my upper greaves "Crotchsaver" because I was just doing simple names, Headbox, Kittenstomper, etc, and Crotchsaver seemed apt... and it was!
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: SCIENCE: Quantifying minecart physics
« Reply #71 on: June 13, 2015, 06:09:32 pm »


A minecart coming out of a speed limiter (i.e. 45-50k speed) when going through a series of high friction track stops on the second, indicating 25k friction if I am not missing anything. Wait, per tick not per tile?

Are you accounting for the checkpoint bug?  The first tile after a ramp has no effect upon a cart, and a cart will pass through it in one tick.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare
Pages: 1 ... 3 4 [5]