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:Computing
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}} | {{av}} | ||
− | {{ | + | {{human}} |
− | + | Computing in dwarf fortress is the practice of setting up complex constructions to perform logical operations and calculations, ideally to control some functionality of your fortress. Even if it isn't a young concept anymore, there is still lots of room for improvement and development. One reason is that there are many ways to solve one problem. Innovation and invention is encouraged. | |
− | Computing in | ||
=== Binary information === | === Binary information === | ||
Binary information can have one of two possible states: true or false, respectively 1 or 0. In dwarf fortress they can be represented by different entities: | Binary information can have one of two possible states: true or false, respectively 1 or 0. In dwarf fortress they can be represented by different entities: | ||
− | * on/off state or signal of a | + | * on/off state or signal of a {{l|trigger|trigger}} (pressure plate, lever) |
− | * power or connection state of a | + | * power or connection state of a {{l|machine component|machine component}} |
− | * open or closed state of a | + | * open or closed state of a {{l|door|door}} or similar buildings |
− | * | + | * {{l|pressure plate|low/high}} or {{l|flow|flowing/standing}} {{l|water|fluid}} |
− | * present | + | * present {{l|creature|creature}}s and {{l|dwarf|borgs}} |
Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus] | Electronic devices and computers base on this elementary form of information, and if you want to go into computing, you’ll have to familiarize yourself with it. [http://en.wikipedia.org/wiki/Propositional_calculus propositional calculus] | ||
=== Input/Output === | === Input/Output === | ||
− | Input can be any device which can be linked to another device with mechanisms, such as | + | Input can be any device which can be linked to another device with mechanisms, such as {{l|lever|levers}} or {{l|pressure plate|pressure plates}}. Pressure plates can measure water, magma, or creature weight, and can be set to react to your own dwarves if measuring creature weight. If measuring water or magma you specify the minimum and maximum levels at which it should output 'on', and at all other levels it will output an 'off' signal. Regardless of the actual amount of water, magma, or creature weight on your pressure plate, the plate can only output an 'on' or 'off' signal (1 or 0) to whatever devices it is linked to. So everything you build will have a binary base. |
====Input elements==== | ====Input elements==== | ||
− | * manual: | + | * manual: {{l|lever|lever}} -> binary on/off signal |
− | * triggered: | + | * triggered: {{l|pressure plate|pressure plate}} -> binary on/off signal |
− | According to input, output can be anything that is able to react to an on/off signal. This can be doors, bridges, floodgates allowing or stopping flow, gears controlling pumps and much more. In some special configurations - when | + | According to input, output can be anything that is able to react to an on/off signal. This can be doors, bridges, floodgates allowing or stopping flow, gears controlling pumps and much more. In some special configurations - when {{l|mechanical logic|mechanical logic}} is involved - output may not be a on/off signal but power, thus running or not running a machine component. |
− | Currently to convert from power to an on/off signal, the only way is to use a | + | Currently to convert from power to an on/off signal, the only way is to use a screw pump connected to that power source with an unlimited amount of water and drainage at the output, and a pressure plate to measure whether water is being pumped out by the pump. |
− | |||
====Output elements==== | ====Output elements==== | ||
− | * signal: | + | * signal: {{l|pressure plate|pressure plate}} -> binary on/off signal -> linkable Object(s) |
− | * power: | + | * power: {{l|gear assembly|gear assembly}} -> binary power on/power off -> machine |
=== Binary logic === | === Binary logic === | ||
− | Basic binary logic takes one or two input bits and creates an output based on them. The devices that perform these operations are commonly called '''logic gates'''. | + | Basic binary logic takes one or two input bits and creates an output based on them. The devices that perform these operations are commonly called '''logic gates'''.<br /> |
− | + | * NOT - takes one input and returns the opposite of the input<br /><br /> | |
− | * NOT - takes one input and returns the opposite of the input | ||
− | |||
{| class="wikitable" border=1 | {| class="wikitable" border=1 | ||
|- | |- | ||
Line 43: | Line 39: | ||
| 1 | | 1 | ||
| 0 | | 0 | ||
− | |} | + | |}<br /> |
− | |||
* AND - takes two inputs and returns true if both inputs are true | * AND - takes two inputs and returns true if both inputs are true | ||
* OR - takes two inputs and returns true if at least one input is true | * OR - takes two inputs and returns true if at least one input is true | ||
Line 50: | Line 45: | ||
* NAND - takes two inputs and returns true if either input is false | * NAND - takes two inputs and returns true if either input is false | ||
* NOR - takes two inputs and returns true if both inputs are false | * NOR - takes two inputs and returns true if both inputs are false | ||
− | * | + | * NXOR - takes two inputs and returns true if both inputs are identical<br /><br /> |
− | |||
{| class="wikitable" border=1 | {| class="wikitable" border=1 | ||
|- | |- | ||
Line 98: | Line 92: | ||
| 0 | | 0 | ||
| 1 | | 1 | ||
− | |} | + | |}<br /> |
− | |||
The most human-understandable logic system requires NOT, AND and OR gates, but having a design for either a NAND or a NOR gate is enough to build any of the other gates. Some gates are easier to create or need fewer components than others depending on what discipline your logic relies on. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you). | The most human-understandable logic system requires NOT, AND and OR gates, but having a design for either a NAND or a NOR gate is enough to build any of the other gates. Some gates are easier to create or need fewer components than others depending on what discipline your logic relies on. Designing each individual gate that you will need (or using designs that had each individual gate designed) rather than building a gate out of multiple NAND gates or the like will generally result in your dorfputer reacting faster and using less resources (power, water, kittens, construction materials, what-have-you). | ||
=== Complex gates === | === Complex gates === | ||
− | * | + | * {{l|Latch|Latch}} - storing and reading a single binary value |
− | * | + | * {{l|Repeater|Repeater}} - sending a repeating signal |
− | * | + | * {{l|Counter|Counter}}/{{l|Adder|Adder}} - binary calculation |
== Disciplines == | == Disciplines == | ||
− | + | Historically, prior to DF2010 there have been 3 main disciplines of dwarfputing, depending on what would drive the dwarfputer. Each of them had its assets and drawbacks. So far, DF2010 at 0.31.01 appears to be essentially the same as far as power transmission goes, barring some differences with pump vertical power transmission (they don't without the floor between being channeled, apparently). Science! will determine what, if anything, differs as far as water flow, falling, and animal pathfinding. | |
The three disciplines are: | The three disciplines are: | ||
=== Fluid logic === | === Fluid logic === | ||
− | + | {{l|Infinite flow fluid logic|Infinite flow fluid logic}} is controlling the ''flow of fluid'' over different pressure plates. Fluid logic can be easily constructed and every known logic gate in dwarf fortress has already been built with it. On the other hand this discipline depends on a somehow unlimited source of the used fluid to deal with its {{l|evaporation|evaporation}} and [[DF2010:Water#Water_in_Fortress_Mode|destruction]]. | |
− | |||
=== Mechanical logic === | === Mechanical logic === | ||
− | + | {{l|Mechanical logic|Mechanical logic}} uses systems of axles and {{l|gear assemblies|gear assemblies}} to build logical gates. Mechanical logic reacts very fast and can be easily constructed, except for the need for a fluid-pump-based power->signal converter in every gate. Since every gear can itself be linked to a trigger (or multiple triggers), and automatically connect to adjacent gears for transferring either power or load, mechanical logic gates are very flexible and don't require anywhere near the number of different devices that tend to be used in fluid logic gates (except, again, for the requirement for a fluid-pump-based power->signal converter in every gate, unless you intend to use it to control a pump). On the other hand this discipline uses a LOT of mechanical power, and due to the lack of a power->signal converter, also referred to as a "rotation sensor" (a device to convert from power to on/off link signals), you need to build one using fluid logic components (the only design currently uses a pump, pressure plate, unlimited fluid, and unlimited drain) if you want to connect multiple mechanical logic gates together or connect a mechanical logic gate to any output other than a pump. So, in truth, current mechanical logic is more correctly termed mechanical-fluid hybrid logic, as you need an essentially unlimited source of water along with an unlimited drain to power the pump-based signal converters. (That said, an aquifer would work perfectly) | |
=== Animal logic === | === Animal logic === | ||
− | + | {{l|Animal logic|Animal logic}} places animals in an enclosed room, with a door blocking the path to where they desire to go, and a pressure plate below a hatch, with obstacles which are controlled by triggers. The animal thinks it can walk through the door, and if it has a path to the door will walk up to it and stand on the hatch. When the hatch is opened by a trigger, it falls onto the pressure plate. As long as the hatch is open, or other obstacles block its path to the door it remains on the pressure plate and the output is 'on'. Once it sees a path to the door it will leave the pressure plate. Generally this is made possibly by the fact that animals try to go to their parent while they're children, or to the meeting area. There are also be designs which use captured hostiles. | |
There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems. | There was a fourth, theoretical, discipline, Borg Logic, but there was never any reported success inventing any functioning and useful borg logic systems. | ||
Line 133: | Line 125: | ||
* And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater. | * And here's a more complicated example, omitting the details of what gates to use: An automated swimming training room, where you pull a lever to close exit doors and open hatches to drop water into it, then pressure plates detect when there's enough water and close the hatches, and after a certain amount of time (using a very slow repeater, for instance), drains and exit doors open and the system resets until you pull the lever again. Or, the lever could be taken out entirely and the system could be made fully automatic (with dwarves set to train in the room, for instance) using the repeater. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |