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.

v0.31:Creature logic

From Dwarf Fortress Wiki
Revision as of 14:37, 2 September 2011 by Quietust (talk | contribs) (moved DF2010:Creature Logic to DF2010:Creature logic: lowercase)
Jump to navigation Jump to search

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 vs mechanical or fluid logic

  • Creature logic requires no fluid or wind. In dry, windless environments, creature logic is the only kind of logic you can use.
  • 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!
  • 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-- it can even work in decimal systems without conversion.
  • It's fun to watch the creatures run around!


  • 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 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 can require large amounts of space. A creature logic XOR is vastly larger than a mechanical logic XOR.
  • It is 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.

Gates

Creature logic relies on the ability or inability of a creature to path through a specific area. In general, reliability can only be guaranteed when a creature always has one and only path, or is completely incapable of movement. Because of that, the following logic gates are shown in pairs to guarantee a path to the creature.

Key

In all of the following diagrams, # is wall, d is mechanism-operated door, h is mechanism-operated hatch over channel, ^ is a pressure plate, and empty space is floor space. The creature is presumed to enter from the left in an attempt to path to the right.

AND gate with NAND gate

 #####
##dd^##
  ###
## h ##
 ##h##
  ###

The doors at the top are both open if both operands are true (AND); the hatches at the bottom permit path if either operand is false (NAND). The pressure plate will be triggered when both operands are true.

NOR gate with OR gate

 #####
##hh^##
  ###
## d ##
 ##d##
  ### 

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 be triggered when neither operand is true.

XOR gate with XNOR gate

This is the most complicated combination; maybe as compensation, it can double as an ordinal comparison. 2 arms are required for each each gate.

  ####
 ##dh##
 # ## ##
## hd ^###
  #####
## dd  ###
 # ## ##
 ##hh##
  #### 

The two paths at the top permit path if either operand is true but not both are true (XOR); the doors at the bottom permit path if both operands are true or if both operands are false (XNOR). The pressure plate will be triggered when either operand is true but not both are true.

Multiple use

The gates above are single use gates; the creatures will escape after pathing through each gate. Circuits which return the creature to the beginning of the path are possible via altering the path in-route.

##h#
h^##
##d#

This is one version of such a device. 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, thus opening access to a new pathing goal. This new pathing goal can lead back to the original position of the creature.

Creature Memory and Repeater

######
h^hh^h
######

This is the simplest version of creature-based memory. Each pressure plate is linked to each adjacent hatch. Memory state is toggled by sending a close signal to the two central hatches.

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.

By leaving the central hatches unlinked, or by leaving the central area floored, you have a small creature-based repeater. Small repeaters like this tend not to fire frequently, but are unpredictable. Larger repeaters, with more frequent and predictable firing, are possible.

Clock Generation

Probabilistic movement rates combined with attribute rust make perfect clock generation impossible. 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).

Animal logic

{L|Animal logic} relies on a special case of creature logic that is specific to animals that are unable to grasp, by pathing them through tightly closed doors. Animal logic can be very space efficient and easy to build. Unfortunately, animal logic relies on creatures that frequently have babies and die. That makes maintenance of large animal logic circuits difficult.