...
P.S.: oh, expectedly you can trick speeding carts into going down a ramp after all - just use an impulse ramp, like so:
##########
═══▲▼..▼══
##########
Cart goes W->E, impulse ramp (e.g. NE) just east of the pit. No extra ramps needed to contain the cart coming back up. Ramps can be on tiles the cart would skip if moving on flat track, ramp transitions automatically force their own movement pattern.
The impulse ramp immediately before the actual down ramp tricks the engine into treating the cart as already moving downwards. Caveat: i've only tried this with an ordinary terminal-velocity cart, not with supersonic carts. Those might get tripped up by the distance conversion around ramps.
I've also been able to get carts to go down ramps while at terminal velocity (achieve by a >100-z drop onto a string of downward ramps + several impulse ramps) by using a wall directly after the down-ramp tile (which is of course actually an up ramp on the z below). I got it from
this thread. I assume that the "get the cart to go down the ramp" portion could be used even without magma, i.e.
#######
══▼#▼══
#######
and on the z below:
#######
##▲=▲##
#######
I presume this behaviour is a shortcut/exception in the code/intended behaviour, to allow for diagonal 45° tunnels downwards, instead of the cart bumping into the wall ahead of it each z-level, then dropping down onto the ramp, and repeating the same the next z-level (or at least every few z-levels, once it reaches vertical derail speed).
edit: the obvious next step is to try and implement this, and test the weaponization potential of the resulting dwarven water railgun. Since collision damage is apparently calculated off momentum, and shotgunned water is already known to impact as a pretty massive boulder, this technology would create some truly
MASSIVE impacts. Or not, if submersion in water resets momentum, or if taking on water recalculates speed (to conserve momentum instead of increased total momentum), or if shotgunned items' speed is set to the minecart terminal velocity or lower. If taking on water/magma increases the momentum due to speed not changing (more than by the usual supercharged friction effect) but the cart becoming heavier, then the cart itself may still be usable as the railgun projectile. Or boosting the momentum of already-supercharged carts like this may be used to simplify/compact the design.
The real challenge is of course that compared even to the automatic minecart shotgun, the railgun is orders of magnitude more complex to build, requiring multiple stages, "pre-heating" earlier stages,
exact timing, several specific materials etc. The materials aren't too hard, though: bloodthorn-oak-willow-adamantine, or 4-step metal version, (heavy platinum-)platinum-lead-zinc, should be doable on any embark with traded materials at least, since bloodthorn and adamantine are nearly guaranteed regardless of biome, and the rest can be traded for. And if you want the even crazier 10-step railgun you need to do some modding and/or get an artifact minecart or two out of exotic materials.
Although, if submersion doesn't wreck the momentum, then water could be used to make some carts heavier to bridge the gaps in the density sequence.