[A16] Psychology (2017-5-14)

Started by System.Linq, August 19, 2016, 07:16:38 AM

Previous topic - Next topic

AngleWyrm





I have a pair of colonists that hate each other; they're at -80 or worse after a brawl over discussing their feelings.

There's a lot of dimensions to the psych profiles, which I'm guessing are similar to genetic traits in that they are unlikely to change for any given colonist. (might make an interesting avenue for medical research...)

With so much rich detail I'd like to know if there is anything I can do to influence the relationship, beyond the rather low-detail binary keep/chuck.

How do I determine what the primary 1~3 contributing factors are to their animosity? And more generally is there some sort of wheel of opposites taking place in the list of psychic traits?
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

Wishmaster

Hello.

I am making a mod that detours "RimWorld.TendUtility.DoTend()" and just realize your mod does too.

I can't figure out what exactly your detour does. Can you explain please ?

Also I just released a new version of my mod "Smarter Food Selection" that detours "DoTabs()" then figured out that psychology does too. (forgive me if I don't use your mod often  ;D ).

I knew this was risky in terms of compatibility but it ended up well after all, except that users are getting an error message yet harmless.

I think we should both do conditional detouring. I will do it in my next release w/e you decide.


Dr_Zhivago

Getting an error log with Hospitality I believe.

[HugsLib] Exception during DetourMethodByAttribute: System.Exception: Failed to detour method Pawn_RelationsTracker.Notify_RescuedBy to Pawn_RelationsTracker.Notify_RescuedBy (assembly: Hospitality) ---> System.Exception: method was already detoured to Psychology.Detour._Pawn_RelationsTracker._Notify_RescuedBy.
  at HugsLib.Source.Detour.DetourProvider.CompatibleDetourWithExceptions (System.Reflection.MethodInfo source, System.Reflection.MethodInfo destination) [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.DetourMethodByAttribute (System.Reflection.MemberInfo info, System.Attribute attrib) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at HugsLib.Source.Detour.DetourProvider.ThrowClearerDetourException (System.Exception e, System.Reflection.MemberInfo sourceInfo, System.Reflection.MemberInfo targetInfo, System.String detourMode) [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.DetourMethodByAttribute (System.Reflection.MemberInfo info, System.Attribute attrib) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
HugsLib.Source.Detour.Helpers:DetourMethodByAttribute(MemberInfo, Attribute)
HugsLib.Source.Attrib.AttributeDetector:CallHandlersForAttributes(List`1, Dictionary`2)
HugsLib.Source.Attrib.AttributeDetector:ProcessNewTypes()
HugsLib.HugsLibController:ProcessAttibutes()
HugsLib.HugsLibController:LoadReloadInitialize()
HugsLib.HugsLibController:Initalize()
HugsLib.Core.UnityProxyComponent:Start()

System.Linq

#528
Quote from: AngleWyrm on April 05, 2017, 10:13:50 AM




I have a pair of colonists that hate each other; they're at -80 or worse after a brawl over discussing their feelings.

There's a lot of dimensions to the psych profiles, which I'm guessing are similar to genetic traits in that they are unlikely to change for any given colonist. (might make an interesting avenue for medical research...)

With so much rich detail I'd like to know if there is anything I can do to influence the relationship, beyond the rather low-detail binary keep/chuck.

How do I determine what the primary 1~3 contributing factors are to their animosity? And more generally is there some sort of wheel of opposites taking place in the list of psychic traits?
At the moment, you do not have fine control over the interpersonal interactions of your colonists. If they don't get along, they simply will not get along; they're not fond of each other. All you can do is endeavor to give them jobs and living spaces separate enough from each other that they do not interact as often. It's worth noting that the smaller the colony, the more its inhabitants will moderate their distaste for each other.

Colonists determine whether they like each other or not based on a variety of factors. The first is the very basic "how close to my opinion on this topic is theirs when we have a conversation about it?" Each personality trait has a topic of conversation associated with it (except for "core" traits which are the same for everyone with an identical upbringing and exist solely to influence the traits beneath with them). If they are very close, they will have a very positive reaction to each other on it. If they are very far apart, it will be very negative. Secondly, the magnitude of the personality offset is influenced heavily by the controversiality of a conversation topic. People will be much more attracted to each other or put off by another person if they disagree on politics than what's on their bucket list.

If someone displeases another person, they can mitigate (or worsen) it by how Polite they are, and Judgmental colonists will have bigger opinion offsets from conversations, leading them to form an opinion of someone more quickly (and possibly also change it on a whim). Colonists that are Cool get a flat bonus to all conversations with anyone, and vice versa for colonists who are very not Cool. Population size can also mitigate bad opinions if it's low (as previously mentioned), and finally small conversational thoughts will likely not affect them if they have already formed a strong opinion of that colonist (250+). Conversational thoughts last about a year before they are forgotten.

So there are many factors in play. It is essentially a complete rework of everything to do with how colonists interact, which is why the mod is advertised as an overhaul. It's probably far too complicated to keep track of or try to influence. Plus, a colonist which previously liked someone may find themselves talking about a topic on which they strongly disagree, and subsequently hate their guts. You can't tell your colonists who to enjoy the company of, they simply do or do not. The next version, as previously mentioned, will see your colonists taking time off to hang out with each other and get to know better people they might not otherwise talk to much (and reinforce previously-established relationships).

And finally, personality is based largely on traits, allowed labor, and upbringing, so there is not much you can do to change it (unless you have a mod which allows you to do so). Some parts of it (primarily the intellectual personality traits) can be influenced by their skill levels and will change over time. Perhaps in the future I may add some sort of age factor as well, so their personality changes as they grow older, but that's a long way off.

Quote from: Wishmaster on April 05, 2017, 11:33:11 AM
Hello.

I am making a mod that detours "RimWorld.TendUtility.DoTend()" and just realize your mod does too.

I can't figure out what exactly your detour does. Can you explain please ?

Also I just released a new version of my mod "Smarter Food Selection" that detours "DoTabs()" then figured out that psychology does too. (forgive me if I don't use your mod often  ;D ).

I knew this was risky in terms of compatibility but it ended up well after all, except that users are getting an error message yet harmless.

I think we should both do conditional detouring. I will do it in my next release w/e you decide.
In A17 Psychology will begin using Harmony when HugsLib supports it, so I recommend you use that to avoid compatibility issues entirely.

Psychology simply adds this to DoTend():

            if (doctor != null)
            {
                doctor.records.Increment(RecordDefOf.TimesTendedOther);
                doctor.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.DoctorBleedingHeart, patient);
            }


There are instructions in the OP for overriding this while maintaining the functionality of both mods.

Quote from: Dr_Zhivago on April 05, 2017, 11:55:22 AM
Getting an error log with Hospitality I believe.

[HugsLib] Exception during DetourMethodByAttribute: System.Exception: Failed to detour method Pawn_RelationsTracker.Notify_RescuedBy to Pawn_RelationsTracker.Notify_RescuedBy (assembly: Hospitality) ---> System.Exception: method was already detoured to Psychology.Detour._Pawn_RelationsTracker._Notify_RescuedBy.
  at HugsLib.Source.Detour.DetourProvider.CompatibleDetourWithExceptions (System.Reflection.MethodInfo source, System.Reflection.MethodInfo destination) [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.DetourMethodByAttribute (System.Reflection.MemberInfo info, System.Attribute attrib) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at HugsLib.Source.Detour.DetourProvider.ThrowClearerDetourException (System.Exception e, System.Reflection.MemberInfo sourceInfo, System.Reflection.MemberInfo targetInfo, System.String detourMode) [0x00000] in <filename unknown>:0
  at HugsLib.Source.Detour.Helpers.DetourMethodByAttribute (System.Reflection.MemberInfo info, System.Attribute attrib) [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
HugsLib.Utils.ModLogger:ReportException(Exception, String, Boolean, String)
HugsLib.Source.Detour.Helpers:DetourMethodByAttribute(MemberInfo, Attribute)
HugsLib.Source.Attrib.AttributeDetector:CallHandlersForAttributes(List`1, Dictionary`2)
HugsLib.Source.Attrib.AttributeDetector:ProcessNewTypes()
HugsLib.HugsLibController:ProcessAttibutes()
HugsLib.HugsLibController:LoadReloadInitialize()
HugsLib.HugsLibController:Initalize()
HugsLib.Core.UnityProxyComponent:Start()

The same goes for Hospitality.


        internal static void _Notify_RescuedBy(this Pawn_RelationsTracker t, Pawn rescuer)
        {

            if (rescuer.RaceProps.Humanlike && t.canGetRescuedThought)
            {
                t.GetPawn().needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOf.RescuedMe, rescuer);
                t.canGetRescuedThought = false;
                rescuer.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.RescuedBleedingHeart, t.GetPawn());
            }
        }

Ruisuki

That sounds excellent. I enjoyed the idea of dating from the romance diversified(?) mod, glad to see more tuning in interactions on this mod, its becoming one of my favorites. Can we expect the mayoral spot and/or prepare carefully integration by the next update or do you also foresee them being a long way off?

System.Linq

Prepare Carefully integration will come with Harmony integration into HugsLib.

Mayoral spot may come next update if I get around to it. It will simply involve putting a new property on tables that you can use to designate them as an "office" for mayors.

trick

Quote from: tbridges42 on April 02, 2017, 10:47:37 AM
...

I checked out my save files, and in the thing node for the first pawn that was saved, the Psychology.DirectPawnRelationDynamic node did not terminate properly. The result was that every other object in my game was considered to be a relationship of my pawn, instead of an object which was throwing pages of object not found errors when I loaded. Even my camera map was in that pawn's directRelations node.

...

I think I might have run into the same problem. In my save file I have two Psychology.DirectPawnRelationDynamic nodes (i.e. <li Class="Psychology.DirectPawnRelationDynamic">). The first is inside of the definition for Thing_Human2819, and describes her relation to Thing_Human2815 (and also contains everything about Thing_Human2815). The second is a decendant of the first node, and presumably defines Thing_Human2815's relationship with Thing_Human2819, but it also contains references to a whole pile of other things (plants and animals on the map, a stove, etc).

None of the other pawns have these, but these two pawns are the only ones with romantic entanglements.

Trying to load the game gives me a lot of warnings of the form:

QuoteCould not resolve reference to object with loadID Thing_Human2815 of type Verse.Pawn. Was it compressed away, destroyed, had no ID number, or not saved/loaded right?

and ultimately fails with this traceback:

QuoteException from asynchronous event: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.Pawn_RelationsTracker.ExposeData () [0x00000] in <filename unknown>:0
  at Verse.PostLoadInitter.DoAllPostLoadInits () [0x00000] in <filename unknown>:0
  at Verse.Game.LoadGame () [0x00000] in <filename unknown>:0
  at Verse.SavedGameLoader.LoadGameFromSaveFile (System.String fileName) [0x00000] in <filename unknown>:0
  at Verse.Root_Play.<Start>m__736 () [0x00000] in <filename unknown>:0
  at Verse.LongEventHandler.RunEventFromAnotherThread (System.Action action) [0x00000] in <filename unknown>:0

System.Linq

Yes, I fully expect the dynamic relation def thing to have problems. It was difficult to fully test. Mind hosting the save file somewhere?

Also, the compatibility error with Hospitality likely always existed, and is only noticeable now that Hospitality has switched to HugsLib.

trick

Sure, any suggestions as to where? It's about 15 Mb. I can tarball it, but it will still be big.

By the way, I moved the nested thing nodes from out of the Psychology.DirectPawnRelationDynamic nodes, and removed the Psychology.DirectPawnRelationDynamic nodes and now it loads and saves fine, but the one couple is no longer together (as tbridges42 found).

trick

Never-mind, I vastly underestimated the comprehensibility of these xml files.

[attachment deleted by admin due to age]

System.Linq

Yeah, that PawnRelation is applied when a couple breaks up. It should be an ex-lover relation.

AngleWyrm

#536

Quote from: Linq on April 06, 2017, 01:17:35 AM
  • "how close to my opinion on this topic is theirs when we have a conversation about it?" Each personality trait has a topic of conversation associated with it (except for "core" traits which are the same for everyone with an identical upbringing and exist solely to influence the traits beneath with them). If they are very close, they will have a very positive reaction to each other on it. If they are very far apart, it will be very negative.
  • The magnitude of the personality offset is influenced heavily by the controversiality of a conversation topic. People will be much more attracted to each other or put off by another person if they disagree on politics than what's on their bucket list.
  • If someone displeases another person, they can mitigate (or worsen) it by how Polite they are
  • Judgmental colonists will have bigger opinion offsets from conversations, leading them to form an opinion of someone more quickly (and possibly also change it on a whim).
  • Colonists that are Cool get a flat bonus to all conversations with anyone, and vice versa for colonists who are very not Cool.
  • Population size can also mitigate bad opinions if it's low
  • small conversational thoughts will likely not affect them if they have already formed a strong opinion of that colonist (250+)
  • Conversational thoughts last about a year before they are forgotten.
  • Personality is based largely on traits, allowed labor, and upbringing
  • Some parts of it (primarily the intellectual personality traits) can be influenced by their skill levels and will change over time.

Thanks for a detailed understanding of what's going on in the colony. That's the kind of thing I enjoy seeing when they interact, the echoes and trajectories of the motives behind the shooting stars that finally appear on-screen.

QuoteAll you can do is endeavor to give them jobs and living spaces separate enough from each other that they do not interact as often...It's probably far too complicated to keep track of or try to influence...You can't tell your colonists who to enjoy the company of, they simply do or do not.

I don't want direct control, that would break immersion and feel like cheese. Physical proximity is a great plan, separating differences and congregating similarities. A role for the player to govern and refine their colony.

The other place I see for player involvement is skill levels. If changing the skills between two colonists would improve their relationship (or worsen it, if you're into that) then there's an opportunity to provide indirect influence. It creates motive to train up specific skills, build schools and training areas, and could also present desire to reduce/forget some skills.
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

trick

Quote from: Linq on April 06, 2017, 03:12:45 AM
Yeah, that PawnRelation is applied when a couple breaks up. It should be an ex-lover relation.

They were regularly breaking up and getting back together. As far as I remember though, at the point of this save game they had been together for a while and were engaged.

Wishmaster

#538
QuoteIn A17 Psychology will begin using Harmony when HugsLib supports it, so I recommend you use that to avoid compatibility issues entirely.

I don't see how harmony will solve that issue. My mods detours DoTabs() for the same purpose as Psychology (to increase the maximum number of ITabs).

QuoteThere are instructions in the OP for overriding this while maintaining the functionality of both mods.

OP.... ? I can't find what you are talking about..
edit: I've found what you are talking about but I don't detour DoTend() for the same purpose as you, I don't edit the same part of the code. I guess I am on my own to create a patch.

System.Linq

Quote from: Wishmaster on April 06, 2017, 12:38:35 PM
QuoteIn A17 Psychology will begin using Harmony when HugsLib supports it, so I recommend you use that to avoid compatibility issues entirely.

I don't see how harmony will solve that issue. My mods detours DoTabs() for the same purpose as Psychology (to increase the maximum number of ITabs).

The whole point of Harmony is to resolve incompatibilities in detouring.

Quote from: Wishmaster on April 06, 2017, 12:38:35 PM
QuoteThere are instructions in the OP for overriding this while maintaining the functionality of both mods.

OP.... ? I can't find what you are talking about..
edit: I've found what you are talking about but I don't detour DoTend() for the same purpose as you, I don't edit the same part of the code. I guess I am on my own to create a patch.

Original post. It doesn't matter why you detour DoTend(). Simply include the functionality that is in Psychology:


                ThoughtDef kp = DefDatabase<ThoughtDef>.GetNamedSilentFail("DoctorBleedingHeart");
                if(kp != null)
                {
                        doctor.needs.mood.thoughts.memories.TryGainMemoryThought(kp, patient);
                }


Then tell your users to load your mod before Psychology.