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.

Difference between revisions of "User:BaronW"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
 
(33 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
== Armok Invaders ==
 +
 +
I built Space invaders into Dwarf Fortress.
 +
 +
[[File:Armoc_Invaders_intro.png]]
 +
 +
It can be downloaded From [http://dffd.bay12games.com/file.php?id=11730 here]
 +
The map can be seen [http://mkv25.net/dfma/map-12634-armokinvaders here]
 +
You can see a video of a play-through [https://www.youtube.com/watch?v=j2cMHwo3nAU here]
 +
 +
I will update this with details of how I made the project as I have time.
 +
 +
===Stats===
 +
 +
This fort took 85000 mechanisms.
 +
It takes over 100,000 power at full drain.
 +
The main screen is 32x32 that makes it a 1 kilopixel display.
 +
 +
===High Level Overview===
 +
 +
Sorry this is so big
 +
 +
[[File:Invaders_Overview.png]]
 +
 +
===More Detail===
 +
====KEY====
 +
 +
[[File:Gear assembly Default position is engaged.png]] Gear assembly where the starting position is engaged
 +
 +
[[File:Gear assembly Default position is disengaged.png]] Gear assembly where the starting position is disengaged
 +
 +
[[File:PreasurePlateSwitch.png]] Pressure plate switch: the letter in the boxes indicates the type of switch C is [http://dwarffortresswiki.org/index.php/DF2014:Minecart_logic#Newton.27s_Cradle_Memory Newton's Cradle] S is [http://dwarffortresswiki.org/index.php/DF2014:Minecart_logic#Power_to_signal Power to Signal]. The Symbol in the dimond matches linked Items.
 +
 +
====+/-1 Engine====
 +
 +
[[File:+-1caption.png]]
 +
 +
[[File:+-1Description.png]]
 +
 
== The Almighty Dwarven Calculator ==
 
== The Almighty Dwarven Calculator ==
  
Line 6: Line 45:
 
It can take inputs of up to 999 and give answers of up to 999999 or 999.999.
 
It can take inputs of up to 999 and give answers of up to 999999 or 999.999.
  
[[File:7x191.PNG]]
+
[[File:7x191.PNG]]<br />
 +
 
 +
See the map - [http://mkv25.net/dfma/map-8460-themechanism]<br />
 +
Download the fort - [http://dffd.wimbli.com/file.php?id=2121] There are probably still several bugs, if you find one list it on the discussion page.
 +
 
 +
=== How to use ===
  
== How to use ==
+
In the control house (shown above calculating 7x191) there 6 groups of levers each group corresponds to an input number, and each lever within a group corresponds to a number 0-9 (in the same pattern as on a cell phone, as shown below).
  
The in control house (shown above calculating 7x191) there 6 groups of leavers each group corresponds to an input number, and each lever within a group corresponds to a number (in the same pattern as on a cell phone). Once the leavers that represent the desired numbers have been pulled (only one lever per group or things will go wrong).<br />
+
[[File:Teaching.png]]
  
Then select the desired function (+ * - /) by pulling the indicated lever. The selected function will be displayed.<br />
+
Once the levers that represent the desired numbers have been pulled (only one lever per group or things will go wrong) then select the desired function (+ * - /) by pulling the indicated lever. The selected function will be displayed.<br />
  
Then select pull the equals lever, go and make a cup of tea, some soup perhaps compose a sonnet (it takes a long time even for simple equations).<br />
+
Then pull the equals lever, go and make a cup of tea, some soup perhaps compose a sonnet (it takes a long time even for simple equations).<br />
  
Your answer will then be displayed in glorious digital numbers.
+
Your answer will then be displayed in glorious digital numbers (many incorrect numbers will 'flash past' first once the numbers stop changing the answer will be correct [I think])
  
== How it works ==
+
=== How it works ===
  
=== Addition (binary)===
+
==== Addition (binary)====
  
In essence what you need to do to make any computer work is to brake the job down to its simplest possible functions. To that end all actual computation is done in binary. <br />
+
In essence what you need to do to make any computer work is to break the job down to its simplest possible functions. To that end all actual computation is done in binary. <br />
 
This is the first 2 cells from the addition engine.<br />
 
This is the first 2 cells from the addition engine.<br />
 
[[File:Addition cell 1&2.GIF]]
 
[[File:Addition cell 1&2.GIF]]
 
<br />
 
<br />
Each cell is designed to add a two or three binary digits together. The first cell adds 2 digits (that is one from each of the input numbers). When you add 2 binary digits together there are 4 possible ways for them to combine and 3 possible outcomes (0+0=0, 0+1=1, 1+0=1, 1+1=10), however an outcome of 0 does not change the answer so you do not need to build it (In the addition engine I did build it but i later disconnected it). So each input gets a line of mechanisms, A line and B line, since there are 3 important ways of combining the inputs each line has 3 mechanisms. levers are connected to some mechanisms so they can be 'flipped' and thereby each row made to represent one possible outcome. A screw-pump is then connected to each outcome which triggers a pressure-plate which triggers either the outcome or the C line of the next cell.
+
Each cell is designed to add a two or three binary digits together. The first cell adds 2 digits (that is one from each of the input numbers). When you add 2 binary digits together there are 4 possible ways for them to combine and 3 possible outcomes (0+0=0, 0+1=1, 1+0=1, 1+1=10), however an outcome of 0 does not change the answer so you do not need to build it (In the addition engine I did build it but I later disconnected it). So each input gets a line of mechanisms, A line and B line, since there are 3 important ways of combining the inputs each line has 3 mechanisms. levers are connected to some mechanisms so they can be 'flipped' and thereby each row made to represent one possible outcome. A screw-pump is then connected to each outcome which triggers a pressure-plate which triggers either the outcome or the C line of the next cell.
 
<br /> The second and all subsequent cells need to add a C line that is triggered when the answer of the previous cell is 10 or 11. And so there becomes 8 (7 important) ways for the digits to combine and 4 possible outcomes (3 important). But an all other ways cell 2-10 is the same as cell 1.<br />
 
<br /> The second and all subsequent cells need to add a C line that is triggered when the answer of the previous cell is 10 or 11. And so there becomes 8 (7 important) ways for the digits to combine and 4 possible outcomes (3 important). But an all other ways cell 2-10 is the same as cell 1.<br />
 
[[File:Addition cell b 1&2.GIF]]<br />
 
[[File:Addition cell b 1&2.GIF]]<br />
Line 32: Line 76:
 
[[File:Addition.PNG]]
 
[[File:Addition.PNG]]
  
=== Subtraction (binary)===
+
==== Subtraction (binary)====
  
 
Subtraction works much the same as addition except that the A-line input is positive and the B-line and C-line inputs are negative. So the possible outcomes are (from a 3 line input) (in the order I put them in the engine) 1-0-0=01, 1-1-1=-11, 0-0-1=-11, 0-1-0=-11, 0-1-1=-10, 1-0-1=0, 1-1-0=0, 0-0-0=0. This has the advantage that there are 3 irrelevant outcomes in each cell so you only need to build 5 rows in each cell.<br />
 
Subtraction works much the same as addition except that the A-line input is positive and the B-line and C-line inputs are negative. So the possible outcomes are (from a 3 line input) (in the order I put them in the engine) 1-0-0=01, 1-1-1=-11, 0-0-1=-11, 0-1-0=-11, 0-1-1=-10, 1-0-1=0, 1-1-0=0, 0-0-0=0. This has the advantage that there are 3 irrelevant outcomes in each cell so you only need to build 5 rows in each cell.<br />
 
Subtraction engine.<br />
 
Subtraction engine.<br />
 
[[File:Subtraction main.PNG]]<br />
 
[[File:Subtraction main.PNG]]<br />
The one difficulty in subtraction is that the engine has no idea what a negative number is, so if you want the calculator to be able to give a negative response you need to teach it. My solution (possibly massively overcomplicated) was to build a which number is larger engine and then tell the subtraction engine to subtract the smaller number from the larger. A 'which number is larger' engine is not easy. It is presented with 2 10 digit binary numbers A1-A10 & B1-B10 then asks: does 'A1=1 and B1=0' or does 'B1=1 n and A1=0' if the answer is yes to either, that will mean that one number is larger than the other. It will then send power to a set of screw-pumps that will then tell the main engine which number to subtract from which. If the answer is no to both then it will ask does 'A2=1 and B2=0' or does 'B2=1 n and A2=0', this repeats until it decided which number is larger or that they are the same.<br />
+
The one difficulty in subtraction is that the engine has no idea what a negative number is, so if you want the calculator to be able to give a negative response you need to teach it. My solution (<s>possibly</s> massively overcomplicated) was to build a 'which number is larger' engine and then tell the subtraction engine to subtract the smaller number from the larger. A 'which number is larger' engine is not easy. It is presented with 2 10 digit binary numbers A1-A10 & B1-B10 then asks: does 'A1=1 and B1=0' or does 'B1=1 n and A1=0' if the answer is yes to either, that will mean that one number is larger than the other. It will then send power to a set of screw-pumps that will then tell the main engine which number to subtract from which. If the answer is no to both then it will ask does 'A2=1 and B2=0' or does 'B2=1 n and A2=0', this repeats until it decided which number is larger or that they are the same. I am sure there are better ways of doing this but I was to tired at the time to think of them.<br />
The engine looks like this- the main bit is in the bottom right.<br />
 
 
[[File:Which number is larger.PNG]]
 
[[File:Which number is larger.PNG]]
  
=== Multiplication (binary) ===
+
==== Multiplication (binary) ====
  
 
Multiplication works almost exactly like adding another dimension to addition. To multiply 2 numbers together we once again need to break the process down. So in decimal 238x644 = 238x4+238x40+238x600. The same is true in binary except the whole thing is much easier because you are either multiplying by 1 or 0. So 101x110 breaks down to 101x0+101x10+101x100 simple. Once you realise this it is easy design the multiplication engine (rather harder to build)it is simply a series of addition engines or tiers where the A-line of each cell is either the A-number or 0 depending on the B-number and the B-line is the answer from the tier above (shifted 1 to the left so as to effectively multiply it by 10).<br />
 
Multiplication works almost exactly like adding another dimension to addition. To multiply 2 numbers together we once again need to break the process down. So in decimal 238x644 = 238x4+238x40+238x600. The same is true in binary except the whole thing is much easier because you are either multiplying by 1 or 0. So 101x110 breaks down to 101x0+101x10+101x100 simple. Once you realise this it is easy design the multiplication engine (rather harder to build)it is simply a series of addition engines or tiers where the A-line of each cell is either the A-number or 0 depending on the B-number and the B-line is the answer from the tier above (shifted 1 to the left so as to effectively multiply it by 10).<br />
Line 47: Line 90:
 
[[File:Multiplication2 copy.png|200px|]] [[File:Multiplication1.PNG|130px|]]  
 
[[File:Multiplication2 copy.png|200px|]] [[File:Multiplication1.PNG|130px|]]  
 
<br />
 
<br />
=== Division (binary) ===
+
==== Division (binary) ====
  
 
Division is where it gets absurd. It is somewhat like adding another dimension to subtraction, but more.  
 
Division is where it gets absurd. It is somewhat like adding another dimension to subtraction, but more.  
Line 54: Line 97:
 
[[File:devision3.PNG|200px|]][[File:devision1.PNG|200px|]][[File:devision2.PNG|200px|]]
 
[[File:devision3.PNG|200px|]][[File:devision1.PNG|200px|]][[File:devision2.PNG|200px|]]
  
=== Translation (Decimal to binary) ===
+
==== Translation (Decimal to Binary) ====
  
 
Actually very easy each input number simply needs to be broken down to its individual digits these digits are then translated to binary and added together. Looks like this.<br />
 
Actually very easy each input number simply needs to be broken down to its individual digits these digits are then translated to binary and added together. Looks like this.<br />
 
[[File:Decimal-binary.PNG|700px|]]
 
[[File:Decimal-binary.PNG|700px|]]
 +
 +
==== Translation (Binary to Decimal) ====
 +
 +
This is harder. For 3 reasons. First programing in decimal would be to absurdly complex even for this fort, so simply adding the numbers together is out. Second 999x999= a six digit number. Third for some god forsaken reason I was determined to make it accurate to 3 decimal places so I needed to build a separate engine capable of handling decimal places. The only way I could figure to make this work is for the engine to ask - is the answer larger than or equal to 900,000 (if yes subtract 900,000 from the answer and move to the 10,000's line) if no is the answer larger than or equal to 800,000 -- repeat until you reach - is the answer larger than 1. That is 54 operations. Do not try this at home.<br />
 +
 +
[[File:Binary-decimal2.PNG|100px]] [[File:Binary-decimal devision2.PNG|200px]] [[File:Binary-decimal devision3.PNG|500px]] [[File:Binary-decimal1-u.PNG|400px]] [[File:Binary-decimal-u-2.PNG|500px]]
 +
 +
=== Examples ===
 +
 +
[[File:80+523.PNG]][[File:364-420.PNG]][[File:482x724.PNG]][[File:562d64.PNG]]

Latest revision as of 09:21, 8 February 2016

Armok Invaders[edit]

I built Space invaders into Dwarf Fortress.

Armoc Invaders intro.png

It can be downloaded From here The map can be seen here You can see a video of a play-through here

I will update this with details of how I made the project as I have time.

Stats[edit]

This fort took 85000 mechanisms. It takes over 100,000 power at full drain. The main screen is 32x32 that makes it a 1 kilopixel display.

High Level Overview[edit]

Sorry this is so big

Invaders Overview.png

More Detail[edit]

KEY[edit]

Gear assembly Default position is engaged.png Gear assembly where the starting position is engaged

Gear assembly Default position is disengaged.png Gear assembly where the starting position is disengaged

PreasurePlateSwitch.png Pressure plate switch: the letter in the boxes indicates the type of switch C is Newton's Cradle S is Power to Signal. The Symbol in the dimond matches linked Items.

+/-1 Engine[edit]

+-1caption.png

+-1Description.png

The Almighty Dwarven Calculator[edit]

What can you do with 75,368 mechanisms and 40,000 power?
I have made a calculator. It can add, subtract, divide and multiply. It can take inputs of up to 999 and give answers of up to 999999 or 999.999.

7x191.PNG

See the map - [1]
Download the fort - [2] There are probably still several bugs, if you find one list it on the discussion page.

How to use[edit]

In the control house (shown above calculating 7x191) there 6 groups of levers each group corresponds to an input number, and each lever within a group corresponds to a number 0-9 (in the same pattern as on a cell phone, as shown below).

Teaching.png

Once the levers that represent the desired numbers have been pulled (only one lever per group or things will go wrong) then select the desired function (+ * - /) by pulling the indicated lever. The selected function will be displayed.

Then pull the equals lever, go and make a cup of tea, some soup perhaps compose a sonnet (it takes a long time even for simple equations).

Your answer will then be displayed in glorious digital numbers (many incorrect numbers will 'flash past' first once the numbers stop changing the answer will be correct [I think])

How it works[edit]

Addition (binary)[edit]

In essence what you need to do to make any computer work is to break the job down to its simplest possible functions. To that end all actual computation is done in binary.
This is the first 2 cells from the addition engine.
Addition cell 1&2.GIF
Each cell is designed to add a two or three binary digits together. The first cell adds 2 digits (that is one from each of the input numbers). When you add 2 binary digits together there are 4 possible ways for them to combine and 3 possible outcomes (0+0=0, 0+1=1, 1+0=1, 1+1=10), however an outcome of 0 does not change the answer so you do not need to build it (In the addition engine I did build it but I later disconnected it). So each input gets a line of mechanisms, A line and B line, since there are 3 important ways of combining the inputs each line has 3 mechanisms. levers are connected to some mechanisms so they can be 'flipped' and thereby each row made to represent one possible outcome. A screw-pump is then connected to each outcome which triggers a pressure-plate which triggers either the outcome or the C line of the next cell.
The second and all subsequent cells need to add a C line that is triggered when the answer of the previous cell is 10 or 11. And so there becomes 8 (7 important) ways for the digits to combine and 4 possible outcomes (3 important). But an all other ways cell 2-10 is the same as cell 1.
Addition cell b 1&2.GIF
And the whole addition engine looks like this
Addition.PNG

Subtraction (binary)[edit]

Subtraction works much the same as addition except that the A-line input is positive and the B-line and C-line inputs are negative. So the possible outcomes are (from a 3 line input) (in the order I put them in the engine) 1-0-0=01, 1-1-1=-11, 0-0-1=-11, 0-1-0=-11, 0-1-1=-10, 1-0-1=0, 1-1-0=0, 0-0-0=0. This has the advantage that there are 3 irrelevant outcomes in each cell so you only need to build 5 rows in each cell.
Subtraction engine.
Subtraction main.PNG
The one difficulty in subtraction is that the engine has no idea what a negative number is, so if you want the calculator to be able to give a negative response you need to teach it. My solution (possibly massively overcomplicated) was to build a 'which number is larger' engine and then tell the subtraction engine to subtract the smaller number from the larger. A 'which number is larger' engine is not easy. It is presented with 2 10 digit binary numbers A1-A10 & B1-B10 then asks: does 'A1=1 and B1=0' or does 'B1=1 n and A1=0' if the answer is yes to either, that will mean that one number is larger than the other. It will then send power to a set of screw-pumps that will then tell the main engine which number to subtract from which. If the answer is no to both then it will ask does 'A2=1 and B2=0' or does 'B2=1 n and A2=0', this repeats until it decided which number is larger or that they are the same. I am sure there are better ways of doing this but I was to tired at the time to think of them.
Which number is larger.PNG

Multiplication (binary)[edit]

Multiplication works almost exactly like adding another dimension to addition. To multiply 2 numbers together we once again need to break the process down. So in decimal 238x644 = 238x4+238x40+238x600. The same is true in binary except the whole thing is much easier because you are either multiplying by 1 or 0. So 101x110 breaks down to 101x0+101x10+101x100 simple. Once you realise this it is easy design the multiplication engine (rather harder to build)it is simply a series of addition engines or tiers where the A-line of each cell is either the A-number or 0 depending on the B-number and the B-line is the answer from the tier above (shifted 1 to the left so as to effectively multiply it by 10).

Multiplication2 copy.png Multiplication1.PNG

Division (binary)[edit]

Division is where it gets absurd. It is somewhat like adding another dimension to subtraction, but more. When you do long division by hand you break down the operation into small simple divisions. First you divide the first digit of the dividend by the divisor, you put the answer in the answer line and add any remainder to the remaining digits of the divisor. You then repeat this operation until there is no remaining dividend or you reach the desired number of decimal places. Again the nature of binary makes this very simple if the divisor is smaller, then the answer line gets a 1 and the divisor is subtracted from the segment of the dividend it was being compared to. If the divisor is larger then the answer line gets a 0 and the operation moves on one step. In dwarven engineering terms it looks like this.

Devision3.PNGDevision1.PNGDevision2.PNG

Translation (Decimal to Binary)[edit]

Actually very easy each input number simply needs to be broken down to its individual digits these digits are then translated to binary and added together. Looks like this.
Decimal-binary.PNG

Translation (Binary to Decimal)[edit]

This is harder. For 3 reasons. First programing in decimal would be to absurdly complex even for this fort, so simply adding the numbers together is out. Second 999x999= a six digit number. Third for some god forsaken reason I was determined to make it accurate to 3 decimal places so I needed to build a separate engine capable of handling decimal places. The only way I could figure to make this work is for the engine to ask - is the answer larger than or equal to 900,000 (if yes subtract 900,000 from the answer and move to the 10,000's line) if no is the answer larger than or equal to 800,000 -- repeat until you reach - is the answer larger than 1. That is 54 operations. Do not try this at home.

Binary-decimal2.PNG Binary-decimal devision2.PNG Binary-decimal devision3.PNG Binary-decimal1-u.PNG Binary-decimal-u-2.PNG

Examples[edit]

80+523.PNG364-420.PNG482x724.PNG562d64.PNG