Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Understanding DFHack structures (https://github.com/DFHack/df-structures)  (Read 1105 times)

klaus.hauschild

  • Escaped Lunatic
    • View Profile

Hi there,

currently i try to figure out how the core of DFHack works.
In tow words: memory manipulation
https://github.com/DFHack/df-structures seams the repository of the memory accessing layer of DFHack.

So with a deep understanding of all these data locations and Dwarf Fortress itself it should be possible the collect all information of the current game and perfom actions the remotly control the game? Or i'm completly off track?

Is there some detailed documentation of all the values and structures and what they mean?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile

Hi there,

currently i try to figure out how the core of DFHack works.
In tow words: memory manipulation
https://github.com/DFHack/df-structures seams the repository of the memory accessing layer of DFHack.

So with a deep understanding of all these data locations and Dwarf Fortress itself it should be possible the collect all information of the current game and perfom actions the remotly control the game? Or i'm completly off track?

Is there some detailed documentation of all the values and structures and what they mean?

You are not completely off track, but all the data does not mean all the functions. E.g. you could manipulate the data to mine a tunnel, but that is way more complicated (you need to change tiles, you need to spawn items if it is ore/gems/, check for cave ins (or at least mark a flag somewhere), etc...).

Also there is a tool that i'm shamelessly advertising to everyone. When this: "gui/gm-editor df.global" is typed to dfhack console you get access to all the data of df.

However there is no virtual methods which we also have access to - only c++ headers and the xml files contain info on those. You can call them from lua but they are not indicated in the editor.

klaus.hauschild

  • Escaped Lunatic
    • View Profile

Thanks for the reply. "gui/gm-editor df.global" is a realy neat thing to play with and have a look behind the scenes of dwarf fortress.

My crazy idea is to do an UI overhaul for dwarf fortress. ASCII and the tilesets are super nerdy and stand for their own but arn't intuitive. Dwarf Fortress Remote go in the right direction but doesn't change the UI and the way it has to be used very much.

A simple control improvement could be to get rid of the two different ways to lay out buildings (mining: general free paint, bridges, roads, farming plots: define rectangle size and place)
With a UI not restricted to the basic ASCII grid more informations and control possibilities (right click) could be presented in compressed form.

I understand, that this idea is absolutly crazy and there is a huge amount of reverse engineering for just one version of DF. But imagine to mix all the features and stuff from external tools like DFHack, DwarfTherapist, StoneSense and so on and we are just there. BWT: DF and Toady are totally crazy too.
Logged

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile

Japa has already kinda done some of that with Armok Vision, so definitely check out that sportscar before inventing a new wheel from scratch.

Oh, and as I've said elsewhere, I still think that it is better for gui/gm-editor to default to df.global rather than error with no target. I get far less use of it directly on a unit or item than I do while trying shit like trying to see how worldgen or the updating region calendar or the adventurer quest log are set up.

After I learned you can also do gui/gm-editor df or dfhack and explore those pages I find myself hopping over there to check out the exact name for a certain item type or to see which toys dfhack has in the toybox that might do what I need.

I wonder how hard it would be to include a different search method over in the df heading that pulls up a prompt to toss a number at the end of df.*whichever df type you have selected*.find( and let you finish the parens plus add some .foo[bar] candy on the end if need be?
Logged