Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: Tiny_Puppy_Smasher on August 26, 2010, 05:20:16 pm

Title: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 26, 2010, 05:20:16 pm
Expedition Leader: "You there! Architect! Fetch your planning tablet. I want this to be the most glorious fortress in our kingdom."
Urist McArchitect: "Aye, sir. Let us plan our entrance, and our dining hall, and our apartments, and our..."

Many hour pass...

Expedition Leader: "Ah! Excellent! This is truly the greatest design in Dwarven history!"
Urist McArchitect: "I agree. Now that you've planned it, though, it's time for you to go tell the dwarves where to dig."
Expedition Leader: "What? No, no, no, that's for you to do. You're the architect, after all."
Urist McArchitect: "Sorry, that's not in my job description."
Expedition Leader cancels designate fortress, strangling Urist McArchitect

-----

Dwarf Fortress, for all of its amazing qualities, has a very cumbersome UI. And as anyone who has ever tried making a fortress more complex than a square with some tables in it, you know that designating large and elaborate fortress is an incredibly time-consuming and frustrating task.
There are two ways around this frustration:
1) Use the mouse. While it does give more control, the mouse is very finicky.
2) Use macros and use a template. This is easier, but you still have to designate the fortress in the first place to record your macro.
Neither of the solutions are ideal, because they both require you to exert at least some small amount of effort. I've decided that this is simply unacceptable.

Enter Dwarf Fortress Architect, a small and very simple yet extremely powerful Java application I've written that designates your fortress for you while you sit there and watch.

It loads a bitmap image that you or someone else creates in their favorite graphics editing program and extracts color information from the pixels. It then parses that information into commands for the program to execute -- commands that just so happen to correlate with keyboard shortcuts in Dwarf Fortress. Do you see where I'm going with this?

I made this Bitmap in Photoshop:
(http://i36.tinypic.com/2igdie1.jpg)
This image is enlarged. The true size is 29X29 -- Less than 3KB.

I then loaded it into DF Architect and pressed the "Designate" button.
In a matter of seconds, I had this:
(http://i35.tinypic.com/352g86r.jpg)

Magic!
(Not really. It's just Java.)

With DF Architect, you can design your dream fortress and then share it with your friends. Just upload the bitmap image to an image hosting site (one that doesn't convert to jpeg -- that will ruin your design and it won't work), then send them the link and they can download and create it.

Version 0.2 now available! See what's new in my post on page 2 here: http://www.bay12forums.com/smf/index.php?topic=64723.msg1523605#msg1523605

Dwarf Fortress Architect is available for the extremely reasonable price of free. You can purchase it here:
<Link temporarily removed>

Please make sure to read the readme, as the program is in its earliest of early stages and is not very forgiving of mistakes in the operating procedure at the moment. (That is an understatement.)
It will tell you how to operate it. The procedure is a bit bizarre and arbitrary at first, but it's not difficult at all.
This is the first program I've ever seen through to fruition. It's also the first program I've ever given to somebody else to run. This whole thing could potentially be the biggest flop in the history of mankind. BUT I'M WILLING TO TAKE THAT RISK.
I'm not exactly a master-coder -- I'm mostly self-taught. There are likely to be bugs. Post in this thread and I'll get around to fixing them as time permits. (But seeing as how classes start Monday, time may not permit much.  ;D)

Readme is here if you are so inclined:
Spoiler (click to show/hide)

DF Architect was written in Java and requires the latest Java Runtime Environment to execute. Extract and double-click the JAR file to start it. I've included 3 example files: An example on using indeces (see the readme), the example I used above, and a twisty-bendy little hallway.
This should work on both PC and Mac, and there is (theoretically) no limit on the size of the design that you can create to be designated by the tool. Every pixel is one square in game. A 29x29 bitmap results in a 29x29 grid-size fortress (provided you designate the whole area).
Currently, you can't designate multiple-z-level fortresses in one pass. It's still easy to do with clever use of indeces, but I'll work on a way to get it into the program without over-engineering a solution. Ideas are welcome if you have them.

Oh, and this is my first post. Hello Dwarf Fortress community!  :D
I hope this is the right forum... Modding, yes?
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Eagle_eye on August 26, 2010, 05:24:54 pm
I think there's already a similar add on for quickfort that does this, but this seems to be a bit simpler to use. very nice :D
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Untelligent on August 26, 2010, 06:26:29 pm
Now if only there were some way to tell your dwarves which tiles to dig first...
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: darius on August 26, 2010, 08:09:56 pm
Very nice. Only one suggestion: use http://dffd.wimbli.com/ for df related files. It's free, painless and has neat features.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: i2amroy on August 27, 2010, 03:37:55 am
I would love to download it and it looks awesome but filedropper isn't allowed on my network. :'( Please transfer it over to dffd!
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Dbuhos on August 27, 2010, 04:44:29 am
Now that's pretty interesting. I'll probably give it a try. :)
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: orbcontrolled on August 27, 2010, 08:06:27 am
Anything that can replace two utilities with one is good, and the index feature alone could make this better than quickfort.

Criticisms though:

-There should be a way to exit the program at any time, either a hotkey, or the red X on the GUI. Haven't you ever read the Sorcerers Apprentice? Never build anything without an "off" button! (This is especially true because the task can't even be killed without keyboard/mouse control)
-A Pause hotkey too.
-It doesn't designate as efficiently as quickfort. At the very least, it fails to skip empty lines. You should look at the quickfort code and do at least as much optimization as that.
-Alternatively, if DFHack can be made to work across languages (I don't know how big an "if" that is), use it to write the designations to DF immediately, and lose all the weaknesses of manual designation.

Currently, you can't designate multiple-z-level fortresses in one pass. It's still easy to do with clever use of indeces, but I'll work on a way to get it into the program without over-engineering a solution. Ideas are welcome if you have them.

The simplest way would be one of those list boxes with arrows to move items up or down in it. If you want to be fancy, you could also have the program check if the file is an animated GIF, and then make each frame a level.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 27, 2010, 11:08:54 am
Anything that can replace two utilities with one is good, and the index feature alone could make this better than quickfort.

Criticisms though:

-There should be a way to exit the program at any time, either a hotkey, or the red X on the GUI. Haven't you ever read the Sorcerers Apprentice? Never build anything without an "off" button! (This is especially true because the task can't even be killed without keyboard/mouse control)
-A Pause hotkey too.
-It doesn't designate as efficiently as quickfort. At the very least, it fails to skip empty lines. You should look at the quickfort code and do at least as much optimization as that.
-Alternatively, if DFHack can be made to work across languages (I don't know how big an "if" that is), use it to write the designations to DF immediately, and lose all the weaknesses of manual designation.

Currently, you can't designate multiple-z-level fortresses in one pass. It's still easy to do with clever use of indeces, but I'll work on a way to get it into the program without over-engineering a solution. Ideas are welcome if you have them.

The simplest way would be one of those list boxes with arrows to move items up or down in it. If you want to be fancy, you could also have the program check if the file is an animated GIF, and then make each frame a level.

I've thought thoroughly about all the things you've criticized as I wrote the program, and I'll be working on them. I really just wanted to get it out there as a proof of concept to see what the response to something like this would be.
Optimization is a major goal. At the very least, I'll make it to where it can designate rows of designations without hitting "enter" every tile.
However, the Java robot is very fast in execution. I'm artificially slowing it down, because it goes so quick that Dwarf Fortress can't keep up. The maximum speed at which it can move very much depends on how fast your computer is, and in turn how fast DF can process the key input. I should make it an option to change...

I believe DFHack is written in C, which would make cross-compatibility tough.

Also, the GIF thing is an interesting idea. Animated GIFs are tough to make, though, which defeats the purpose of having a very simple tool.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: hSaxon on August 27, 2010, 12:03:48 pm
How about doing multiple levels with multiple images? Say you ask the program to use coolFort.bmp, this program looks in the same folder for coolFort001.bmp and uses that one level down, coolFort002.bmp etc.
Also hi, first post.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: gtmattz on August 27, 2010, 12:19:06 pm
Now if only there were some way to tell your dwarves which tiles to dig first...

I think that one could work this by having multiple templates for the various stages of digging so as to excavate the area in the best manner for the situation.  Apply one template, let the dwarves dig it out, then apply the next stage and let them at it, etc.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: [NO_THOUGHT] on August 28, 2010, 04:22:11 pm
For those of you who want to try this out, I have recolored the amazing fractal design Raynard from the df wiki that I have tried several times to designate by hand but failed miserably  :P

It's here
(http://www1.picturepush.com/photo/a/4083899/640/4083899.bmp) (http://picturepush.com/public/4083899)
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Still Standing on August 28, 2010, 04:51:32 pm
For those of you who want to try this out, I have recolored the amazing fractal design Raynard from the df wiki that I have tried several times to designate by hand but failed miserably  :P

It's here
(http://www1.picturepush.com/photo/a/4083899/640/4083899.bmp) (http://picturepush.com/public/4083899)

I made that exact same one into a Quickfort file.  xD
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Randomtask on August 28, 2010, 05:18:49 pm
Mad props to you and this utility, good sir.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 28, 2010, 06:45:38 pm
I've been playing around with different designation methods to make it more efficient -- One grid-based one and one a slight modification of the list-system I'm using now. They were both complete failures. (I fail at math. -_-)
I think I'll just try optimizing what I have now instead of changing my mind over and over as to how I'm going to go about this. Currently I've gotten to where I can designate rows very very quickly, and it works 9 times out of 10. But sometimes it explodes -- I have no idea why. I'm working on it. I think it has something to do with the index, and that's a very important feature.

I'll get an update out soon once I figure it out.

Edit: Also, once I tried testing that large file only to have a very important IM pop up in the middle, I quickly realized the importance of having an "Abort" function. Optimization is no longer a top priority.  :P
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Randomtask on August 29, 2010, 10:52:36 am
So, I checked around in the thread and readme, but I couldn't see anything about this.

Is there a way to stop Architect? I plopped down that huuuuge fractal design, and halfway through, I realized I'd put my cursor two or three spaces down and to the right.

I wanted to stop it, go back and redesignate, but I realized with some minor horror, that I had no idea how to stop it.

Also, I think today I will try my hand at making a few designs I find myself often using.
Maybe.
If the wife doesn't decide she wants to try taming the unicorns we found on my map.  ::)
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 29, 2010, 11:58:15 am
So, I checked around in the thread and readme, but I couldn't see anything about this.

Is there a way to stop Architect? I plopped down that huuuuge fractal design, and halfway through, I realized I'd put my cursor two or three spaces down and to the right.

I wanted to stop it, go back and redesignate, but I realized with some minor horror, that I had no idea how to stop it.

Also, I think today I will try my hand at making a few designs I find myself often using.
Maybe.
If the wife doesn't decide she wants to try taming the unicorns we found on my map.  ::)

Hah, I did the same thing. Lack of an abort was a major design oversight. I'm working on a remedy.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Randomtask on August 29, 2010, 12:30:00 pm
Awesome, glad to know I wasn't just completely missing something.

Additionally, I added a zip to dffd: http://dffd.wimbli.com/file.php?id=3018 (http://dffd.wimbli.com/file.php?id=3018)

It's these:
Spoiler (click to show/hide)

First content I've ever uploaded for Dwarf Fortress, so I hope someone finds it useful.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 29, 2010, 01:15:36 pm
It should abort properly now. (I can't believe my solution worked, but it does.)
Depending on the complexity of the design, it should now designate anywhere from 2 to 5 times more quickly.

There's a few minor bugs I'm still squashing, but I should have a new release out later today.

Edit: Random, those are JPEG images. Provided that the pixels you want to dig remain 0,0,0 black, it should still work, but JPEG introduces noise artifacts that could potentially break the algorithm. It will ignore them for the most part, but if noise is introduced that alters the black to something other than 0,0,0 or if noise has an RGB value that corresponds to a designation type, your script will be corrupted.

It's better to use BMP images.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Randomtask on August 29, 2010, 02:13:48 pm
It should abort properly now. (I can't believe my solution worked, but it does.)
Depending on the complexity of the design, it should now designate anywhere from 2 to 5 times more quickly.

There's a few minor bugs I'm still squashing, but I should have a new release out later today.

Edit: Random, those are JPEG images. Provided that the pixels you want to dig remain 0,0,0 black, it should still work, but JPEG introduces noise artifacts that could potentially break the algorithm. It will ignore them for the most part, but if noise is introduced that alters the black to something other than 0,0,0 or if noise has an RGB value that corresponds to a designation type, your script will be corrupted.

It's better to use BMP images.

They just uploaded to photobucket like that. The zip on DFFD has BMPs. I was just throwing them up there to show what they look like.

But I'll see if I can change them anyway, because people will probably try to download them individually.

Edit: Yeah, photobucket automatically converts them. But the zip is still correct.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Roughshot on August 29, 2010, 04:03:48 pm
Hi, I'm trying out your program for the first time today and was wondering what you use to make the BMP images you're uploading.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 29, 2010, 04:15:06 pm
Hi, I'm trying out your program for the first time today and was wondering what you use to make the BMP images you're uploading.

Personally I'm using Photoshop. I realize most people don't have that, though.

Paint (installed by default in Windows) can use the pencil tool and save to 24-bit BMP.
Gimp is free and can do the same thing, with a bit more control.
Paint.net should be able to save bitmaps, but I've personally never tried it.

Any program that you can zoom up close and paint single pixels at a time will work.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Randomtask on August 29, 2010, 04:19:17 pm
When I decided to give this a go, I downloaded Pixelformer.

It's free, and kind of like photoshop geared towards BMPs.

Can be a little complicated to use if you aren't computer savvy, though.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Tiny_Puppy_Smasher on August 29, 2010, 04:44:58 pm
Scratch that. New problem -- Works perfectly from inside the IDE, doesn't work when exported. Sorry for the technical difficulties...
Working on it.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: [NO_THOUGHT] on August 30, 2010, 09:45:49 am
Do we have a place where these designs can be uploaded and viewed? I say this because as people start converting designs for this, it's much easier to just load it to a website that lets you see the design then download, then having to download to see the design. And there is a TON of possibilities for this amazing program (as seen by the huge fractal design now in my fortress [after 3 retries, one where I designated too close to the map and two where I moved the mouse right at the beginning of designation and had to watch in horror as it proceeded to close, shift, and mess with every window I tried to use, including task manager!])
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Still Standing on August 30, 2010, 04:50:22 pm
Pretty sure you could make a page on the wiki and post the images on there.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: [NO_THOUGHT] on August 30, 2010, 10:38:24 pm
Great idea, I've added an entry into the Utilities section and will perhaps make a new DF Architect specific page to link to instead of this thread, but it will have to do for now.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Bharani on September 06, 2010, 10:17:19 pm
Great utility. Had a fun time going through the bedroom design page and modifying the images to work with Architect. It's what I've always wanted!
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Morwaul on September 11, 2010, 07:24:05 pm
Uhm, where do I go to download this?  The link to dffd just gives me a file with some housing bmps.....
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Lofn on September 12, 2010, 12:01:23 am
Any particular reason the link's been removed?
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Morwaul on September 14, 2010, 07:53:07 pm
Ok, So, with Google and a little persistence I was able to find the download.  It is below if anyone needs this.

http://dffd.wimbli.com/file.php?id=3004

I am having a problem with it however.  Whenever I Designate it sometimes starts from my index location and it sometimes starts from one square below (down from) my index location.  Sure makes lining things up difficult.  I am wondering if I am doing something wrong...Is there a special order I need do do things in other than the obvious?  Some God of aligned staircases I should be praying to?

Anyway, Thanks for a very helpful program.  Even if I have to Start and Stop it 4 or 5 times it is still faster than drawing everything over and over again.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: soundandfury on September 21, 2010, 01:34:33 am
*sigh* I suppose that means people will want another export format from DF Designer, then. ;)
Would there be any interest in that?  Are any of you DFDesigner users?
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Autochton on September 23, 2010, 02:34:14 am
*raises hand* Yeah, me. :) I'd like to use DFArchitect, but I've done most of my design work with DFD. I R n00b, though, so don't do it just for me. :)
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: PLANKS on November 17, 2010, 05:48:13 pm

I am having a problem with it however.  Whenever I Designate it sometimes starts from my index location and it sometimes starts from one square below (down from) my index location.  Sure makes lining things up difficult.  I am wondering if I am doing something wrong...Is there a special order I need do do things in other than the obvious?  Some God of aligned staircases I should be praying to?

Im also getting the same problem.. can be very anoying as im trying to designate a large area repetedly.

Otherwise its been great so far thanks for all the hard work Tiny_Puppy_Smasher

:D :D :D
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: dennislp3 on November 17, 2010, 10:24:08 pm
Im retarded and am totally curious as to how one makes bitmaps like that with photoshop (GIMP in my case) or any other utility....anyone got a link to a newb tutorial or something?
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: zwei on December 03, 2010, 04:27:25 pm
Huh, is this project abandoned?

If it is, good news everyone! I implemented my own clone before bothering to search the forums: it has even faster designations (50 seconds vs 6 minutes per layer on my test pattern) and supports multiple layers.

See here: http://df.zweistein.cz/pub/designator_1_5.zip

Put relevant bluerints to same directory as designator, run designator.cmd, alt-tab to dwarf fortress, see magic happen.

Blueprint colors are:

Black - dig
Blue - down stair
Red - up stair
Mangeta - up/down stair
Cyan - channel.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Kali on December 11, 2010, 11:54:03 pm
I liked how this thing worked, and wanted to see how far you can push it, so I messed around a little in zwei's source code, I hope you don't mind:)

What I did:

- Added support for that index tile, it is quite handy
- Fixed up allignment issues
- Added some support for using the same image accross multiple z-levels, to quickly build a central staircase for example
- Added support for building furniture/walls/fortifications/floors/...
- Added a configuration file where you can add new designation/items/change colors
- Wrote a small manual document

http://wina2.ugent.be/~karel/DF Designator.zip (http://wina2.ugent.be/~karel/DF Designator.zip)

Edit: cleaned up code
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: zwei on December 13, 2010, 09:58:13 am
I liked how this thing worked, and wanted to see how far you can push it, so I messed around a little in zwei's source code, I hope you don't mind:)

I don't mind at all (well, i would have coded it differently, but that is not important). Whole point of adding source is to allow others peek at it/modify/improve it. :)
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Kali on December 13, 2010, 12:43:59 pm
I would have coded it differently as well, I just hacked it together and DesignationRobot is quite the mess now. I would love someone to modify/improve it as you so excellently put it.
Title: Re: DF Architect -- Build your dream fortress with zero effort
Post by: Scaraban on December 16, 2010, 06:17:49 pm
like  the tool