The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#51 2014-01-29 11:04:14

colorfusion
Member
Registered: 2013-04-02
Posts: 537

Re: Electronics Tutorial?

Zalethon wrote:

I'm having trouble figuring out clocks and such when loops (understandably) die and everything reverts to 'off'... Anyone have any examples?

The simplest circuit that loops is this:
OpuUxca.png

Initially power can get through, as the inverted voltage switch is in its Off state.  By letting power through, however, the power reaches back up and turns itself On which extends the arm and stops power getting through. This once again turns it Off, which lets power through, which turns it On, which turns it Off, &c..

The game wants all all electrical components to be settled after 16 sub-steps like this. If it detects tiles that are still looping, it sets each one individually to its lowest seen state. That's usually (I think always) its unpowered/off state. This circuit will settle down to how it looks in the picture. Even though it looks like power should be getting through, the game has forcefully decided that the wires should be unpowered, and the switch should also be off so that they can stop looping.

This will still be recalculated each turn, but overall it will appear to stay off. Also to note is that death is calculated after wiring is done settling, so standing on an electric floor connected to this circuit is completely safe, because (although it technically turns on and off in between turns) it settles down to off before death is tested.

Although these mid-turn pulses can't be seen and traps don't really react to them, other wiring still receives them:

edZShMZ.png

The second part added on here will start off, but stay on as soon as it receives any signal. This is because the signal will power the voltage trigger which then lets power through for itself. The small sub-turn signals will still trip this component on the first turn wiring is simulated, thus fully powering the whole circuit.

That's pretty much all the trickery that you need to know to understand clocks, so long as you already know basic wiring.


The first main component of a clock is a pulser that lets out a signal every turn, like the first circuit shown above (although more controlled), this is fairly simple.

The next parts are counters. The logic behind them is basically if they receive a pulse, activate a gate like the second component above which keeps themselves powered. However if that part is already tripped and powered, unpower it in some way and pass the pulse onto the next counter.  They toggle on and off every pulse, and if they went from high to low they pass the pulse along to the next one.

In a chain of these, each one is triggered half as often as the one before. The ones at the end will most rarely get a pulse going all the way through. This actually creates a binary counter.

That's the basics of what clocks do. The exact wiring differs by design.

Last edited by colorfusion (2014-01-29 11:11:30)

Offline

#52 2014-01-29 16:34:26

DethBringa
Member
Registered: 2014-01-16
Posts: 160

Re: Electronics Tutorial?

OK well I've been trying to follow this and it doesn't seem to quite add up like I expected so I thought well I'm missing something so I'll replicate what's pictured and then I should be able to follow it.
So I made a copy of Hippasus's post "....repeating circuit with period 8...."
It did nothing. Guess I'm either still not following something or maybe there was a mistake it in somewhere.
I'm trying to make a repeating circuit that would flash on and off with each step. Is that possible?


If I vanish it's not due to a burglar shooting me as well as my wife while making his way to the vault....
I'm just a burst player.
tongue

Offline

#53 2014-01-29 17:26:43

iceman
Member
Registered: 2013-11-09
Posts: 687
Website

Re: Electronics Tutorial?

To change every turn, just use the first two circuits in the example in this thread: http://thecastledoctrine.net/forums/vie … php?id=519 (In fact, a few posts down it has an improvement for the first circuit, the signal generator).

To use any of the clocks, just plug your traps into the wires connected to the top of the lights.


Fortress Theory Mod - New objects, tools, and paintings!

I keep dying of a natural cause - Stupidity
The biggest thing that Castle Doctrine has taught me is that the price of your house is proportional to the stupidity of the mistake that kills you.

Offline

#54 2014-01-29 18:56:59

DethBringa
Member
Registered: 2014-01-16
Posts: 160

Re: Electronics Tutorial?

Whew... that's insane to learn. Made a few mistakes and killed myself. Getting it now... this is gonna be cool.


If I vanish it's not due to a burglar shooting me as well as my wife while making his way to the vault....
I'm just a burst player.
tongue

Offline

#55 2014-01-29 19:31:29

Zalethon
Member
Registered: 2014-01-22
Posts: 23

Re: Electronics Tutorial?

Once I figured it out, it's kind of fun to make corridors with timing  puzzles tongue

Offline

#56 2014-02-01 08:20:12

HaterSkater
Member
Registered: 2014-02-01
Posts: 29

Re: Electronics Tutorial?

Tell me, gents, am i doing something wrong, or loops don't work/need to be updated after version 30? I made a loop, as described in second example in colorfusion's post, but it won't work

Offline

#57 2014-02-01 08:38:23

colorfusion
Member
Registered: 2013-04-02
Posts: 537

Re: Electronics Tutorial?

HaterSkater wrote:

Tell me, gents, am i doing something wrong, or loops don't work/need to be updated after version 30? I made a loop, as described in second example in colorfusion's post, but it won't work

Everything should still work in V31. Keep in mind the second example doesn't alternate or anything, it's just to show that electronics can receive the mid-turn pulses. You should have a look at the clocks thread if you want something that loops/repeats.

Offline

#58 2014-02-01 09:08:46

HaterSkater
Member
Registered: 2014-02-01
Posts: 29

Re: Electronics Tutorial?

Whoa! magic. So it means that i need bit storage to actually made it work, because pulse generator completing it's hidden cycle in one turn. Thanks, colorfusion. Yesterday i figured out how to build self-protected code system, but after five minutes i saw that i need protection system for protection system, lol

Offline

Board footer

Powered by FluxBB 1.5.8