Bay 12 Games Forum

Please login or register.

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

Author Topic: Relationships Utility  (Read 17449 times)

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Relationships Utility
« on: February 15, 2012, 06:20:52 pm »

After having been part of two community forts, I've seen some frustration in the difficulties with getting two specific dwarves to get hitched.  Might seem like a small thing, but I like to be able to influence this sort of thing.  Burrowing them together usually works, eventually, but takes forever and a day.

Is there a utility that already exists that allows you to force relationship statuses between dwarves?  My attempts at searching seem to indicate that you can do a lot of stuff with some utilities like Runesmith, but not this.

I've been attempting to find a way to do this myself with a memory trainer, but it's turning out to be an arduous process that won't likely yield useful results any time soon.  I presently know nothing about Dwarf Fortress's memory layout (in either 31.25 or 34.01), so I'm stabbing in the dark here.  If there are no utilities, have any of you who have worked on one of these utilities got any advice on how to proceed?

I assume that it should be a matter of forcing some memory values to a high number and letting the dwarves talk to each other, thus triggering a move from friend to lover or lover to getting married, but you know what assuming does...

Edit
There is now a way of doing this for those interested
I figured out how to do this the hard way, but even better are two DFHack Lua scripts I wrote to handle forcing marriages and divorces.  For more information, see here.
« Last Edit: February 17, 2013, 09:01:34 pm by Telgin »
Logged
Through pain, I find wisdom.

The Master

  • Bay Watcher
  • A respectable sort of psychopath
    • View Profile
Re: Relationships Utility
« Reply #1 on: February 15, 2012, 07:03:40 pm »

Sadly no, relationships as I understand are hard-coded, so you wouldn't be able to change that.
Logged
Holy jesus I thought I was ready but nothing could have prepared me for this
Hush, little Asea, don't you cry.
If he notices we'll surely die!
You. Made. Asea. CRY.

DrKillPatient

  • Bay Watcher
  • The yak falls infinitely
    • View Profile
Re: Relationships Utility
« Reply #2 on: February 15, 2012, 07:11:08 pm »

They must be stored in memory somewhere, so maybe such a thing could be integrated into DFHack? I know it can alter some otherwise hardcoded behaviors.
Logged
"Frankly, if you're hanging out with people who tell you to use v.begin() instead of &v[0], you need to rethink your social circle."
    Scott Meyers, Effective STL

I've written bash scripts to make using DF easier under Linux!

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Relationships Utility
« Reply #3 on: February 15, 2012, 07:20:53 pm »

"Hardcoded" only matters with traditional modding.  When you get memory hacking, you're circumventing everything and modifying data values directly.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Relationships Utility
« Reply #4 on: February 15, 2012, 07:53:08 pm »

So I guess my assumption that there wasn't much known about this was correct.

I've been experimenting by running a memory trainer on DF while methodically having two dwarves talk to each other, checking for any memory addresses with new values.  Separating them for a while and letting the happy thought go away, then checking for values that haven't changed.  Rinse and repeat a crap ton of times and it should isolate the memory addresses that change only when they're talking to each other.

The best I've managed to get was down to about 5,000 possible addresses, which would only possibly contain the relationship "values" for those two dwarves.

I did see some promising numbers.  It looks like there are counters stored for each dwarf separately that get incremented each time they talk.  I assume this is the strength of the relationship, of a sort.  In theory, setting this to a high value would force them to become lovers or get married after they talked again, but it didn't seem to be so easy.

It also seems this is random.  My suspicion is that there is some sort of social skill check that is performed against this relationship value... but I haven't confirmed it yet.

Anyone have any better ideas on how to experiment with this?  It's extremely time consuming and not really getting me anywhere... I looked at a memory map provided with some utility and it seems that while the address offsets to the dwarf information are known, there's nothing known for the relationships.  I would have assumed it was a data structure pointed to from dwarf, possibly a linked list or an STL Vector, but I'm not exactly sure where to start poking around to figure that out...

Could be a lot of other ways to organize it unfortunately... could use dwarf ids as indices into a hash map or something nasty like that...
Logged
Through pain, I find wisdom.

Girlinhat

  • Bay Watcher
  • [PREFSTRING:large ears]
    • View Profile
Re: Relationships Utility
« Reply #5 on: February 15, 2012, 08:58:25 pm »

I think one of your best bets would be to disable learning and enable talking, that way no social skills get ranked up.  Talking improves the various social skills, so of that 5,000 possible values, some of them will be skills gaining exp.  Disable learning, and these will never improve.

Then take two dwarves and set them to be identical, just memhack everything to a baseline, if you can.  Make them indistinguishable.  It may help to mod in new creatures for this - remove all things like hair, tissues, etc that could add data values that track appearance and such.  Ideally, you'd have a simple_one_part_body made of one tissue, ability to speak but inability to learn.  Then make them identical, and watch carefully...

Unless the memory offset depends on the amount of data.  If removing the facial hair would change the data layout and change the offset of the social ties, then that would be useless, except you might get some idea of what pattern to look for.  If your slimes develop relationships in the same way as dwarves, then you can look for the same pattern of data changes.

[NO_EAT],[NO_SLEEP],etc may also remove any variables that change over time.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Relationships Utility
« Reply #6 on: February 15, 2012, 10:27:06 pm »

Not a bad idea there... I had considered that they would be getting skill ups and hapiness changes from it, but I didn't think to remove the skill ups through modding.  That will probably help a lot.

Maybe I'll be able to build a table of relationships from some offset once I figure that much out...  maybe if I figure this out someone else might care somewhere, hehe.  I might could be persuaded to write an interface for it then.

One step at a time though.
Logged
Through pain, I find wisdom.

dennislp3

  • Bay Watcher
    • View Profile
Re: Relationships Utility
« Reply #7 on: February 15, 2012, 10:42:14 pm »

I think Legends Viewer is looking to get a family history ability now for relationships and the like.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Relationships Utility
« Reply #8 on: March 16, 2012, 12:48:10 am »

I'm an evil necromancer, I know, but I thought it better to bump this topic rather than start a new one.

In short, I was successful in doing this.  I can go into gory technical details, if anyone is interested.  Here's what I've learned though:

You can marry / force into love / make a parent / child of just about any two things.  It appears that anything that can be a historical figure can work this way.  I was able to marry dwarves to their deities, for instance.  There is no gender restriction either... so yes, you can have two male or two female dwarves in relationships.

Relationships are stored in a one directional manner.  This means that you can have a dwarf married to someone else who doesn't even know about it, or who is married to someone else entirely.  However, it appears you can't have more than one spouse or lover.  The game appears to ignore the second one if you provide it.  You can have a spouse and a lover though.  I haven't yet tested how this interacts with pregnancies.

In order to do this, I currently just have to overwrite an existing relationship (not an acquaintance, which is anyone who is a friend, grudge or just an acquaintance).  I have to overwrite an existing spouse, lover, child, parent or deity link.  It seems to work properly once this is done though.

Anyway, is anyone else interested in me converting this into an actual utility / plugin for DFHack?  I'm currently doing this fun by manually following pointers and changing values in memory.
Logged
Through pain, I find wisdom.

Dsarker

  • Bay Watcher
  • Ἱησους Χριστος Θεου Υἱος Σωτηρ
    • View Profile
Re: Relationships Utility
« Reply #9 on: March 16, 2012, 03:28:02 am »

Well, I am!
Logged
Quote from: NewsMuffin
Dsarker is the trolliest Catholic
Quote
[Dsarker is] a good for nothing troll.
You do not convince me. You rationalize your actions and because the result is favorable you become right.
"There are times, Sember, when I could believe your mother had a secret lover. Looking at you makes me wonder if it was one of my goats."

TurkeyXIII

  • Bay Watcher
    • View Profile
Re: Relationships Utility
« Reply #10 on: March 16, 2012, 08:50:34 am »

DF hack utility pls?

Also:
I was able to marry dwarves to their deities, for instance.
  :D
Logged
A medium-sized bird with a distinctive fleshy wattle that hangs from the underside of the beak, and a fleshy protuberance that hangs from the top of its beak called a snood.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Relationships Utility
« Reply #11 on: March 16, 2012, 09:01:38 am »

Alright, time to start poking around with DFHack to see if I can figure out how to write utilities for it.

I'll also do some more experimenting with this, I think there are probably some more limitations and possibilities here.  For example, I think it might be possible to marry dwarves to animals... (ones that have historical figures anyway, I'm not 100% clear on what gets these and what doesn't).

I also managed to get a dwarf to worship her son as if he was a deity, but this could again be anything with a historical figure.  Which is peculiar, but might interest someone.  I think Dsarker might appreciate that possibility, hehe...
Logged
Through pain, I find wisdom.

Dsarker

  • Bay Watcher
  • Ἱησους Χριστος Θεου Υἱος Σωτηρ
    • View Profile
Re: Relationships Utility
« Reply #12 on: March 16, 2012, 04:07:53 pm »

Hehehehehe
Logged
Quote from: NewsMuffin
Dsarker is the trolliest Catholic
Quote
[Dsarker is] a good for nothing troll.
You do not convince me. You rationalize your actions and because the result is favorable you become right.
"There are times, Sember, when I could believe your mother had a secret lover. Looking at you makes me wonder if it was one of my goats."

EmperorJon

  • Bay Watcher
  • Still waiting...
    • View Profile
Re: Relationships Utility
« Reply #13 on: March 24, 2012, 11:39:04 am »

Any progress? Or dead project?
Logged
I think it's the way towns develop now. In the beginning, people move into a town. Then they start producing tables, which results in more and more tables. Soon tables represent a significant portion of the population, they start lobbying for new laws and regulations, putting people to greater and greater disadvantage...
Link for full quote. 'tis mighty funny.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: Relationships Utility
« Reply #14 on: March 24, 2012, 05:22:41 pm »

It's not dead, I just haven't had much of a chance of looking into what is needed to actually make a plugin for DFHack for it yet.  I might have time this coming week to try and check that out.  If it's more complicated than I expect, I might be able to write a standalone application to do it, but that will probably be even more time consuming.

In the meantime, if anyone is interested in how to do this, I can give very detailed instructions on how to do this manually with a memory editor.  If you're uncomfortable working with memory directly, then it will probably be more trouble than it's worth, but I've checked that this does appear to work correctly in .31.25 at least.  No crashes when saving or loading, and the game seems stable.  I haven't yet tried it in .34.x, but the principle should be the same.
Logged
Through pain, I find wisdom.
Pages: [1] 2 3 ... 5