Ideal Engine

fooksie

Terrarian
Hey engineers, I've been into wiring extensively for quite a while but mostly on my own and one thing I've never understood is the desire need for speed. The fastest engines I'm aware of are something like 60 signals per tick, and as far as I'm aware the fastest mechanism (enemy statues) have a cooldown of only 0.5 seconds.

What's all the hype about, and is it better to have 60s/t engine or a 2 signal per second engine? Also, what would be the optimal method for a 2s/s engine? Right now I'm using 4 alternating spear traps.

Thanks `:happy: (why is there no Engineer emote set?)
 
Making sure something like statues or traps can fire off the absolute frame they're available is pretty nice. They're also good if you're a lunatic like me and use them to drop large amounts of boulders in a small timeframe.
 
60 triggers/s engines (such as the standard hoik engine) aren't necessary for most trap systems, though they are usually used to loop logic functions that need a 1 tick gap between iterations to avoid gate smoke. The fastest engine that I've seen so far is this one, which returns about 345 triggers/s. An engine like this might be unnecessarily fast, though, as triggering a complex logic function at this rate would probably cause framerate drops that would reduce its efficiency.
 
as triggering a complex logic function at this rate would probably cause framerate drops that would reduce its efficiency.

that's what I'm saying: isn't the ideal engine one that triggers as fast as necessary at the lowest computing power, making "super fast" engines actually less efficient?

I think engine quality should be determined by efficiency where efficiency is defined as signals per activation, where 1:1 is perfect, 60:1 (60 signals per 1 activation) is 60x inefficient, and 1:2 (1 signal per 2 activation time, such as a 1s timer on a .5s statue) is 2x latent

since I have a lot of wiring going on in my world, I think it'd be optimal to find an engine that triggers as quickly as possible for each timed mechanism without wasting any signals and therefore contributing to lag
 
My guess is, two 1 second timers activated 30 ticks apart, using different wire colors to the destination(so the timers are not interconnected)
with my spear trap method I just run separate wires through a logic gate so they output a single wire

the question is how to achieve the initial setup
 
I'm using a 31+ hoik teeth track(tooth with pressure plate + 29 bare teeth + tooth with pressure plate) and send a dummy ghost on it with teleporters. You could also use a counter I guess, but hoik track is simpler.
I never actually measured my setup, but it seems to be working correctly by eyeballing.
 
Last edited:
that's what I'm saying: isn't the ideal engine one that triggers as fast as necessary at the lowest computing power, making "super fast" engines actually less efficient?

I think engine quality should be determined by efficiency where efficiency is defined as signals per activation, where 1:1 is perfect, 60:1 (60 signals per 1 activation) is 60x inefficient, and 1:2 (1 signal per 2 activation time, such as a 1s timer on a .5s statue) is 2x latent

since I have a lot of wiring going on in my world, I think it'd be optimal to find an engine that triggers as quickly as possible for each timed mechanism without wasting any signals and therefore contributing to lag

If you're looking for an optimal engine that triggers mechanisms immediately whenever their cooldowns end, a 60/s engine would actually be your best option, since different mechanisms have different cooldowns that usually aren't synchronized. As long as the engine isn't connected to any massive logic mechanisms (as in hundreds of gates at a time), you shouldn't expect any lag. If you were to connect your mechanisms to, say, a 1 second timer, some of them may come off cooldown before they are triggered by the timer, thus wasting time. A 60/s engine ensures that no time is lost between mechanism activations.
 
For an activation every 30 ticks, wouldn't that be a looping hoik track with 30 teeth, and one pressure plate somewhere on the track?
 
the question is how to achieve the initial setup
So am I right, you want a delay between spear traps, so they hit the maximal amount possible?
You can do with a bat statue and pressure plates or with the player char itself and platforms.
bats pressures part of this video:
(and the forum link below the video you will find platforms)
there is also somewhere a thread for its own about these kind of initialization (too lazy to search for :)).

(some stuff may only be valid for older patches)

EDIT: found one
https://forums.terraria.org/index.p...eries-for-boss-mob-farming.33652/#post-739462
 
Last edited:
If you're looking for an optimal engine that triggers mechanisms immediately whenever their cooldowns end, a 60/s engine would actually be your best option, since different mechanisms have different cooldowns that usually aren't synchronized. As long as the engine isn't connected to any massive logic mechanisms (as in hundreds of gates at a time), you shouldn't expect any lag. If you were to connect your mechanisms to, say, a 1 second timer, some of them may come off cooldown before they are triggered by the timer, thus wasting time. A 60/s engine ensures that no time is lost between mechanism activations.
the point is that it's easy to spam signals, but it's inefficient and boring (any old bird engine satisfies every signal spam need you have)

I guess to clarify what I'm looking for is foremost a "perfect" 0.5s timer, followed by "perfect" timers corresponding to each mechanism cooldown (10s for heart statues, for example, although they seem to truly be 10s and 2 ticks from my experience)
So am I right, you want a delay between spear traps, so they hit the maximal amount possible?

I'm using spear traps to create a 0.5s timer, they aren't the end goal. Since spear traps have a 2s cooldown, 4 spear traps that activate a pressure pad .5s apart will create 4 .5s repeating timers (then you run them through a logic gate to output a single wire wherever you need it)

like this except properly calibrated (I can't make the timers activate 0.5s apart no matter where I place the pressure pad)
NI780MJ.png


if this worked correctly, slime should spawn every 0.5s exactly in sync with signals, 0 wasted 100% efficiency
[doublepost=1493278279,1493277975][/doublepost]
For an activation every 30 ticks, wouldn't that be a looping hoik track with 30 teeth, and one pressure plate somewhere on the track?
I don't use hoiks, to me it's like using a glitch that'll break everything that uses it once it's patched. Even if it won't be patched, that's always what it'll feel like to me
 
the point is that it's easy to spam signals, but it's inefficient and boring (any old bird engine satisfies every signal spam need you have)
I don't use hoiks, to me it's like using a glitch that'll break everything that uses it once it's patched. Even if it won't be patched, that's always what it'll feel like to me
Ok, then just have statue cooldown help initialize the two timers. Use anything to spam signals to a mob statue(at least once per tick). Have a newly spawned mob move predictably and trigger a pressure plate(only once per mob). Use logic gates so that same pressure plate first activates 1st timer, then 2nd, then disables mob spawning(and signal spam generator). It's probably as reliable 30 tick delay as a hoik track, but has more limitations(day/night, player position, etc affecting ai).
 
Last edited:
Did you tried with the portal gun engine (from top link). There the Resolution is much better. Find the positions which are 0.5sec apart and connect them to your timer. Not sure how accurate the statue activation need to be, less then 1/120sec should be ok.
 
I got the spear trap activation to work by placing it and the pressure plate 17 tiles apart (5 tiles less than a dart trap), syncs exactly with the 0.5s statue delay

but back to the original post: what I still don't understand is the need for an engine any faster than 1 signal per tick. I'm sure you all know what I mean and I'm sure some of you have tried your hand at "the fastest engine," but I still don't see what it's for. Assuming something has no cooldown whatsoever, I presume it still can only be activated once per tick, right?
 
Logic gate mechanisms (if configured correctly) can actually receive more than 1 signal per tick. I'm not sure what is the limit on how much signals can they take though.
Imagine an adder module doing multiplication: you add X to itself Y amount of times. This needs to take the sum and feeding it back to the input of the adder making a loop and the game isn't very keen on loops (it stops them), so adding an engine that adds a small pause between calculating the result and loading the next value is needed for this kind of setup. The process then needs time to calculate the final result, so having a faster engine means a faster result. Also for some systems there is a moment, where it needs to correct itself (the rotation of a cannon as an example) and the faster its engine, the more accurate its result will be.
 
So we are talking about engines. Always a fun subject. I don't build many things that need output spam. But when I do, I prefer my Spear Trap Engine. `:D
Capture 2016-07-10 23_04_12.png
Capture 2016-07-10 23_04_27.png
Capture 2016-07-10 23_04_54.png

 
the point is that it's easy to spam signals, but it's inefficient and boring (any old bird engine satisfies every signal spam need you have)

I guess to clarify what I'm looking for is foremost a "perfect" 0.5s timer, followed by "perfect" timers corresponding to each mechanism cooldown (10s for heart statues, for example, although they seem to truly be 10s and 2 ticks from my experience)

I'm using spear traps to create a 0.5s timer, they aren't the end goal. Since spear traps have a 2s cooldown, 4 spear traps that activate a pressure pad .5s apart will create 4 .5s repeating timers (then you run them through a logic gate to output a single wire wherever you need it)

like this except properly calibrated (I can't make the timers activate 0.5s apart no matter where I place the pressure pad)
NI780MJ.png


if this worked correctly, slime should spawn every 0.5s exactly in sync with signals, 0 wasted 100% efficiency
[doublepost=1493278279,1493277975][/doublepost]
I don't use hoiks, to me it's like using a glitch that'll break everything that uses it once it's patched. Even if it won't be patched, that's always what it'll feel like to me

If the statue is the only mechanism that you are trying to control with that engine, then a 30 tick engine works fine (it won't work unless you calibrate it perfectly, though). However, keep in mind that, if you want the same engine to control multiple mechanisms, then to ensure maximum efficiency, the cooldown of your engine must be a common factor of the cooldowns of those mechanisms, preferably the greatest common factor (for example, an enemy statue with a 30 tick cooldown and a heart statue with a 602 tick cooldown would require an engine delay of either 1 or 2 ticks). If you can settle for less than perfect efficiency, then it's better to have an engine that's slightly too slow than slightly too fast, as making it too fast would cause the mechanisms to frequently skip over engine cycles.
 
I have to ask: Is one second always synonymous with 60 ticks? I was under the impression "1s" meant 1 "real" second, as in TIMESTAMP_NEW-TIMESTAMP_OLD >= 1000. Are cooldowns actually tick based and therefore affected by lag?
 
I have to ask: Is one second always synonymous with 60 ticks? I was under the impression "1s" meant 1 "real" second, as in TIMESTAMP_NEW-TIMESTAMP_OLD >= 1000. Are cooldowns actually tick based and therefore affected by lag?

In most game engines, programmers use a technique called frame skipping that separates the process of engine updates from frame rendering. Basically, the frame rate of a game is flexible, giving the user the option either to allow the frame rate to be as high as possible, or to cap the frame rate at some value. Most moniters work best when the frame rate is capped at 60 fps, though this rate may drop if the rendering process is too taxing on the computer, resulting in lag. The engine side of the program (physics and other processes) is always updated at a fixed rate, usually 30 or 60 updates per second (60 in Terraria's case, as is evident by the operation of hoiks). When the framerate experiences lag, the engine is still able to perform multiple updates per frame, skipping over rendering frames in the process, thus the name "frame skipping." With frame skipping on, the engine will appear to run at the same speed when when you encounter lag. With frame skipping turned off, you may notice that the game appears to go in slow motion whenever there is lag, due to the fact that the engine rate is then tied to the frame rate. Nevertheless, 1 second in the engine will always equate to 60 engine ticks, but not 60 frames, so mechanisms will still operate properly even when the frame rate drops.
 
I am a developer, timestamp checks like the one I posted is also very common because it's time-precise. Even with "frame skipping" (I prefer to call a runtime loop separate from a render loop) lag will distort the "real" time. If the game itself is running at 15 fps due to high load, it'll be 4x slower than 60 fps and therefore 1 second becomes 4 seconds

that's why I asked if Terraria uses timestamps or not
I know what a render loop is
 
Back
Top Bottom