Bay 12 Games Forum

Dwarf Fortress => DF Dwarf Mode Discussion => Topic started by: Sutremaine on May 17, 2013, 06:41:03 pm

Title: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Sutremaine on May 17, 2013, 06:41:03 pm
The repeater, 2-step:
(http://i.imgur.com/FQqVsWn.png)

First pic is with everything unhidden, second is with everything but the track itself hidden. The ramp direction isn't shown in this one, but I believe it's NW for both. The southernmost plate, p0, is linked to the lower bridge, b1 (this plate is used once only, though it is not a one-use plate). The middle plate, p1, is linked to the upper bridge, b2 (the bridge of the next cell in line). The northernmost plate, p3, is linked to the lower bridge (the bridge of the next cell in line).

The southernmost pressure plate (p0) primes the system, retracting the bridge in the first 2x2 cell (b1). I've had some issues with this 'taking', so you may need to push the minecart into a harmless wall a couple of times and replace it until the retraction happens. Once you push the minecart in, it'll move within and between cells indefinitely and not touch this plate again.

The bridge in the first cell (b1) is retracted due to the priming plate the minecart has been placed on (p0), and so the minecart takes the corner beneath. It rolls continually over the pressure plate (p1), blocking the exit from the next cell (retracting b2), and continues to do this until the priming plate (p0) deactivates and replaces the bridge (b1). The minecart now goes straight across the bridge and into the second cell, where it is held there by the action of the previous cell's pressure plate (p1) and continually rolls over the second cell's pressure plate (p2). About 200 ticks after the minecart leaves the first cell, the bridge in the second cell (b2) retracts, allowing the minecart back into the first cell. It is held there by the action of the previous cell's pressure plate (p2), and continually rolls over the first cell's pressure plate (p1)... And so on.

You may be able to do without the priming plate depending on the placement of the ramps and other plates. Pushing a minecart straight into a route that avoids any pressure plates but the one in the first cell will do the priming plate's job, because the minecart will be entering the first cell while its plate is activated and no other one is, in theory at least.

The latch, or the potential for one -- this is just a lever-operated pressure plate, and the more I think about it the less useful it becomes:
(http://i.imgur.com/4F9hGbI.png)

This one's simpler. You have a small loop with no pressure plate, and overlapping it is a larger loop with a pressure plate, and you just push the minecart in. If the bridge is retracted, the minecart turns the corner and remains in the small loop away from the plate. If the bridge is out, the minecart jumps to the section of track with the pressure plate, taking the larger loop and keeping the plate active.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: laularukyrumo on May 17, 2013, 09:05:39 pm
I'm not nearly as dwarfy as required to totally understand what's going on in these diagrams... but if the construction works as advertised, holy. Shit. You have just revolutionized dwarfputing.

This needs to get wiki'd.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Sutremaine on May 18, 2013, 01:26:02 am
Movie for the second: http://mkv25.net/dfma/movie-2547-leverpressureplate

Movie for the first, sort of: http://mkv25.net/dfma/movie-2548-minecartgrinderrepeater

As stated in the movie description, that one was the prototype (the bridges work at 1x1, but you can't see what they're doing. Doors might have worked here). The linkages are the same, but the bridges are separate from the cells. The main difference is the speed of the cart. The 3x2 version needs pressure plates to block movement, the 2x2 version needs them to allow movement.

I don't have a recording for the 2x2 shown in the screenshot, because the game crashed before I could record it. Nothing to do with minecarts, just some destabilising modding of the metals file.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: backora900 on May 18, 2013, 04:14:48 am
If you just need a repeater you can use one of my designs. :)
http://www.bay12forums.com/smf/index.php?topic=114695.0
To create a latch you just need to shorten the circuit, I guess.
Also, if I remember correctly you can use the door for stoping the minecart and the dwarves wouldn't have to restart the contraption by pushing the cart again. Simply opening the door should do.

I wanted to ask you about your first repeater. Because I have noticed with my design that the bridges causes some sort of lag (brief-freeze hard to describe) when switching positions. Have you noticed anything like that?
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Button on May 18, 2013, 12:28:35 pm
I placed links to both of your threads on the 'Repeaters' page of the wiki.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: laularukyrumo on May 18, 2013, 08:51:36 pm
I wanted to ask you about your first repeater. Because I have noticed with my design that the bridges causes some sort of lag (brief-freeze hard to describe) when switching positions. Have you noticed anything like that?

Bridges have a 99-tick delay between when the signal (open or close) is received and when they actually change states.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: backora900 on May 19, 2013, 03:39:13 am
I wanted to ask you about your first repeater. Because I have noticed with my design that the bridges causes some sort of lag (brief-freeze hard to describe) when switching positions. Have you noticed anything like that?

Bridges have a 99-tick delay between when the signal (open or close) is received and when they actually change states.

Yes, thats why is my repeater optimized to 200-ish ticks. But those freezes I was talking about are ment for the whole game. It takes splits of a second but it is really annoying. Maybe it's nothing and it's just caused by my computer. :)
(when the bridge graphicly changes to a different state it freezes game)
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Sutremaine on May 19, 2013, 10:14:50 am
I get that with raising bridges, even if they don't change graphically. The delay is noticeable enough that it can be used as confirmation the the bridge has changed states.

Thanks for the wiki link, Button.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Telgin on May 19, 2013, 12:27:40 pm
Supposedly the game freezing for a moment when a bridge changes state is because it has to recalculate the reachability map for path finding.  Has anyone tried isolating the moving drawbridges behind constructions or other raised drawbridges?  Theoretically that would allow the game to quickly recognize that the reachability map has only changed for a small subset of the map / graph and avoid having to redo large portions of it.  Theoretically.  If it's coded to recognize that.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: laularukyrumo on May 22, 2013, 04:45:19 am
Something that just dawned on me. Does it matter which of the pressure plates is linked to whatever it is that you're sending the repeating signal to? Or should they both be linked? Or neither, and there's a secret invisible pressure plate somewhere else handling this important piece of the puzzle? Or am I just totally crazy?
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: i2amroy on May 22, 2013, 05:55:59 am
What's the repeater times on these? Or alternatively is it possible to create an adjustable length one through a track stop with friction?
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Sutremaine on May 23, 2013, 08:18:57 pm
Does it matter which of the pressure plates is linked to whatever it is that you're sending the repeating signal to? Or should they both be linked? Or neither, and there's a secret invisible pressure plate somewhere else handling this important piece of the puzzle? Or am I just totally crazy?
If you just want something repeating and don't need it to go as fast as possible, linking to any pressure plate but the primer plate will be fine. The signal sent will be mostly 'on', so bridges will be mostly raised or retracted and doors and floodgates will be mostly open. Gears can be inverted before the repeater starts.

What's the repeater times on these? Or alternatively is it possible to create an adjustable length one through a track stop with friction?
With the 2x4 repeater, it's a little over 400 ticks for the minecart to get back where it was with the pressure plates and bridges the way they were. Altering the track length or putting track stops in should adjust the repeat time consistently.

To be honest, I've kind of forgotten how it works...
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: gchristopher on May 24, 2013, 01:31:49 am
I've been trying various designs for things like this and I think I can understand some of the "works sometime" behaviors. Derailments and ramps can leave a cart with counterintuitive offsets. It can appear to be moving faster, but actually be losing momentum by teleporting to the far side of an impulse ramp and losing the chance to accelerate. I'm holding faith that it's deterministic, but sometimes the logic isn't straightforward. A dwarf picking the cart up resets the offsets to 0, at least. It's giving me a headache.

Do you know if there's a dfhack lua API command to advance the game by one tick?

Anyway, uh, I don't know if this is useful, but here's a 2x4 version of the second latch that lets you shut it on and off by controlling a hatch? That sounds like a good thing?
Code: [Select]
z = 0   
ramps    track    pressure plate and bridge
▒▒▒▒▒▒   ▒▒▒▒▒▒   ▒▒▒▒▒▒
▒▲▲▒▲▒   ▒╚═▒║▒   ▒  ▒ ▒
▒▲ ▲▲▒   ▒║═╚╗▒   ▒ ^╬ ▒
▒▒▒▒▒▒   ▒▒▒▒▒▒   ▒▒▒▒▒▒

z = +1
▒▒▒▒▒▒
▒▒▼╔¢▒
▒▒▒▼▒▒
▒▒▒▒▒▒
The pulse generation works the same as your example. The pressure plate controls the bridge and toggles which path the cart takes. It goes up one z-level to add a lever-controller on/off hatch and is one tile larger on the left to add a couple impulse ramps to get it up the ramp.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Sutremaine on May 24, 2013, 01:18:48 pm
Why not advance the game one tick in-game? (I'm sure it can be done via DFHack though.)

The shutoff is useful, and incidentally answers a question I had about converting the layout to use the faster-responding hatches.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: gchristopher on May 25, 2013, 12:53:54 am
Why not advance the game one tick in-game? (I'm sure it can be done via DFHack though.)
I was trying to determine game cart logic by tabulating cart offsets one tick at a time as they encountered a variety of track/ramp/derailment combinations. It requires switching to the DF window, pressing period, then switching back to dfhack, recording the state, back and forth for every tick.

It'd be a lot nicer if there was a lua command to advance a tick, so I could just kick off a "record 100 ticks" program with one command.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: MarcAFK on May 25, 2013, 01:26:44 am
I'd use autohot key, You can easily just make it alt tab if you're only using 2 windows, make sure you don't have the keystroke set too low though, theres a short lag between the Alt Tab and the screen actually recognising the next input, I think i found 50 Mili seconds was enough.
Title: Re: Woodless, powerless, waterless repeater, plus maybe a latch
Post by: Oaktree on May 31, 2013, 10:34:03 pm
Have another variation on the hatch-controlled repeater.  A little more space used, but this design has a confirmed ~150 tick cycle and no oscillation in lap speed requiring a secondary speed control loop. 

Description:
Basically a 8x7 four corner track loop - with a minor vertical twist.  The impetus for the loop is provided by dropping a mine cart onto an impulse ramp in the southeast corner of the loop.  The cart moves around the loop and then on the south part of the loop two impulse ramps are used to raise the cart two Z-levels.  The cart then runs into a dead-end over a hole corresponding to the southeast corner of the loop.  A hatch on a lever is at this spot.  If open, the cart loses all speed and drops two Z-levels to land on the first impulse ramp and starts the loop again.  If the hatch is closed the cart stops on top of the hatch and sits there.  The repeater is restarted simply by pulling the lever and opening the hatch.

Code: [Select]
Z+0                     Z+1                Z+2   

+======+
|      |
|      |
|      |
|      |
|      |
+===2  1                r3 r                  r=H

1= NE track-ramp
2= NE track-ramp
3= NE track-ramp
H= Hatch over hole
r  = top of ramp built on lower level


Note: moving the 2nd ramp one space left and adding a piece of straight track between the top of the 2nd ramp and the 3rd ramp should make construction a little easier.  However, it has not been tested how (if) this affect the time the cart takes to run the loop.