Bay 12 Games Forum

Please login or register.

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

Author Topic: DwarfFamily  (Read 40736 times)

Morphyum

  • Bay Watcher
    • View Profile
DwarfFamily
« on: October 17, 2013, 08:14:39 am »

DwarfFamily

Description:
DwarfFamily is a tool, that let's you import your legends xml file and converts all dwarf to a .ged file, which you can use in FamilyTree programs like MyHeritage to display a family tree for the dwarfs.

Usage:
  • Start the DwarfFamily.jar
  • Click the import Button
  • Select your legends.xml
  • Wait till the export button gets enabled
  • Click the export button
  • Use the .ged, named after your legends file, in a program of your choice(For example MyHeritage)
  • Or use the "View Dwarf List" button to watch your dwarfs or other races in a listview
  • Have Fun watching your family trees

How to get legends xml:
  • If you want a legends xml of a currently running game, copy your regions folder(dwarfFortress/data/save) else continue with 3
  • Abandon your Fortress
  • Start a new game
  • Select legends
  • press x to create a xml dump of your legends
  • A region legends xml file will be created in the dwarffortress main folder

Planned Features:
  • Visual display of the tree without the need of another program.

Credits:
Developed by Morphyum

Special thanks to Sallen for adding the interface and Ltan for making the ged compatible for more programs.

Support in Development Thread: http://www.bay12forums.com/smf/index.php?topic=132153.15
« Last Edit: May 12, 2017, 10:19:22 am by Morphyum »
Logged

Sallen

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #1 on: October 17, 2013, 08:51:10 am »

Damn you beat me to this! :)
If you need help with anything I'll be lurking around and willing to help. I'm very interested in this kind of tool.

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #2 on: October 17, 2013, 09:00:09 am »

A few minutes ago i managed to create my first complete file, with family connections in it. Right now i am looking for some bugs that crash the program. If i will need help i will contact you ;-) What i would need in the future so is somebody, that creates a visual output, so we dont need to use another program to display the tree ^^

EDIT: found the bug, Seems like some dwarfs don't have a name in the xml? Why is that?
« Last Edit: October 17, 2013, 09:02:38 am by Morphyum »
Logged

Covenant Ringthane

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #3 on: October 17, 2013, 09:03:42 am »

PTW.

Good luck!
Logged

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #4 on: October 17, 2013, 09:42:39 am »

Kinda have troubles finding good legends to test this. If i create long historys, it takes very long to convert it and in the shorter historys are not very much children from other dwarfs
Logged

Sallen

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #5 on: October 17, 2013, 09:44:18 am »

A few minutes ago i managed to create my first complete file, with family connections in it. Right now i am looking for some bugs that crash the program. If i will need help i will contact you ;-) What i would need in the future so is somebody, that creates a visual output, so we dont need to use another program to display the tree ^^

EDIT: found the bug, Seems like some dwarfs don't have a name in the xml? Why is that?

I have no idea about anything related to DF-exported data, so I can't help you there.
What language/framework are you coding this in? I think I'm going to make a self-contained class/module/whateverapplies that visualizes GEDCOM files using the same platform so that you can integrate it with your code later on if you wish.

EDIT: On a second thought, you might want to PM me what kind of data structures you use for representing all the data inside the program so I can use those directly. Of course, that would be later on when you have everything figured out. You could also consider setting up a Github project. It all depends on how much you want to be left to work in peace or want other people to become involved. I don't want to get pesky, so I won't insist. So yeah, give me a heads up if you want. I can make the visual output side.
« Last Edit: October 17, 2013, 09:52:36 am by Sallen »
Logged

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #6 on: October 17, 2013, 09:56:49 am »

Im Coding in java.
Found a legend, where we have a family that goes 2 steps down, thats all i wanted to test, so the familys get linked together right.
Whats missing now is a interface, so people can select wich legend file they want to use and also the program has troubles with large xml files because java runs out of memory so optimisations left.

I Added a link to the github in the main Post.
« Last Edit: October 17, 2013, 10:03:44 am by Morphyum »
Logged

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #7 on: October 17, 2013, 01:05:11 pm »

Thx to Sallen you have a minimalistic interface now and you can select the xml you want to use.
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: DwarfFamily
« Reply #8 on: October 17, 2013, 03:53:49 pm »

ptw

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #9 on: October 17, 2013, 04:00:57 pm »

Right now there are two problems:

1.) It seems, that sometimes the xml of the legends gets exported with errors and isnt aknowledged by my program as an xml file.
2.) If the xml gets to big(Long history) java runs out of memory
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DwarfFamily
« Reply #10 on: October 17, 2013, 04:51:59 pm »

It might be worth writing a DFHack plugin to export the data in a more compact form (all of the data should be available) and then use that in your program; this might also allow exporting additional information that's not included in the Legends dump.
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.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DwarfFamily
« Reply #11 on: October 17, 2013, 05:27:29 pm »

Yeah, especially since familial relations are easy to find with DFHack. A historical figure has a vector of histfig links, which reference a target historical figure. For example, this function gets a unit's father in Lua:

Code: [Select]
function getUnitsFather(unit,numberIsNotFig)
 --pretend it's function overloading :V
    local fig =
        (df.unit:is_instance(unit) and df.historical_figure.find(unit.hist_figure_id) or
        df.historical_figure:is_instance(unit) and unit or
        type(unit)=="number" and numberIsNotFig and df.historical_figure.find(df.unit.find(unit)) or df.historical_figure.find(unit)
        )
    for k,link in ipairs(fig.histfig_links) do
        if df.histfig_hf_link_fatherst:is_instance(link) then return df.historical_figure.find(link.target_hf) end
    end
end

The fig stuff can be mostly ignored (I mostly wanted to create a working function that would accept any reasonable argument you could throw at it); this is the important part:
Code: [Select]
    for k,link in ipairs(fig.histfig_links) do
        if df.histfig_hf_link_fatherst:is_instance(link) then return df.historical_figure.find(link.target_hf) end
    end

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #12 on: October 17, 2013, 05:51:20 pm »

yea you guys might be true, i think with the xml file attempt i will only come so far. Guess i have to check dfhack when i find the time.

Quote
A historical figure has a vector of histfig links, which reference a target historical figure.
Thats how it is in the xml too.
« Last Edit: October 17, 2013, 08:24:20 pm by Morphyum »
Logged

Morphyum

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #13 on: October 18, 2013, 03:08:17 am »

Yea The xml files created by DF are just far to big and buggy to be handeled, so guess i have to use DFHack.

Also i will give StAX a chance before i give up.
« Last Edit: October 18, 2013, 04:25:17 am by Morphyum »
Logged

Sallen

  • Bay Watcher
    • View Profile
Re: DwarfFamily
« Reply #14 on: October 18, 2013, 08:30:04 am »

Do dwarves adopt children? I'm seeing people with a mother (no father), but they are not listed as children of said mother. Or would this be a parsing bug?
Pages: [1] 2 3 ... 5