Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 11 12 [13] 14 15 ... 108

Author Topic: DFHack 0.5.15 (legacy)  (Read 391915 times)

omglazers

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #180 on: August 08, 2010, 10:38:30 pm »

Creating 'Rivers'.. is it possible?

Is there any way to create a water source 'tile' ? Similar to how streams and rivers create water at one edge of the map in a tile which then flows forward and off the map at another point.

I am looking to widen the river or create underground water sources and a similar source would be nice.

DF liquids allows me to create blocks and levels of liquids but not flowing rivers [say, to power water wheels!]
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #181 on: August 09, 2010, 01:48:17 am »

Actually, it is possible to create a river source. There is a tiletype that generates water. You run into the sometimes, it will be listed as a "spring" or something and it will look kind of like a spider web. Usually they are up in the mountains, so you would have to use embark anywhere to find one.

Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

Reverb

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #182 on: August 09, 2010, 03:28:26 pm »

Can someone shed some knowledge on accessing item data such as container contents and whether the item has been built, being traded, brought in to trade, carried, dumped, etc? I'm mostly just interested in how to access what a container is holding.

UPDATE: I couldn't find anything on container contents so I had to poke around with the disassembler.
Let me set up an example. Items all are assigned ids which are at offset 0x14 or p->readDWord(p_item + 0x14). I read where this was a long http://df.magmawiki.com/index.php/User:Rick/Memory_research but in the assembly used in the container code, it looks to be a signed integer but in this code I'll use an unsigned int.
I found the offsets for finding a containers contents and they can be accessed with the following code:
Code: [Select]
vector<uint32_t> items;

uint32_t start = p->readDWord(p_item[i] + 0x3C);
uint32_t end = p->readDWord(p_item[i] + 0x40);

for (uint32_t curAddr = start; curAddr < end; curAddr += 4) {
uint32_t contentAddr = p->readDWord(curAddr);
uint32_t itemID = p->readDWord(contentAddr + 4);
items.push_back(itemID);
}


Anyways back to the example. I have bin with id=10 which I'll denote bin(10) and it contains 3 items: hat(11), shirt(12), and pants(13). So bin(10) would generate a vector containing {11, 12, 13} and hat(11), shirt(12), pants(13) would all generate a vector containing {10}.

Also I found the flags I needed at DFHack::t_itemflags. Not sure which correspond to trading yet or some of the other flags I wanted but I'll update if I pursue those issue.
Hope this will be of help to others. All the above works in DF v0.31.12
« Last Edit: August 15, 2010, 01:01:25 pm by Reverb »
Logged

mLegion

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #183 on: August 09, 2010, 05:57:38 pm »

Wouldn't making a water source just be a matter of finding the relevant bits that determine whether or not a tile is part of an aquifer? I thought that was what the 'water_table' bits where for? Or is whether or not a tile is part of an aquifer determined by the biome/geolayer?

edit: yes,  does seem to determine whether or not a tile is an aquifer, also appears to have something to do with whether or not a tile is 'damp'.
edit 2: The water_table bit marks a tile as damp. The tiletype for 'river source' is 90 and 'waterfall' is 89, waterfall tiles also act as mistgenerators.

Also does anyone have the slightest clue what needs to be edited to make a tile farmable? Nothing i change seems to make a tile able to be used for surface crops. The one time i managed it was by changing the biome/geolayer/tiletype of a natural rock area to soil and setting it to inside light above ground and then mining it out, the resulting floor was farmable, but making it from scratch just hasn't been working even if I get every blockflag identical to a working patch of soil. Is there some 'can_farm' bit that i overlooked?
« Last Edit: August 10, 2010, 06:35:27 pm by mLegion »
Logged

Kaelem Gaen

  • Bay Watcher
  • And then it appeared the most terrifying creature
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #184 on: August 11, 2010, 12:48:48 am »

Probably a stupid question, but how exactly does DFvdig  work?  does it set all tiles for the vein reveled and hidden? or just revealed?

Askot Bokbondeler

  • Bay Watcher
  • please line up orderly
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #185 on: August 11, 2010, 01:59:49 am »

it designates a vein for digging without revealing the tiles

mLegion

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #186 on: August 11, 2010, 05:33:48 pm »

Ok i figured out the farming problem, it was the geolayer_index that was wrong, the layer i was working on didn't have any soil in it.

So does anyone have any idea how to dump a list of tile types? eg.
89 = waterfall
90 = river source
...
331  obsidian

This might be problematic since certain numbers don't point to a material but rather a type in that biome/geolayer, like tile type 265 is sand in a sandy biome and clay in a nearby biome.
Does DFHack use an internal table for that or does it get the strings from the game?
Logged

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #187 on: August 12, 2010, 02:29:49 am »

This might be problematic since certain numbers don't point to a material but rather a type in that biome/geolayer, like tile type 265 is sand in a sandy biome and clay in a nearby biome.
Does DFHack use an internal table for that or does it get the strings from the game?
The known tile types are in the DFTileTypes header.
The real materials are a bit more complicated to determine, and it depends on the tile type too of course. You can look at the prospector tool and the Maps module for how that's done.

FleshForge

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #188 on: August 12, 2010, 11:37:43 pm »

I just realized I should have posted here instead of making a new thread (sorry, haven't had coffee yet).  There is a bug in the current version of DF that causes any items that were claimed by a task to become "stuck" on reclaim when a fort is defeated or abandoned, and Quietust came up with a fix for it.  I don't know how to compile it and I looked at trying to do it for long enough to realize I'm not going to figure it out too quickly, so if someone already familiar with compiling dfhack utilities could take a look, I'm sure a great many people would appreciate it at ton:

http://www.bay12forums.com/smf/index.php?topic=63297.0

Thanks!
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #189 on: August 13, 2010, 08:10:10 am »

Technically, that "bug" has been present in every version of Dwarf Fortress ever released (well, every version that included Reclaim mode, anyways). Frankly, I'm surprised nobody else wrote a comparable utility until now.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

mLegion

  • Bay Watcher
    • View Profile
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #190 on: August 13, 2010, 12:48:33 pm »

Could anyone who truly understands the way DF handles map tiles/blocks write and api reference for DFHack?
I still haven't quite figured out what all the functions are/do, and there doesn't appear to be a dedicated dfhack forum anywhere.
Logged

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #191 on: August 13, 2010, 03:22:37 pm »

K. I'll add the utility. I've been hit by this bug more than once and this is just too useful :) There will be a Windows binary release very soon, last in the 0.4 series.

About a week and a bit from now, I should have 0.5 ready, which will break compatibility with the current Memory.xml format. I'll be adding a GUI tool for editing the file and extending what it can do considerably. This will in turn make it possible to easily see which offsets are missing and detect missing features in the tools.

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #192 on: August 13, 2010, 06:48:05 pm »

Hi,

I'd like to thank everyone for their help last week. I have DFHack working in VSE 2010, and have the basics of my DF to Minecraft program working. It isn't nearly working yet, but it is a start.

I've converted this map: http://mkv25.net/dfma/map-9322-roadraced ( A completely above ground wooden castle )
to this Minecraft level: http://troz.shackspace.com/minecraft/df2mc/cutdown.mclevel
playable here after loading from file (assuming you have a purchased account): http://minecraft.net/indev/

images:

issues:
Spoiler (click to show/hide)

Some questions:
I have some walls showing up as having a TileMaterial of 'constructed'. Does the 'tempvein' look up as done by Probe for those tiles show the material of the 'floor' that was there before the wall was constructed?  If so, then I'm assuming that I can get the constructed wall material for the wall by looking in the Constructions object, is that correct? (I haven't looked at the Constructions object yet, but that is the thing I plan to do next.
Are tree tops not an actual DF tile type, and are just 'created' by the interface if a tree is below a air space?
I know I can get the date from the World object, but is it possible to get the location or group name? Civilization name?
Is it possible to get the water depth on a tile? ( just noticed designations[x%16][y%16].bits.flow_size - so yes)
Is it possible to tell if a location is part of a natural cave, and compared to a dwarf dug hallway?  I would like to put Minecraft Torches in dwarf dug areas, but natural cave should be unlit. If there isn't an easy way to tell, I guess I can check for mud (all caves have mud floors, correct?) using code from cleanmap.  What doe sthe magic number 0xC in cleanmap do, and what would be the value for mud?
Is it possible to find out what items are where?  I see that item are available from Items.h, but that doesn't seem to have location, and I don't see where the definitions for item class are.  I'm mostly interested in finding barrels and bins and replacing them with Minecraft chests and possibly pile designations (that would probably be someplace else).

I'm going to try to get torches, construction material, and buildings in before I release the code, hopefully by the end next weekend.  I'll probably have to do some optimization as well, as it currently take about 15 minutes to convert a 5x5 embarked area, and I'm going to be doing more lookups for buildings, water and such.

Thanks again for all your help!
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!

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #193 on: August 13, 2010, 07:37:25 pm »

I'd like to thank everyone for their help last week. I have DFHack working in VSE 2010, and have the basics of my DF to Minecraft program working. It isn't nearly working yet, but it is a start.
I fixed the build system for that recently. Is it what you're using or did you fix it yourself?

I have some walls showing up as having a TileMaterial of 'constructed'. Does the 'tempvein' look up as done by Probe for those tiles show the material of the 'floor' that was there before the wall was constructed?  If so, then I'm assuming that I can get the constructed wall material for the wall by looking in the Constructions object, is that correct? (I haven't looked at the Constructions object yet, but that is the thing I plan to do next.
Yes, you get the material from the construction itself. Also, you must mean the prospector tool, not probe.

Are tree tops not an actual DF tile type, and are just 'created' by the interface if a tree is below a air space?
Not there, it's all fakery, much like seeing the floors of one Z below.

I know I can get the date from the World object, but is it possible to get the location or group name? Civilization name?
I created the World module for that time-related stuff because putting it in Maps seemed wrong... yet Maps also holds parts of the world map. It's a bit messy but nothing unexpected with all the random adding of new features.
There was a Settlements module before, but was never ported from DF 40d. Rest of the stuff: simply not there.

Is it possible to tell if a location is part of a natural cave, and compared to a dwarf dug hallway?  I would like to put Minecraft Torches in dwarf dug areas, but natural cave should be unlit. If there isn't an easy way to tell, I guess I can check for mud (all caves have mud floors, correct?) using code from cleanmap.  What does the magic number 0xC in cleanmap do, and what would be the value for mud?
Yes, you can cross-reference tiles and blocks with local/global features. This is how things like hell and adamantine are detected also. Each map block can have one local and one global feature. Tiles then have a flag that determines if they belong to those map features. You can get caves, rivers, pits, hell, all that stuff. I filter most of this out when determining the materials though. Look at Maps::ReadLocalFeatures and Maps::ReadGlobalFeatures. It should be fairly easy to extend them. 0xC = mud, it's making an exception for mud to keep it around and not break your farms. It could probably find farms and only apply the exception there, but this works. I had some table for those values, but don't know where it went... Must be in one of my paper heaps ~_~

Is it possible to find out what items are where?  I see that item are available from Items.h, but that doesn't seem to have location, and I don't see where the definitions for item class are.  I'm mostly interested in finding barrels and bins and replacing them with Minecraft chests and possibly pile designations (that would probably be someplace else).
Hmm. It should be t_item in Items.h, but that's missing the bits you're looking for. The Items module needs some fixing.

TroZ_shack

  • Bay Watcher
  • Narf!
    • View Profile
    • Shacknews
Re: DFHack 0.4.0.5 - tools and memory access library
« Reply #194 on: August 13, 2010, 08:04:14 pm »

Yes, I was able to use the build system (once I installed CMake) for Visual Studio Express 2010, and I was able to use the project it created without much fuss.  I then created a sub-project in there for my map converter and copied the settings from the prospector project to get my new project to build and link correctly.

Thanks for the prompt response!  I guess I have a bunch of work this weekend :)
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!
Pages: 1 ... 11 12 [13] 14 15 ... 108