Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4 5 ... 19

Author Topic: DF to Minecraft utility  (Read 153542 times)

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DF to Minecraft utility
« Reply #30 on: August 24, 2010, 03:12:38 pm »

Wow - Impressive fortress Japa!

This program works by converting each square in Dwarf Fortress into a NxNxN group of cubes in Minecraft.
It first reads the tile type (floor, wall, ramp, tree, shrub, etc.) and material (stone/dirt type - marble, slate, obsidian, etc. - or for constructions the type (bar/block/log) and specific material), does a look up into the xml file for the conversion, and writes those blocks into the minecraft map it is building in memory.
Then it reads the building that is there (if one is there), does a look up for the conversion, and writes those blocks ONLY into air blocks - it won't overwrite non-air blocks.
Then it looks if the block has some liquid - water or magma - and does a look up to convert that level of liquid into minecraft blocks - and again will only write those blocks into air/empty blocks. This is so that a mined out area with a workshop that is flooded will still have the floor and workshop there, with the water filling the remaining air spaces
Finally, if the area is 'Dark', 'Inside', or 'Subterranean', and not covered with spatter (mostly for muddy caverns, which should remain dark) there is a chance a torch will be added to the location. This is the only random part of the conversion.  Without torches being added, the insides of fortresses would be completely dark in Minecraft, but adding a torch to the floor tile by default would make outside areas and caves have torches when they shouldn't.

As for part of the map being 'cut off' - that is somewhat intentional, but controllable.  The top of the settings file contains settings for limiting the area of the map output.  While testing, I found that larger maps caused Minecraft Indev to crash.  The Indev applet is limited to 256MB of ram, and maps larger than 512x512x128 seems to cause it to use too much memory.
In DF, each 'box' in the embark screen seems to be 48x48 by ? layers tall, or 3x3 'blocks; of 16x16 squares, which translates to 144x144 minecraft blocks. So you can output a bit larger than a 3x3 embark area without issue in my experience.
Additionally, using the default settings file which converts each square to a 3x3x3 group of cubes, you can get 42 layers output. The default setting is to find the top (largest Z) 39 interesting layers, and 3 empty air layers above them. 'Interesting' is defined as layers that have a floor, ramp, ramp top, pillar or fortification. Layers of just walls or stairs are discarded. The purpose of this is to 'compress' those tall stairs to the caves, raising the caves closer to the surface, so that they can be explored in minecraft. I all of my test fortresses, the first level of caves can be fully explored, and one of the test fortresses, a second layer of caves can be partially explored before the bottom of the minecaft level.

Choosing the spawn point from the cursor position is a good idea, and I'll hopefully have it implemented this weekend.  I'll have to check that it is in the area being output, and use the center anyway if it isn't, but it sounds like a good solution to that problem.  Hopefully I understand enough about how the spawn point is saved to safely place the spawn in a mined out area without placing you in a wall or floor (which did happen at one point in early testing).

G-Flex:
As stated above, each square in minecraft is converted to a NxNxN group of cubes. The size of N and the conversion for the DF location to the MC group of cubes is stores in a settings.xml file.  The default file has N set at 3, wich is the smallest practical value.
That is the bottom layer of cubes represents the floor, and then two layers of cubes for air 'walking space' (you are 2 cubes high in minecraft), or that will be filled in if the wall hasn't been mined out yet. Workshops and other items also have to fill this 2 cube high space (hence the road problem for indoor roads [I never considered building roads indoors, only outside to prevent trees from growing and blocking access to the Depot]).
Other sizes besides 3x3x3 are possible (but untested as of yet). 4x4x4 would fix the indoor road problem, as you could have 1 layer for the floor and 3 of air, so the 1/2 high road tile would still leave room to walk. A 5x5x5 conversion would also be interesting as you could do 2 layers for floor and 3 of air, allowing you to use sand or gravel tiles in the floor (for sand / sandy loam, etc) without the sand falling by having a layer of dirt under it (sand and gravel fall in Minecraft, most other tiles will 'float' unsupported). 5x5x5 could also solve the 'diagonal problem' (strictly diagonal hallways are passable in DF, but not once converted), by cutting off the 4 corners of a wall, without that wall then looking like a pillar or a support.

For those of you wondering about the 'floating' torches in the image - I use torches to indicate the outlines of piles in DF (all defined and changeable in the settings file). apparently piles were either defined to pass through the boundaries of the levels there, or the piles were define and the floor/walls mined out after.  There is one bug that I noticed in the current version - DFHack reports piles along with buildings. But because of the way there are defined (only top left and bottom right corner supplied), it is possible to have a pile and a normal building overlap, either from having a building and defining a pile over/around it, or by have a pile, un-designating part (corner) of it, and then building a workshop / other building  there.  I have a fix for this which made piles not show on a particular square if an actual building is also in that location.

I'm going to more some more on this, adding the spawn fix, and hopefully getting plant types in (so that tower-cap trees don't look like above ground trees) and get a new release out this weekend.  From there is it work on the lighting calculation (no idea how to do - probably will need to look at code of some minecraft level editors), or work on start on the Minecraft Alpah file save routine (which will need the proper lighting calculation eventually as it is stored as a separate field in Alaph). And maybe get to finishing Starcraft's campaign, which I put on hold to do this project ;)
Logged
DF2MC -> Convert DF Maps to Minecraft Levels so you can use Minecraft as a 3D visualizer for Dwarf Fortress
DF2MC - The cause of 15+ head explosions and counting!

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DF to Minecraft utility
« Reply #31 on: August 24, 2010, 03:15:22 pm »

I really want to try this, but whenever I run it, it crashes on layer 133/147. Any idea what could be causing this?

I'm not sure what could be causing that.  Do you get any particular error message?

If you could post your fortress save (just zip the whole region folder and post it somewhere, and reply with a link), I could download it and run a conversion in the debugger and see what is going wrong.
Logged
DF2MC -> Convert DF Maps to Minecraft Levels so you can use Minecraft as a 3D visualizer for Dwarf Fortress
DF2MC - The cause of 15+ head explosions and counting!

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: DF to Minecraft utility
« Reply #32 on: August 25, 2010, 02:55:11 am »

As for the lighting calculation problem, all the indev map editors had exactly the same problem. Was annoying when messing around with the forestry tree generator. Alpha has it's own lighting problems with edited maps, lighting simply isn't recalculated until you place a source of light in each edited chunk. Turning the sea to lava and it gave off no light. Luckily Notch is all for people making their own level generators and plans to support it officially.

I've already mentioned this but I'll ask a direct question. How easy would it be to get this converting 40d maps? I'm sure plenty would be interested in seeing some of the great old forts.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

This is not a link

Mala

  • Bay Watcher
  • Spoopy time!
    • View Profile
Re: DF to Minecraft utility
« Reply #33 on: August 25, 2010, 06:11:05 am »

I've already mentioned this but I'll ask a direct question. How easy would it be to get this converting 40d maps? I'm sure plenty would be interested in seeing some of the great old forts.

it would be quite a bit of work, as the two versions are very different.
Logged

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DF to Minecraft utility
« Reply #34 on: August 25, 2010, 11:38:29 am »

I've already mentioned this but I'll ask a direct question. How easy would it be to get this converting 40d maps? I'm sure plenty would be interested in seeing some of the great old forts.

To me, I don't think supporting 40d would be much work at all (it may work now).

I talk to DFHack. DFHack reads from DF's memory and tells me what is there.

I believe with the correct Memory.xml file (which tells DFHack where in DF's memory different things are kept), it could work.

So you need to grab a memory.xml file file the 40d version, or possibly a DFHack.dll for 40d as well, and replace the ones I provide.

I haven't tested this yet, though, so use at your own risk. 


As for Lighting, NBT Forge has a light calculation option. It isn't perfect (leaves, flowers and other similar blocks aren't treated as transparent), but most of the outside and inside would be lit initially.
Logged
DF2MC -> Convert DF Maps to Minecraft Levels so you can use Minecraft as a 3D visualizer for Dwarf Fortress
DF2MC - The cause of 15+ head explosions and counting!

Mala

  • Bay Watcher
  • Spoopy time!
    • View Profile
Re: DF to Minecraft utility
« Reply #35 on: August 25, 2010, 11:42:32 am »

actually, that won't work. you would have to build against an entireley different version of DFhack to read the older versions.
Logged

iceball3

  • Bay Watcher
  • Miaou~
    • View Profile
    • My DA
Re: DF to Minecraft utility
« Reply #36 on: August 25, 2010, 11:53:35 am »

so you can't reach hfs in the conersion? aww dang :-[

lordnincompoop

  • Bay Watcher
  • Allusionist
    • View Profile
Re: DF to Minecraft utility
« Reply #37 on: August 25, 2010, 01:55:01 pm »

actually, that won't work. you would have to build against an entireley different version of DFhack to read the older versions.
Well dangit.
Logged

Kirk

  • Bay Watcher
  • INTERNET WIZARD
    • View Profile
    • Black Rock Productions
Re: DF to Minecraft utility
« Reply #38 on: August 25, 2010, 01:59:18 pm »

Whenever I run it I get this error.

"The program can't start because MSVCP100.dll was missing from your computer. Try reinstalling the program to fix this problem."

I'm running Windows 7 64-bit.
Logged

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: DF to Minecraft utility
« Reply #39 on: August 25, 2010, 02:57:23 pm »

I had that problem too, after a bit of research I just discovered I don't have the newest Microsoft C++ stuffs.

http://www.microsoft.com/downloads/details.aspx?FamilyID=a7b7a05e-6de6-4d3a-a423-37bf0912db84&displaylang=en

P.S. I'm 32 bit Vista though, so I'm not quite sure if that is the exact version you want, and don't quite know how to tell.  But that's in the right direction at least.


EDIT2 I origonally linked the 2008 one, you want 2010.  Damn similar downloads...
« Last Edit: August 25, 2010, 03:02:43 pm by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Retro

  • Bay Watcher
  • o7
    • View Profile
Re: DF to Minecraft utility
« Reply #40 on: August 27, 2010, 07:36:06 am »

This looks pretty cool and I'd like to properly try it out, but can't because I keep getting spawned in the magma sea and dying for some reason. Or at least, that's what's happening as far as I can tell. All I can make out is fire in every direction. I'm new to Minecraft, just messing around with it to try this out, can anyone help me out a bit? Not really sure what's going on.

Mala

  • Bay Watcher
  • Spoopy time!
    • View Profile
Re: DF to Minecraft utility
« Reply #41 on: August 27, 2010, 07:59:09 am »

if your trying to convert skyscrapes, you have to floor off the center of the top of the tower, because that's where it spawns you.
Logged

khainegom

  • Escaped Lunatic
    • View Profile
Re: DF to Minecraft utility
« Reply #42 on: August 27, 2010, 11:56:26 am »

Now what we need is something to convert an entire DF world into infdev...
Logged

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DF to Minecraft utility
« Reply #43 on: August 29, 2010, 06:48:46 pm »

Ok, new version has been uploaded:

http://github.com/TroZ/DF2MC/downloads

New features:
You can set the spawn point by placing the DF cursor in the world ('k', 'q', 'v', etc. modes that use the yellow X cursor).
Vegetation now comes in various forms.  All plants are 'unique' (but some use blocks only available in Alpha currently), all underground 'trees' are unique, and  about 1/2 of above ground trees have specific shapes.
Smoothed stone walls and floors now use the 'double 1/2 step' block.  I'm not sure how to detect engravings yet though.
More buildings supported, several received fixes
SUPPORT FOR 40D!

There is now a separate .exe and source code file for 40d.  I've only tested one fortress (one of mine), but it seems to work well enough.
There are two know issues with it currently: 1. I'm not sure how to tell constructions or buildings made from stone blocks from ones made with raw stone. 2. For some reason, wells don't show up, you just have a hole in the floor. 
On the plus side, I can get the fortress name, so the save file is now named <fortressname>.mclevel, so doing conversions for different fortresses will not overwrite each other.


I'm going to take a break for a few days, then fix any bugs that people find, and get on the next major feature.
I need to decide what the next major feature is.  Should I next attempt to add directions to buildings such as beds and chairs, so that chairs are facing the nearest table, or if there is not table, away from the wall, and similar for beds, so that the headboard is against nearby walls (currently everything only has one direction, facing north). Or should I attempt to start work on Minecraft Alpha save file output which would allow outputting the full level (at least horizontally) and allow use of all the recently added blocks.
Alpha support would be really cool, but would also be a lot of work, even if I can borrow code from one of the open source Minecraft level editor projects.


Well, try out this new version and tell me what you think. Report any bugs here or on the github site's issue tracker. And it you want to help out, download the code and I appreciate and help you can give!
Logged
DF2MC -> Convert DF Maps to Minecraft Levels so you can use Minecraft as a 3D visualizer for Dwarf Fortress
DF2MC - The cause of 15+ head explosions and counting!

Mala

  • Bay Watcher
  • Spoopy time!
    • View Profile
Re: DF to Minecraft utility
« Reply #44 on: August 29, 2010, 08:21:38 pm »

I'd say work on alpha levels. it'd be more work, but far more worth it.
Logged
Pages: 1 2 [3] 4 5 ... 19