v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Editing v0.34:Creature logic

Jump to navigation Jump to search

Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.

You are editing a page for an older version of Dwarf Fortress ("Main" is the current version, not "v0.34"). Please make sure you intend to do this. If you are here by mistake, see the current page instead.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{Quality|Exceptional|20:46, 30 April 2013 (UTC)}}
 
{{Computing}}
 
{{av}}
 
 
 
Creature logic is a form of dwarven [[computing]] that functions by taking advantage of creature's natural [[path]]-finding goals to trigger pressure plates.  Creature logic is complete-- you can build memory, repeaters, or any sort of logical circuit.
 
Creature logic is a form of dwarven [[computing]] that functions by taking advantage of creature's natural [[path]]-finding goals to trigger pressure plates.  Creature logic is complete-- you can build memory, repeaters, or any sort of logical circuit.
  
==Creature logic vs other disciplines==
+
==Creature logic vs [[mechanical logic|mechanical]] or [[fluid logic]]==
 
Pro:
 
Pro:
* Creature logic requires no [[water|fluid]] or [[windmill|wind]].  In dry, windless environments, circuits are limited to creature logic or [[minecart logic]].
+
* Creature logic requires no [[water|fluid]] or [[windmill|wind]].  In dry, windless environments, creature logic is the only kind of logic you can use.
* Similarly, creature logic requires no infrastructure-- you can build your circuits anywhere, without worrying about bringing water or [[power]] from one end of your map to the other.
+
* Similarly, creature logic requires no infrastructure-- you can build your circuits anywhere, without worrying about bring water or [[power]] from one end of your map to the other.
 
* All creature logic circuits can be designed with only [[stone]] and a pick-- although you're free to use [[wood]] or [[metal]] if you prefer!
 
* All creature logic circuits can be designed with only [[stone]] and a pick-- although you're free to use [[wood]] or [[metal]] if you prefer!
* Creature logic doesn't need anything but creatures to send or receive signals.  There's no need to translate signals as with [[mechanical logic]].
+
* Creature logic doesn't need anything but creatures to send or receive signals.  There's no need to translate signals as with with mechanical logic.
 
* Creature logic can be very intuitive.  Watching creatures physically travel through your logic pathways simplifies debugging.
 
* Creature logic can be very intuitive.  Watching creatures physically travel through your logic pathways simplifies debugging.
 
* It's fun to watch the creatures run around!
 
* It's fun to watch the creatures run around!
  
 
Con:
 
Con:
* Reliable creature logic requires a ridiculous number of [[hatch]]es, [[door]]s, and [[mechanism]]s-- not to mention connections between pressure plates.
+
* Reliable creature logic requires a lot of [[hatch]]es, [[door]]s, and [[mechanism]]s.
 
* Creature logic requires creatures-- sometimes, a great number of creatures.  Sometimes, those creatures die or have babies.  Sometimes, they interrupt your [[dwarf|dwarves]].  Sometimes, your dwarves fill them full of crossbow bolts.
 
* Creature logic requires creatures-- sometimes, a great number of creatures.  Sometimes, those creatures die or have babies.  Sometimes, they interrupt your [[dwarf|dwarves]].  Sometimes, your dwarves fill them full of crossbow bolts.
 
* Creature logic is vulnerable (surprise) to the presence of unexpected creatures in the logic circuits.  Because creature logic circuits require a path either to the map edge or to the [[Activity_zone#Meeting_Area|meeting hall]] (in most cases), this is a real possibility.
 
* Creature logic is vulnerable (surprise) to the presence of unexpected creatures in the logic circuits.  Because creature logic circuits require a path either to the map edge or to the [[Activity_zone#Meeting_Area|meeting hall]] (in most cases), this is a real possibility.
Line 84: Line 80:
  
  
As XOR is the intersection of OR and NAND, it is simply an OR followed by a NAND.  The XNOR, as the union of AND and NOR, requires two arms.  Each operand is linked to one door and one hatch in the XOR path, and to one door and one hatch in the XNOR path.  The pressure plate will signal when either operand is true but not both are true.  When modifying the XOR to take more than two operands, be careful to leave space between the doors and hatches as shown; this space is unnecessary for evaluation of two operands.  Similarly, the expanded XNOR is appropriate when dealing with more than two operands, but a condensed version for taking only two operands exists.
+
As XOR is the intersection of OR and NAND, it is simply an OR followed by a NAND.  The XNOR, as the union of AND and NOR, requires two arms.  Each operand is linked to one door and one hatch in the XOR path, and to one door and one hatch in the XNOR path.  The pressure plate will signal when either operand is true but not both are true.  When modifying the XOR to take more than two operands, be careful to leave space between the doors and hatches as shown; this space is unnecessary for evaluation of two operands.  Similarly, the expanded XNOR is appropriate when dealing with more than two operands, but a condensed version for taking only two operands exists (shown in the next circuit).
  
 
===Multiple use===
 
===Multiple use===
Line 95: Line 91:
 
   ║[#F00]p║}}
 
   ║[#F00]p║}}
  
This is one such device for re-routing creatures mid-path.  Upon stepping on the pressure plate, the creature opens two hatches, thus blocking retrograde motion as well as access to its pathing goal, and opens a door, giving access to a new pathing goal.  This new pathing goal can lead back to the original position of the creature.  This principle is demonstrated in the designs to follow.  Because the creature is constrained on the pressure plate, the door can be opened by outside mechanisms rather than being linked to the pressure plate, permitting controlled movement of a creature through one or more arms of a circuit.
+
This is one such device for re-routing creatures mid-path.  Upon stepping on the pressure plate, the creature opens two hatches, thus blocking retrograde motion as well as access to its pathing goal, and opens a door, giving access to a new pathing goal.  This new pathing goal can lead back to the original position of the creature.  This principle is demonstrated in the designs to follow.  Because the creature is constrained on the pressure plate, the door can be opened by outside mechanisms rather being linked to the pressure plate, permitting controlled movement of a creature through one or more arms of a circuit.
 
 
===Reversibility===
 
The reader may have noticed the near symmetry of the preceding gates.  However, the output works as well when placed before the path-limiting furniture as after!  While it's easier to visualize the effects of these circuits when displayed as above, it is often more effective to use a reversed design.  When a single creature is used to traverse a large, compound circuit, reverse design can lead to reduced latency.  A clever logician might wonder, "But if they can evaluate the signal before traversing the path, why traverse the path at all?"  Consider the following XOR/XNOR gate, redesigned both for reuse and reversed operation:
 
 
 
{{diagram|spaces=yes|\
 
    ╔═╦═╗ 
 
    ╔╝[#0F0][#F0F]¢O[#0F0]┼╚╗
 
════╝[#F0F]^[#FF0][#F0F]¢+[#FF0]┼+╚═
 
[#F00]p[#F0F][#00F]┼[#0FF]¢[#0FF]^[#0FF]¢O═══O+[#F00]p
 
════╗[#00F]^[#00F][#0F0]¢[#FF0]¢++╔═
 
    ║[#00F]¢OO+╔╝
 
    ╚╗[#0F0]┼[#FF0]┼╔╝ 
 
    ╚══╝  }}
 
A creature waits at the start point, atop the cyan hatch, until evaluation is triggered by an '''off''' signal to the cyan hatches (typically following a redundant '''on''' signal).  The creature, suddenly granted path to its goal, races toward either XOR or XNOR, but evaluation occurs earlier than in previous designs.  Its original path is blocked upon evaluation and the creature is rerouted back to its start point.  (Note that while the creature is reset in this design, furniture is not necessarily reset.  Some circuits may require additional furniture to control path without altering operands.)
 
  
Whereas the creature needed to travel 8 tiles for evaluation in the previous design, this allows evaluation in 2 tiles, and the refractory period-- the time during which the circuit cannot be used to evaluate another operand-- is improved to an even larger extent.
 
 
==Creature memory==
 
==Creature memory==
 
{{diagram|spaces=yes|\
 
{{diagram|spaces=yes|\
Line 125: Line 106:
  
 
==Clock generation, repeaters, and delay==
 
==Clock generation, repeaters, and delay==
A high resolution borg-logic clock or delay can be designed around the rate with which creatures fall. A simpler, low resolution clock can be designed based around the military [[scheduling]] menu or [[minecart]] routes.
+
Probabilistic movement rates combined with [[attribute]] rust make perfect clock generation impossible-- or at least, no one has done it yet.  Without rust, however, its possible to design a device that will measure the speed of a given creature to any arbitrary level of confidence (less than total).  This may be possible, for instance, when using [[undead]] creatures.  Repeaters based on the rate with which creatures fall through open space hold promise for the design of perfect creature-driven delay.
 +
 
 +
A low resolution clock generator can be designed via borg logic: using military scheduling to create a clock that will not run fast or slow.  Such a clock is limited to increments of [[calendar|months]], and will involve unpredictability in its exact function, but any error will not accumulate.
  
 
The memory design above, slightly modified, can make a decent (not perfectly regular) repeater.
 
The memory design above, slightly modified, can make a decent (not perfectly regular) repeater.
Line 135: Line 118:
 
   ╚═╝  }}
 
   ╚═╝  }}
  
Here, each pressure plate is linked to the two orthogonally adjacent hatches.  The southern hatch is linked to the eastern pressure plate, while the northern hatch is linked to western pressure plate.  This repeater tends to fire about every 250 ticks, with open and close signals offset by about 125 ticks, when built as shown.  It's very effective at rapidly triggering any device with a refractory period of 100.  Similar, non-repeating systems can be used to institute delay.
+
Here, each pressure plate is linked to the two orthogonally adjacent hatches.  The southern hatch is linked to the eastern pressure plate, while the northern hatch is linked to western pressure plate.  This repeater tends to fire about every 250 ticks, with open and close signals offset by about 125 ticks, when built as shown.  Although it's not a perfect delay, over sufficient repetitions, after attribute rust has run its course, the repeater will behave as a regular repeater-- that is, as the time for which it has ran approaches infinity, the repeater approaches full reliability.  In other words: it's very effective at rapidly triggering any device with a refractory period of 100, and it's perfectly acceptable for running a calendar.  Similar, non-repeating systems can be used to institute delay.
  
 
Linking both pressure plates to output doubles its rate, turning it into very effective spike repeater.  The period can be increased by introducing floor space into the center of the design.
 
Linking both pressure plates to output doubles its rate, turning it into very effective spike repeater.  The period can be increased by introducing floor space into the center of the design.
Line 150: Line 133:
 
North of the circuit is the pathing goal.  The eastern and western pressure plates are linked to adjacent hatches.  Input is linked to the hatch southeast of the eastern pressure plate and to the door.  The central and southern pressure plates are linked to output.  This circuit generates both an open and a close every time it is sent an open or a close signal from input -- that is, it generates two properly-ordered signals for every properly-ordered signal it is sent, allowing for ''edge triggered'' logic.  Either output pressure plate can be removed to send an open and a close only upon receiving one kind of signal or the other kind of signal.  Output can linked to the same device or to two different devices.
 
North of the circuit is the pathing goal.  The eastern and western pressure plates are linked to adjacent hatches.  Input is linked to the hatch southeast of the eastern pressure plate and to the door.  The central and southern pressure plates are linked to output.  This circuit generates both an open and a close every time it is sent an open or a close signal from input -- that is, it generates two properly-ordered signals for every properly-ordered signal it is sent, allowing for ''edge triggered'' logic.  Either output pressure plate can be removed to send an open and a close only upon receiving one kind of signal or the other kind of signal.  Output can linked to the same device or to two different devices.
  
Note that the memory design forms a sort of inverse of this circuit, in that a single open-close cycle is translated into a single on or off signal.
+
Note that the memory design forms a sort of inverse of this circuit, in that a single open-close cycle is translated either into a steady on or off signal.
  
 
==Alternative design==
 
==Alternative design==
Line 174: Line 157:
  
 
====Dwarves====
 
====Dwarves====
Dwarves themselves can be used to run logic circuits, and are perhaps the most interesting choice; logic designs involving dwarves are generally referred to as borg logic.  While longer-lived than most domestics, dwarves [[food|starve]] and [[alcohol|dehydrate]] easily, requiring frequent, careful maintenance.  Idle dwarves path unpredictably, and dwarves are vulnerable to [[sleep|drowsiness]], leading to very high latency.  Married female dwarves are fecund.  At the same time, dwarves are excellent choices for logic circuits because of their varied pathing goals that can be altered through direct interaction by the player.  Dwarves can trigger events both through the use of pressure plates and through the use of [[lever]]s, while their pathing goals can be controlled by many means-- most easily and predictably, by military scheduling or minecart routes.  In fact, one can see the entire game of Dwarf Fortress as one big logic circuit with dwarves as the driving creature. The more philosophically oriented overseer may wonder what cyclopean, ineffable circuit he or she is traversing through the act of playing Dwarf Fortress....
+
Dwarves themselves can be used to run logic circuits, and are perhaps the most interesting choice; logic designs involving dwarves are generally referred to as borg logic.  While longer-lived than most domestics, dwarves [[food|starve]] and [[alcohol|dehydrate]] easily, requiring frequent, careful maintenance.  Idle dwarves path unpredictably, and dwarves are vulnerable to [[sleep|drowsiness]], leading to very high latency.  Married female dwarves are fecund.  At the same time, dwarves are excellent choices for logic circuits because of their varied pathing goals that can be altered through direct interaction by the player.  Dwarves can trigger events both through the use of pressure plates and through the use of [[lever]]s.  In fact, one can see the entire game of Dwarf Fortress as one big logic circuit with dwarves as the driving creature.
 +
 
 +
The addition of [[vampire]]s to the game opens up many possibilities for borg logic-- the simplest implementation being placing one in a room full of levers.
  
 
===Undead===
 
===Undead===
[[Undead]] are an intriguing choice for creature logic choices.  The absence of attribute rust opens up the possibility for a more consistent repeater.  They can be used in fully submerged circuits-- even in magma-submerged systems.  In some [[biome]]s, they are self-repairing.  However, undead path like wildlife, which can make it difficult to set up a circuit for them.  Without a clear target, they may not behave predictably.  One way to work around this is to build a visible target to which the undead path, by walling the circuit with [[channel]]s instead of walls, and placing a captured invader in clear line-of-sight of the undead logician.
+
[[Undead]] are an intriguing choice for creature logic choices.  The absence of attribute rust opens up the possibility for a very accurate, very precise creature logic clock.  They can be used in fully submerged circuits-- even in magma-submerged systems.  In some [[biome]]s, they are self-repairing.  However, undead path like wildlife, which can make it difficult to set up a circuit for them.  Without a clear target, they may not behave predictably.  One way to work around this is to build a visible target to which the undead path, by walling the circuit with [[channel]]s instead of walls, and placing a captured invader in clear line-of-sight of the undead logician.
  
===Other choices===
+
====Other choices====
There are a few things to stay away from, but in general, any sufficiently understood creature can be used for creature logic.  Building destroyers are problematic, but full-bridge design is possible.  Likewise, flyers and swimmers cause difficulty, but nothing that can't be worked around.  Creatures with trapavoid are nearly useless, though [[gremlin]]s might be able to output via levers; stun-able creatures like [[kobold]]s can trigger pressure plates when dropped/stunned; and non-web-immune creatures trigger pressure plates that have been [[web]]bed. Creatures with a [[size]] less than 10000 are too small to set off pressure plates, thus requiring additional "hardware" (such as a tame creature that "flees" or "charges" over a pressure plate).  The essence of creature logic, however, is predictable pathing.  This may or may not exclude the use of certain types of wildlife.
+
There are a few things to stay away from, but in general, any sufficiently understood creature can be used for creature logic.  Building destroyers are problematic, but full-bridge design is possible.  Likewise, flyers and swimmers cause difficulty, but nothing that can't be worked around.  Creatures with trapavoid are unfortunately useless (with the possible exception of [[gremlin]]s, who might be able to output via levers), as are creatures with a [[size]] less than 10000, as they're too small to set off pressure plates.  The essence of creature logic, however, is predictable pathing.  This may or may not exclude the use of certain types of wildlife.
  
 
{{Category|Computing}}
 
{{Category|Computing}}
{{Category|Logic}}
 

Please note that all contributions to Dwarf Fortress Wiki are considered to be released under the GFDL & MIT (see Dwarf Fortress Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

Templates used on this page: