The CisternZ-1:
Z-2:
You can see a bit of the powertrain from the previous screenshots at the top edge of these images, though that's not important for this section. It just helps you locate where the cisterns are in relation to the rest of the cannon, although that location isn't really very important. We're dealing with pressurized water here, after all. It'll go absolutely *everywhere* if you let it. I managed to avoid flooding my fort, likely in no small part because I had four Z-levels of aquifer I could cut infinite drains into whenever I needed them. Also because I never carved any tunnels to access the aquifer from below. Only from above.
The idea here is to have a large, 2-level-deep reservoir where the top level is constantly refilled by the aquifer, but the bottom level is sealed against the aquifer. A water tile sitting directly on top of 7/7 water is a tile that can teleport via the DF water pressure rules into any non-7/7 space connected by 7/7 water to the tile below it. Hence, the more water tiles there are sitting on top of 7/7 water, the faster the pressurized flow will be able to fill any spaces created when the minecarts dip into the filling channel. And since pressure-pathing water tiles don't move items or jostle minecarts, the more pressurized flow I can muster, the better.
The top cistern is the first one I built. It worked, but not particularly well. It doesn't have a particularly large area for water to pressure-path from, and about half of that area is sandstone floor (which you can't see in the screenshot) that I never managed to remove. In addition to that, only half of its perimeter is actual aquifer-connected rough sandstone, so it doesn't produce nearly as much water as it could. And, to top it off, I built it too close to all the other stuff I built for the cannon, resulting in things getting cramped.
However, I did learn a lot while building it, so when I decided that when the first cistern wasn't producing as much water as I wanted, I was better prepared to build Cistern #2.
Before I get into how I did that, however, I should explain what the various floodgates visible at the top of the Z-2 screenshot do. The leftmost one leads to a small channel down into Z-3 (the third layer of the aquifer) into which water can drain. A drain like this is absolutely necessary for constructing a cistern, but the floodgate stays closed now.
The floodgate one tile northeast of that floodgate leads to the cart drop. This is left over from when I was trying to use gchristopher's method of filling carts, before I ran into the weird floating carts bug. This floodgate also stays closed now.
There is a third floodgate, located two tiles east of that one. It's open, and thus invisible, and connects the cisterns to the filling channel. This one stays open, except when I need to drain that channel for maintenance.
All right. Now. How to Build a Cistern!
This is a process all about transporting and disposing of water. Screw pumps can be used to extract water from a tile on the Z-level below and transport it one tile up and three tiles horizontally. Additionally, in a multi-layer aquifer like the one I found myself with, channels can be used to create drains into which an infinite amount of water may be disposed. A single channel can keep several nearby floor tiles dry enough for dwarves to move and work, even if those floor tiles are themselves surrounded by unsealed aquifer.
Channeling is great when you have access to a Z-level and don't mind putting holes in the floor. It's the technique I used to clear out all of Z-1 and start opening up Z-2. However, breaking into Z-1 and clearing the rest of Z-2 required a combination of the two techniques: namely, using a screw pump to lift water out of a tile channeled into the aquifer, move it over a few tiles, and dump it back into another part of the aquifer. This gives the dwarves access to the tile the pump is drawing from, allowing them to either channel down next to it into the layer below to create a drain or smooth the adjacent walls to seal the exposed tile from the aquifer.
Once I used this technique to create a walkable and accessible up ramp on Z-1 with a drain into Z-2, I was ready to start clearing Z-1. The goal at this point in time was to create a large square area on Z-1 completely devoid of water, with at least one walkable floor tile adjacent to each wall so that wall can be smoothed and sealed, and a system of channels in the floor arranged such that I can use screw pumps to dry and seal them later on. I didn't quite do this in the optimal manner, but here's an improved schematic that should work fairly well for a cistern the same size as mine:
Z-1
###############
#╔═══════════╗#
#║.....▼.....║#
#║▼▼▼..▼..▼▼▼║#
#║.....▼.....║#
#║...........║#
#║▼▼▼▼...▼▼▼▼║#
#║.....▼.....║#
#║.....▼.....║#
#║▼▼▼▼...▼▼▼▼║#
#║...........║#
#║.....▼.....║#
#║.▼▼..▼..▼▼.║#
#╚═══════════╝#
###############
Legend:
# - Rough aquifer wall (currently unrevealed; just keep in mind where these will be)
╔═╗║╚═╝ - Smoothed aquifer wall (or otherwise sealed)
. - Floor
▼ - Channel into Z-2 aquifer layerEvery wall is accessible, there should be enough channels to drain enough water for your miners to get in there and do their thing, there's plenty of two-tile spaces between the channels for pumps, and every relevant tile on Z-2 is revealed except for a few of the walls under the smoothed walls on the top edge and in the bottom corners... which could be a problem later. Not a huge one, though. In hindsight, it might have been better to make the whole thing a tile shorter, just so the channels would line up with the walls a little better. But I didn't know how much pressure I would need, so I wanted to build it big, and an 11x11 area was conveniently easy to designate.
In any case, with Z-1 clear and sealed, the next step is to connect one of the channels to the cannon's minecart-filling channel and to a drain to a deeper aquifer layer. Both of these need floodgates, which you'll need to install and link to levers in a control room somewhere before going too much farther.
This means digging plumbing on Z-2 and completely sealing it from the aquifer. The easiest way to do this is to simply dig the channel two tiles deep, cutting through Z-1 and Z-2, using pumps and channeling in the same way as in the cistern. However, you
do not want to disturb the aquifer tiles immediately surrounding the smoothed walls on Z-1, since they will be the cannon's water supply. This means that you'll have to plumb underneath unsealed aquifer, which is... tricky.
Before we get there, though, you'll want to seal the channel in the cistern closest to your water-pipe-to-be. Just set up a line of screw pumps on one side of it, pumping water into one of the other (unsealed) channels. Set them to pump manually, and give a bunch of dwarves the Pump Operating labor. Once they start pumping, designate the walls on Z-2 surrounding that channel to be smoothed, and enable Engraving on a whole bunch of dwarves. You'll get a bunch of "Dangerous Terrain" cancellation spam, but with one pump for each tile in a straight channel, your engravers should be able to seal it fairly quickly without requiring you to redesignate the walls too many times. Also note that each tile smoothed reduces the amount of water flowing into the channel, so once the first couple are done, the rest will go faster. For maximum efficiency, you may want to wait to smooth the corners until after the rest of the walls are smoothed. Aquifers don't spawn water diagonally, so the corners don't contribute any water, but you will want them smoothed eventually.
All right. You have a dry, sealed water pipe outside the cistern, and a dry, sealed channel inside it. Now you need to connect them without disturbing the tiles that will become the cannon's water supply. I really don't know what the best way to do this is. I started using the channeling method to create a two-tile-wide passage with all the walls accessible, smoothed the walls, then started constructing floors over the channels. I also kept the pumps I had used to seal the channel in the cistern running to suck water flowing out of the pipe into the other cistern channel. At first, this looked like it was going to work, but at some point there was just too much water coming from the ceiling for the pumps and remaining channels to keep up, so I had to dig around in Z-1 and install another pump there to suck even more water out. I did manage to get it completed, but it was a pain. And since I couldn't seal all the walls around the pump, the components washed into one of the drain channels when I disassembled it, where they will remain for all eternity. Oh well.
I think a better solution would be to dig a 2-wide tunnel, checkerboarding it with alternating floors and channels to keep the walls accessible. Smooth the walls, then cover the entire floor with a bridge. I don't know at what point in construction bridges become impermeable, but whenever that happens, you can simply declare it "good enough" and "probably inaccessible". If your dwarves can still access the bridge at that point (remember, there's water coming down from the ceiling over it, so it may be too flooded for them to do anything with), you may optionally link it to a lever. This would actually be a pretty convenient drain for the cistern, which you will definitely need before going any farther. If you haven't built one already. Which you probably have. And definitely should have, given that I don't know if this bridge trick even works.
Anyway, you've got a pipe connecting your cistern to your cannon that is being flooded from above by the aquifer, but is otherwise sealed. Now you need to finish clearing out the cistern, and that means tackling Z-2. I recommend using the pump-and-smooth method. Start at the back, and work your way toward the channel you've already sealed, since it has its own (floodgated) drain. Each channel you seal is a channel you'll no longer be able to dump water into, so plan this out carefully.
Remember those smoothed walls on Z-1? You will want all of the walls directly under them to be smoothed as well. In my schematic, most of these are accessible from the channels, but not quite all of them. You'll need to do some fiddling to get them smoothed. Also note that it's no longer important that all the walls on Z-1 remain accessible (that was just so they could be smoothed), so that will make things easier.
At this point, every single wall on Z-2 should be smooth, up to and including the ones directly underneath the smoothed walls on Z-1. All the channels should be dry, save the one connected to the cannon (which will never be dry again). The next step is to clear out Z-2. Do this by channeling the tiles from above. You don't want any floors left over. Start at the furthest point from your entrance, and work your way inward. But leave a couple tiles at the entrance that your dwarves can walk on- we're not quite done yet.
Once you've got unbroken orthogonal channels going all the way around the edge of Z-2 (except for your dwarves' entrance), you can start on the final step: unsealing Z-1. Dig out (
not channel) the smoothed walls on Z-1. You can just designate the whole perimeter of the room at once, since the dwarves will only be able to access one tile at a time on each side. And while they're working on that, keep picking away at the least-accessible floor tiles on the interior of Z-1.
When it's done, you'll have a large square/rectangular pool with a ledge around it. Water will continually flow from the aquifer, across the ledge, and into the pool, and from there into the floodgated drain. The ledge will remain pathable as long as the drain floodgate is open. Collect any random items on the ledge that comehow haven't been swept into the pool already, clear out your dwarves, and close the floodgate. Z-1 will flood, and you can declare your cistern complete.
And with that, we can finally move on to the part I'm most proud of:
AutomationI'll start by touching briefly on how I'm powering those rollers.
Z+0 shows the waterwheels, each on its own gear assembly. The rightmost gear assembly connects downward, and has two mechanisms attached: one connecting to a lever in my dining hall, and the other to a pressure plate I'll get back to in a bit. This single gear assembly controls the power to all the rollers. I can toggle it manually via the lever for testing and maintenance purposes, or I can let the automation control it for me.
Ignore that axle leading off to the left; it's no longer being used. I just never bothered disassembling it.
Z-1 shows two things. First, at the left, is the pump I used to get the water flowing under the water wheels. I initially tried powering it from the wheels themselves Dwarven-Water-Reactor-style and letting the water drain into the aquifer on Z-2, but it didn't end up working well enough. So I floored over the channel down to Z-2, disconnected the pump, ran it manually until the tunnel to the right filled, and let cheaty permanent flow power the wheels from then on. If a screw pump pumps water off the map or into an aquifer, every tile the water flows through is permanently marked as "flowing", even if the pump is turned off and the path is disconnected from the aquifer. It's weird, but it's perfectly reliable and doesn't require any laggy pressure- or gradient-flow at all, so I'll take it.
On the right-hand side of Z-1, you can see some more of the powertrain. The brown gear at the bottom left of this level of the powertrain connects upward to the gear with the mechanisms described above. The gear two tiles northeast of it connects downward to the rollers in the drop chute, and the rightmost gear connects downward and powers the rollers in the filling channel. I didn't plan this section very well, resulting in it being scrunched between the barrels and the cistern, which is why it's all P-shaped and weird. Were I building this again, I'd plan it out better, and this whole part of the powertrain would likely be three gears in a straight line with 3-4 axle tiles in total.
Z-2 shows, at the extreme left edge, the aquifer tiles that the pump on Z-1 drained into. That magnetite vein is impermeable, so I had to dig for a while to find the aquifer.
At the top right, you can see where the rollers connect up to Z-1. The brown gear near the top right connects to the first downward gear I mentioned earlier and powers the roller under the minecart to its north. The double-tildes cover a roller, three gears, and a single-tile axle. Once again, the wonky shape is due to space restrictions. Although now that I look at it, I could actually simplify it a good bit. The tile directly above the gear adjacent to the roller is just empty floor, and the tile to its left no longer needs to be a wall. Both of those tiles used to back impulse ramps before I ran into the floating minecarts bug, so they had to be walls then. But now I could actually channel the one tile and put a gear on it, dig the other and build an axle, and straighten up the whole powertrain quite a lot. Ah well. It works as it is, and if it ain't broke, don't fix it.
Right. On to the real meat of this section!
Everything you need to see is visible on this one Z-level. It's a couple layers below the aquifer. Z-8, specifically, not that it really matters.
It's also worth pointing out that in this area, I was able to carve everything out of natural stone. No mucking about with soil layers and tracks carved in mud getting eaten by cave moss. Minecarts are
so much easier when you don't have to haul rocks and construct every single track.
I'll start in the center and work my way outward. The brown up/down stair is in my fort's central staircase. It's directly below the center of where I pierced that monstrous aquifer. The minecart to its right is in a single-tile stockpile, refilled from the supply upstairs. It's there so I have a convenient minecart handy to drop wherever I need it. Next to that is a door, which I normally keep forbidden to keep stupid dwarves (and cats) off the tracks when there might be supersonic minecarts flying around. A few tiles north of that door, you can see a hatch cover, and several tiles to the east of that, another door. This door and this hatch cover are controlled by a single lever in the dining hall, cleverly labeled "Run Hydro Cannon". This lever forms the sole non-maintenance input to the entire system. Flip it, and the cannon turns on, with minecarts on this Z-level handling the entire boot sequence. Flip it again, and the cannon shuts down, once again in an entirely automated fashion.
Underneath the hatch cover is a channeled tile with an EW track/ramp in it, quite similar to the down ramp you can see to its right. There's a minecart continually bouncing between those two tiles on the level below and the green impulse ramp you can see next to the down ramp. Its speed and the checkpoint effect would normally cause it to go another tile to the right, but the green ramp, being an impulse ramp, is a corner track, so it rolls into the wall instead.
When the lever is pulled, the hatch cover opens, and lets the minecart escape to the left. The idea of launching a cart by releasing it from a hatch cover on a 2-tile channel like this, by the way, comes straight from Larix'
Minecart Pathing Logic system, so credit where credit is due. The minecart shoots down the impulse ramps, turns around, and gets accelerated even further, for 55 impulse ramps in total. This is more than enough to get it to maximum speed, which, as a rule, takes 50 impulse ramps. This is important, because the cart is then injected into the timing circuit. And the timing must be precise down to the tick. For this, I need to keep the cart moving at a very constant speed, and using max speed happens to be the easiest way to accomplish that. Just shoot the cart down 50+ impulse ramps to start it off, then pepper the rest of the track with segments of at least three consecutive impulse ramps to keep it at speed.
And with a max-speed cart, the rules I needed to know to be able to get the timing right were quite simple. They are as follows:
- A max-speed cart will spend exactly one tick on the first, third, and fifth tiles of any unbroken string of impulse ramps.
- A max-speed cart will spend exactly one tick on the first tile after any impulse ramp. This is a good place to put a pressure plate.
- A max-speed cart will cover quite a few tiles of flat track every tick without spending a tick on any of them. If exactly how many matters, you probably have too many.
The timing circuit occupies the 13 columns of revealed tiles at the right-hand edge of the screenshot. It is one long loop of track, folded up like an accordion for compactness. The cart is injected three tiles north of the door there, traveling northward. The pressure plates divide the circuit into six segments. Let's call the segment the cart is injected into Segment #1.
16 or so ticks after injection, the cart hits its first pressure plate and enters Segment #2. It spends a tick on every tile in this segment, with the exceptions of the middle tiles of those four runs of three impulse ramps. Exactly 20 ticks later, it reaches the next pressure plate and enters Segment #3. This segment is laid out in almost exactly the same way as Segment #2, but has a run of three ramps where Segment #2 has two ramps separated by a flat corner, and thus takes only 19 ticks to traverse.
Segments #4 and #5 are identical to Segment #2, except rotated 180 degrees. They 20 ticks. Segment #6 is just like #3, taking 19 ticks.
Segment #1's layout is a bit different from the others, since it's where the cart is shunted out of the circuit when the "Run Hydro Cannon" lever is turned off, and I had to have two consecutive flat tracks to make that work. But suffice to say that while the door is open, it's another 20-tick segment.
Overall, the cart makes one lap around the timing circuit precisely every 118 ticks, striking a pressure plate every 19 or 20 ticks along the way. Since pressure plates stay active for 100 ticks after being pressed, one pressure plate will come off its refractory period approximately 2 ticks
after the previous plate in the circuit was hit by the minecart. Now, each of these six pressure plates is linked to each of the eight hatch covers way back up in the cannon itself- the ones that control when the carts are released into the filling channel and the acceleration tracks. Whenever the minecart hits a pressure plate, an "Open" signal is sent to all the hatch covers, allowing the minecarts under them to be released. Two-ish ticks later, a different pressure plate untriggers, sending a "Close" signal to all the hatch covers. Thus, the hatches only stay open for a couple of ticks, and close before the next cart can escape. The exact time each hatch stays open depends on build order and on whether there's a 19- or 20-tick segment between the opening and closing pressure plates, but as long as it's between 1 and 5 ticks (and it always is) it's fine.
This idea of using several staggered pressure plates to open and close a door (or hatch cover) faster than the 100-tick pressure plate delay comes from MagmaMcFry's
Lightspeed Repeater, so, once again, credit where credit is due.
The final piece of automation here is the squarish thing at the bottom of the screenshot west of the timing circuit. It's an OR gate, with some concepts borrowed from Larix once again and his
Cart and Door Logic system. You'll note two doors, a pressure plate, and a mess of track and ramps. Call the door in the middle of the square Door A and the one on the southern edge Door B. Note the two down ramps east of Door A. There's a minecart on the Z-level below continuously bouncing between them MPL-style, held back by the door.
Door A is linked to the westernmost pressure plate in the timing circuit, the one at the start of Segment #1, which is also the last plate touched by the timing cart in its first lap around the circuit. Door B is linked to the easternmost plate, which starts Segment #4.
On its first lap around the timing circuit, when the cart hits the Segment #4 pressure plate, Door B opens and will remain open for the next hundred ticks, but not much else happens. When the timing cart hits the Segment #1 plate, however, is when things start happening. Door A opens, and lets the cart bouncing between those two down ramps I pointed out earlier escape to the west. It loops around the southwest corner of the OR gate, passes straight through Door B, having picked up enough speed on the impulse ramps to derail over the unbacked corner track (Door B is still open at this point, by the way), then continues around the outside edge and hits the pressure plate.
This pressure plate links to the gear assembly that controls power to the rollers in the cannon.
When the timing cart is on its first lap around the circuit, the pressure plates send out several consecutive "Open" signals, with no "Close" signals between them. This results in the hatch covers staying open for a hundred ticks straight. If the rollers were powered, then several carts would be dumped into the cannon in far-too-quick succession, jamming up the whole thing. Thus, the power must stay off during this part of the boot sequence. Once the pressure plates start coming off their refractory periods, however, the hatches remain closed when they need to be, and it's safe to turn on the power. This is what the OR gate handles.
About a sixth of the time, Door B happens to be closed when the cart reaches it. This shunts the cart northward, through the middle of the gate. On these occasions, if the cannon is running, Door A will be open, so the cart simply shoots through and takes a shorter loop around the left half of the gate.
When the cannon is shutting down, however, the timing cart is shunted out of its circuit, and Doors A and B will both eventually close. When this happens, the cart will be shunted into the middle section by Door B, then eastward by Door A. The ramp there is a straight NS track ramp, not a corner, so the cart glides straight across it and slams into the wall to the right. It then rolls northward down the ramp into the channel, then bumps into a wall on the Z-level below that keeps it from rolling into the maintenance tunnels. 80-odd ticks later, the pressure plate turns off, cutting the power to the rollers. The last few volleys of minecarts still in the barrels jettison their loads and drop into the magazines. And the shutdown sequence is complete.
Well, I think that's pretty much everything. Time to see the cannon...
In Action!I've uploaded a movie of the boot sequence and the cannon in motion to DFMA.
It's here. I only let it run a couple dozen cycles, but it's enough to see how everything goes together. If you want to see it run longer or examine it in more detail, I also saved the game on the exact same tick that the movie starts on, and uploaded the save to DFFD
here. Just download the zip, unzip it into your data/save folder, open it up in 0.44.12, unpause, and things'll start working. I went ahead and ordered the "Run Hydro Cannon" lever to be pulled, and created that save just before the job was completed. So you won't need to go hunting down the lever in my horrendously overcrowded dining room. Just be warned that those hatch covers create a
lot of lag when they open and close, and that the lag doesn't really come through in the movie unless you watch the FPS counter.
And finally, a few screenshots of the cannon in motion.
This shows Z-1 immediately after the hatches open. You can see a line of minecarts on the track stops before they drop into the filling channel, and two more lines being accelerated.
Here, a line of carts is being filled. You can see that carts have dropped from the magazines into the southern track of each barrel as of the tick this screenshot was taken, but not the northern track. I'm not entirely sure why; there are 2-3 carts sitting in each magazine at all times while the cannon is running. I guess it has something to do with the carts arriving at the muzzle at different times? I don't know. DF is weird.
You can also see a cart that warped into that channel west of the cart drop. I still don’t know when, why, or how that happens, but here’s proof that it does.
Back to Z-1, just after a line of carts has popped out of the filling channel. You can see three lines of them on the impulse ramps at the same time. Which I thought was neat.
And here's a shot of Z+0 just after one volley of water [833] has fired. The cyan double-tildes adjacent to the green fortifications were fired from the northern track of each barrel on the very tick this screenshot was taken; the cyan double-tildes 7-8 tiles farther west were fired from the southern tracks three ticks earlier. The northern tracks fire later because the carts on them have farther to travel, going an extra tile up and a couple of tiles farther east in the process of being turned around at the easternmost end of the acceleration tracks. Now that I think about it, I could probably shave a tick off the northern tracks' turnaround time by flattening that one impulse ramp on Z+1, but probably only one tick. I don't think I'll bother.
Welp, that's about it. I hope you've all found my first major foray into DF minecart engineering entertaining, and that I've inspired some of you to build your own cannons and improve upon my designs even further. If any of you have comments or questions, I’ll be happy to listen and provide what answers I can.