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.31: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.31"). 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:
{{av}}
 
 
 
Creature logic 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 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.
  
Line 7: Line 5:
 
* Creature logic requires no fluid or wind.  In dry, windless environments, creature logic is the only kind of logic you can use.
 
* Creature logic requires no fluid or 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 bring 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.
 +
* Creature logic is relatively fast.  Although it can never reach the speed of mechanical logic, it can operate more quickly than fluid logic.
 
* 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 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-- it can even work in decimal systems without conversion.
 
* 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 lot of hatches, doors, and mechanisms.
+
* Reliable creature logic requires a lot of space, a lot of hatches and doors, and a lot of mechanisms.  There are tricky things to do that can reduce this, but they're best avoided in favor of good design principles.
 
* Creature logic requires creatures-- sometimes, a great number of creatures.  Sometimes, those creatures die or have babies.  Sometimes, they interrupt your 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 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 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 meeting hall (in most cases), this is a real possibility.
* Creature logic requires large amounts of space.
+
* Creature logic can require large amounts of space.  A creature logic NOR is vastly larger than a mechanical logic NOR.
* It is (probably) not possible to design perfect delays with creatures in an unmodded game.  Any creature logic timing devices will only ever work probabilistically.
+
* It is (probably) not possible to design perfect delays with creatures in an unmodded game.  Any timing devices will always be vulnerable to error, although some techniques can lower this potential to a minimum.
  
 
==Free range or one path==
 
==Free range or one path==
Line 32: Line 31:
  
 
====Key====
 
====Key====
In all of the following diagrams, the creature is assumed to start at {{Raw Tile|s|#0FF|#000}} (if given).  {{Raw Tile|p|#F00|#000}} means that the square contains a path to the creature's pathing goal.  Doors {{Raw Tile|┼|#FF0|#000}} and hatches {{Raw Tile|¢|#FF0|#000}} are displayed in the same color as the pressure plate {{Raw Tile|^|#FF0|#000}} that links to them.  If no pressure plate exists for a color, furniture of that color is opened or closed from outside of the circuit pictured; if a hatch and a door are the same color, that means they receive signals from the same source.  Output pressure plates are displayed in magenta {{Raw Tile|^|#F0F|#000}}, as is any furniture in the circuit that is linked with the output plate.  In the rare case that part of a circuit is linked with multiple elements, it will be displayed with foreground and background colors and explained in text-- for instance, {{Raw Tile|^|#F0F|#0FF}} is linked both to cyan furniture and output.
+
In all of the following diagrams, the creature is assumed to start at {{Raw Tile|s|#0FF|#000}} (if given).  {{Raw Tile|p|#F00|#000}} means that the square contains a path to the creature's pathing goal.  Doors {{Raw Tile|┼|#FF0|#000}} and hatches {{Raw Tile|¢|#FF0|#000}} are displayed in the same color as the pressure plate {{Raw Tile|^|#FF0|#000}} that links to them.  If no pressure plate exists for a color, furniture of that color is opened or closed from outside of the circuit pictured; if a hatch and a door are the same color, that means they receive signals from the same source.  In the rare case that furniture is linked to both by a pressure plate in the circuit and an input signal, it will be displayed in white {{Raw Tile|¢|#FFF|#000}} and explained in text.  Output pressure plates are displayed in magenta {{Raw Tile|^|#F0F|#000}}, as is any furniture in the circuit that is linked with the output plate.
  
 
===Identity with NOT gate===
 
===Identity with NOT gate===
Line 68: Line 67:
 
The hatches at the top permit path only if neither operand is true (NOR); the doors at the bottom permit path if either operand is true (OR).  The pressure plate will signal when neither operand is true.
 
The hatches at the top permit path only if neither operand is true (NOR); the doors at the bottom permit path if either operand is true (OR).  The pressure plate will signal when neither operand is true.
  
===XOR gate with expanded XNOR gate===
+
===XOR gate with XNOR gate===
 
{{diagram|spaces=yes|\
 
{{diagram|spaces=yes|\
 
   ╔═╦═╗   
 
   ╔═╦═╗   
Line 80: Line 79:
  
  
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).
+
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.
  
  
====Expanded XOR with XNOR: Ordinal compare====
+
====Expanded XOR: Ordinal compare====
This expanded XOR/XNOR can serve as an ordinal comparison-- XNOR implies equality, while the two arms of XOR, from north to south, imply that the first operand is greater than or less than the second operand.
+
This expanded XOR/XNOR can serve as an ordinal comparison-- XNOR implies equality, while the two arms of XOR, from north to south, imply that the first operand is greater than or less than the second operand.  2 arms are required for each each gate.
 
{{diagram|spaces=yes|\
 
{{diagram|spaces=yes|\
   ╔══╗
+
   ╔══╗  
  ╔╝[#0F0]┼[#FF0]¢╚╗  
+
  ╔╝[#0F0]┼[#FF0]¢╚╗
  ║+OO[#F0F]^
+
  ║+OO[#F0F]^╚╗
═╝+[#0F0]¢[#FF0]┼+╚═
+
═╝+[#0F0]¢[#FF0]┼++╚═
[#0FF]s+O══O+[#F00]p
+
[#0FF]s+O══O++[#F00]p
═╗+[#0F0]¢[#0F0]┼+╔═
+
═╗+[#0F0][#FF0]┼++╔═
  ╚╗[#FF0][#FF0]¢╔╝  
+
║+OO+╔╝
   ╚══╝ }}
+
  ╚╗[#0F0]¢[#FF0]¢╔╝
 +
   ╚══╝   }}
  
 
The pressure plate will signal when the first operand is greater than the second operand.  It can be adjusted to signal for less than, equal to, or any combination.
 
The pressure plate will signal when the first operand is greater than the second operand.  It can be adjusted to signal for less than, equal to, or any combination.
Line 102: Line 102:
 
   ║[#F00]p║
 
   ║[#F00]p║
 
══╝[#0F0]¢║
 
══╝[#0F0]¢║
[#0FF]s[#0F0]¢[#0F0]^O╣
+
[#0FF]s[#0F0]¢[#F0F]^O╣
 
══╗[#0F0]┼║
 
══╗[#0F0]┼║
 
   ║[#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 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.  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.
  
 
==Creature memory==
 
==Creature memory==
Line 112: Line 112:
 
   ╔═╗   
 
   ╔═╗   
 
═══╝[#0F0]┼╚══
 
═══╝[#0F0]┼╚══
[#F00]p[#FF0]¢[#FF0]^[#FF0]¢[#00F]¢[#F0F][#00F]^[#00F]¢[#F00]p
+
[#F00]p[#FF0]¢[#FF0]^[#FF0]¢[#00F]¢[#00F]^[#00F]¢[#F00]p
 
══╗[#0FF]┼╔═══
 
══╗[#0FF]┼╔═══
 
   ╚═╝  }}
 
   ╚═╝  }}
  
This is a low latency version (not the simplest version, not the most full-featured) of creature-based memory.  Each pressure plate is linked to each adjacent hatch.  Memory is set by sending an open (followed closely by a close) to either door.
+
This is a low latency version (not the simplest version) of creature-based memory.  Each pressure plate is linked to each adjacent hatch.  Memory is set by sending an open (followed closely by a close) to either door.
  
 
Note that in this diagram, both ends need to lead to the pathing goal.  The creature can enter by either side, but will be constrained to either pressure plate during normal operation.
 
Note that in this diagram, both ends need to lead to the pathing goal.  The creature can enter by either side, but will be constrained to either pressure plate during normal operation.
Line 123: Line 123:
 
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).  Repeaters based on the rate with which creatures fall through open space hold promise for the design of perfect creature-driven delay.
 
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).  Repeaters based on the rate with which creatures fall through open space hold promise for the design of perfect creature-driven delay.
  
The memory design above, slightly modified, can make a decent (not perfectly regular) repeater.
+
The memory design above, slightly modified, can make a very regular (not perfectly regular) repeater.
 
{{diagram|spaces=yes|\
 
{{diagram|spaces=yes|\
 
   ╔═╗   
 
   ╔═╗   
 
═══╝[#FF0]¢╚══
 
═══╝[#FF0]¢╚══
[#F00]p[#FF0]¢[#FF0]^[#FF0]¢[#00F]¢[#F0F][#00F]^[#00F]¢[#F00]p
+
[#F00]p[#FF0]¢[#FF0]^[#FF0]¢[#00F]¢[#00F]^[#00F]¢[#F00]p
 
══╗[#00F]¢╔═══
 
══╗[#00F]¢╔═══
 
   ╚═╝  }}
 
   ╚═╝  }}
  
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.
+
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 105 ticks, but never faster than every 100 ticks.  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.
 
  
 
==Signal management==
 
==Signal management==
Line 147: Line 145:
 
  ╚═════╝ }}
 
  ╚═════╝ }}
  
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.  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.
  
 
===Signal division===
 
===Signal division===
Line 154: Line 152:
 
║[#F0F]¢╚══════════╝[#FF0]¢║
 
║[#F0F]¢╚══════════╝[#FF0]¢║
 
╠O[#F0F]^[#0FF]┼++++++++[#FF0]¢[#FF0]^O╣
 
╠O[#F0F]^[#0FF]┼++++++++[#FF0]¢[#FF0]^O╣
║[#F0F]¢O══════════O[#0FF][#FF0]¢║
+
║[#F0F]¢O══════════O[#FFF]¢║
 
╚╗++++++++++++╔╝
 
╚╗++++++++++++╔╝
 
  ╚════════════╝ }}
 
  ╚════════════╝ }}
Line 170: Line 168:
  
 
====Floodgate design====
 
====Floodgate design====
Floodgates can be used instead of any of the doors pictured; with signal inversion, they can also be used instead of hatches.  Floodgates respond much more slowly than doors, but if obstructed, they close as soon as the obstruction is removed.  This can be important, for instance, if your creatures give birth inside of your logic circuit.
+
Floodgates can be used instead of any of the doors pictured; with signal inversion, they can also be used instead of hatches.  Floodgates respond much more slowly than doors, but if obstructed, they return to their proper state as soon as the obstruction is removed.  This can be important, for instance, if your creatures give birth inside of your logic circuit.
  
 
====Bridge design====
 
====Bridge design====
Line 191: Line 189:
  
 
==Animal logic==
 
==Animal logic==
[[Animal logic]] relies on a special case of free range creature logic that is specific to animals that are unable to open doors, by pathing them through tightly closed doors.  Animal logic can be very space efficient and easy to build in comparison to most kinds of creature logic.
+
{{L|Animal logic}} relies on a special case of free range creature logic that is specific to animals that are unable to open doors, by pathing them through tightly closed doors.  Animal logic can be very space efficient and easy to build in comparison to most kinds of creature logic.
  
 
{{Category|Computing}}
 
{{Category|Computing}}

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)