Jump to content

[mod] Romance Tweaks More Options


Recommended Posts

Romance Tweaks More Options


Romance Tweaks More Options (RTMO)

 

In RimWorld, pawns occasionally have social interactions, indicated by speech bubbles above/between them. Behind the scenes, a chance is calculated (with a lot of factors) for such an interaction to be a romance attempt.

The original RomanceTweaks by bdew allowed a general modifier for that chance, plus another modifier for singles. Also it let you modify the success chance of the romance attempt (for the pawns to become lovers, propose and marry) and the breakup chance (I'm actually not sure when exactly this comes into play).

 

I stole RomanceTweaks and enhanced it by

  • A Faction Modifier - to optionally prevent (or encourage ?) Pawns making visitors (or temporary colony members) their lovers
  • Slave Modifiers
  • Incest Modifiers - in three flavors, grouped by the original attraction factor split as found in vanilla RimWorld
  • LovinMtb fix for large age gaps
  • Pureblood Gene

 

Original RomanceTweaks on Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=1575463949

Original RomanceTweaks on github, released under GNU Lesser GPL: https://github.com/bdew-rw/RomanceTweaks

 

Handled blood relations:

Spoiler

Close: Child, HalfSibling, Parent, Sibling

Medium: Cousin, Grandchild, Grandparent, NephewOrNiece, UncleOrAunt
Far: GreatGrandchild, GreatGrandparent, GranduncleOrGrandaunt, Kin

 

The XML defines romanceChanceFactors for the following relationships, but they apparently don't exist as C# definitions. Maybe they match the "Kin" definition, but who knows?
- GrandnephewOrGrandniece
- CousinOnceRemoved
- SecondCousin

 

Incest Notice

The archive also contains two mods:

* RomanceTweaksMoreOptions (the mod with the tweakable values, see screenshot)

* IWantIncest (simple xml patch, see below)

If you don't care for incest, don't extract IWantIncest or, if you did extract it, don't enable it. Basically just ignore it.

If you want incest, then make sure you also extract the IWantIncest folder and don't forget to enable the mod "I Want Incest" ingame.

 

The "I Want Incest" mod contains an xml-Patch that sets the "attractionFactor" (1.0) / "romanceChanceFactor" (1.1+) for blood related pawns to 1 (vanilla RimWorld has it at 0.03 for siblings, for example).

The "romanceChanceFactor" is a different factor than the "Incest" modifier you can see in the mod settings (see screenshot), so you could also keep the xml and set the factor to zero (or 0.03) in the mod settings to prevent incest (or keep it as rare as in vanilla). See default values in tooltips and read the following spoiler for more information:

Spoiler

Actually, RimWorls does a calculation with less parameters before calculating the actual romance chance. The romanceChanceFactor from the xml is included in this pre-calculation, the factors from this mod's settings not. And if the result of that pre-calculation is very small, romance chance is set to flat zero; which often happens especially to closely related pawns. In this scenario, even setting all factors very high in the mod options would still prevent most blood related couples.

So changing the romanceChanceFactor to 1 in the xml results in the actual romance chance to be not zero, and thus subject to all the factors you can tweak in this mod. If you set the factor for singles to 10, and the factor for cousins to the default 0.25, then (single) cousins' romance chance is still boosted by a factor of 2.5 (i.e. more likely than unrelated pawns in vanilla).

Depending on your preference, you could set the factors even lower, or just to zero to make absolutely sure blood-related pawns never become lovers.

 

If you have incestuous relationships in your colony you might have noticed that other pawns don't like people in such relationships. Crazy thing is that they don't like a niece being in a relationship with an uncle, but they have no problem with an uncle being in a relationship with a niece.

Also included in the "I Want Incest" mod, I reduced these opinion modifiers, to make the imbalance less harsh. With the legwork done feel free to adjust the values to something you like in the xml-file (even zero is possible ? positive values don't work though). Also refer to No Incest Judging by Fenguard, which conveniently sets it to 0.

 

Pureblood gene (only available with Biotech DLC)

I'm not even sure this is the right mod to put it in, but here we are.

Related pawns have an inbred chance. For related pawns that already are inbred, this mod might make the offspring pureblood.

Pureblood gene doesn't prevent inbred, nor does it guarantee pureblood offspring; for close relatives, the chances are pretty good though:

Spoiler

Both parents need to be either inbred or pureblood for the child to get the pureblood gene!

But if the child gets the pureblood gene, the inbred gene is removed.

 

Chances:

I probably made this too complicated but I didn't want to just have it be 100%.

 

First number is the vanilla chance for the child to become inbred, followed by the chances to become pureblood if: both parents are inbred, one parent is pureblood or both parents are pureblood.

 

Parent/Child/Sibling:

80% -> 76%, 86%, 96%


Grandparent/Grandchild/Halfsibling/Uncle/Aunt/Nephew/Niece:

40% -> 28%, 38%, 48%


Cousin:

20% -> 4%, 14%, 24%


Other named blood relations:

10% -> 1%, 2%, 12%


"Kin": 0%

 

Requirements

Requires Harmony.

Versions for RimWorld 1.4 and earlier (2023 and before) also require HugsLib

 

Compatibility

Should work with all mods, but has to be loaded after mods that do romance stuff.

I don't understand Harmony Patching well enough to make sure these RTMO's modifiers are always applied if any other functions edit romance chances (like Psychology, Rational Romance, etc), but loading RTMO after these seems to work.

 

RTMO can be used alongside RimJobWorld, but it's not required. In fact, the sex system of RJW seems to be mostly oblivious of any romance status pawns might have.

 

Disclaimer: I have only done minimal testing. Your mileage may vary.


 

Edited by nugerumon
Link to comment
8 hours ago, whateverdontcare said:

So what does it do in total? What was the original mod like?

It provides a way to increase/decrease chances that a social interaction is romantic. The Mod Options allow you to set factors for various constellations.

 

I suggest you click the link in the first line of the opening post and have a look at the screenshot of the settings page of the original mod until I get my lazy ass motivated to make a new screenshot ?

Link to comment
  • 2 weeks later...

Sup!

 

This error message started popping up when RJW updated to 199e.

Spoiler

Exception ticking Mila (at (203, 0, 144)): System.NullReferenceException: Object reference not set to an instance of an object
at RomanceTweaks.RomanceAttemptRandomSelectionWeightPatcher.Postfix (single,Verse.Pawn,Verse.Pawn) <0x000df>
at (wrapper dynamic-method) RimWorld.InteractionWorker_RomanceAttempt.RandomSelectionWeight_Patch3 (object,Verse.Pawn,Verse.Pawn) <0x00520>
at Hospitality.Harmony.Pawn_InteractionsTracker_Patch/TryInteractRandomly/<>c__DisplayClass0_1.<Replacement>b__0 (RimWorld.InteractionDef) <0x00042>
at Verse.GenCollection.TryRandomElementByWeight<RimWorld.InteractionDef> (System.Collections.Generic.IEnumerable`1<RimWorld.InteractionDef>,System.Func`2<RimWorld.InteractionDef, single>,RimWorld.InteractionDef&) <0x000dc>
at Hospitality.Harmony.Pawn_InteractionsTracker_Patch/TryInteractRandomly.Replacement (RimWorld.Pawn_InteractionsTracker,bool&) <0x003fe>
at (wrapper dynamic-method) RimWorld.Pawn_InteractionsTracker.TryInteractRandomly_Patch1 (object) <0x0003d>
at (wrapper dynamic-method) RimWorld.Pawn_InteractionsTracker.InteractionsTrackerTick_Patch1 (object) <0x00154>
at (wrapper dynamic-method) Verse.Pawn.Tick_Patch2 (object) <0x003d7>
at (wrapper dynamic-method) Verse.TickList.Tick_Patch2 (object) <0x00497>

Verse.Log:Error(String, Boolean)
Verse.TickList:Tick_Patch2(Object)
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

 

Think it's from this mod?

 

//Thanks :D

Link to comment
11 hours ago, burkmannen said:

Sup!

 

This error message started popping up when RJW updated to 199e.

  Reveal hidden contents

Exception ticking Mila (at (203, 0, 144)): System.NullReferenceException: Object reference not set to an instance of an object
at RomanceTweaks.RomanceAttemptRandomSelectionWeightPatcher.Postfix (single,Verse.Pawn,Verse.Pawn) <0x000df>
at (wrapper dynamic-method) RimWorld.InteractionWorker_RomanceAttempt.RandomSelectionWeight_Patch3 (object,Verse.Pawn,Verse.Pawn) <0x00520>
at Hospitality.Harmony.Pawn_InteractionsTracker_Patch/TryInteractRandomly/<>c__DisplayClass0_1.<Replacement>b__0 (RimWorld.InteractionDef) <0x00042>
at Verse.GenCollection.TryRandomElementByWeight<RimWorld.InteractionDef> (System.Collections.Generic.IEnumerable`1<RimWorld.InteractionDef>,System.Func`2<RimWorld.InteractionDef, single>,RimWorld.InteractionDef&) <0x000dc>
at Hospitality.Harmony.Pawn_InteractionsTracker_Patch/TryInteractRandomly.Replacement (RimWorld.Pawn_InteractionsTracker,bool&) <0x003fe>
at (wrapper dynamic-method) RimWorld.Pawn_InteractionsTracker.TryInteractRandomly_Patch1 (object) <0x0003d>
at (wrapper dynamic-method) RimWorld.Pawn_InteractionsTracker.InteractionsTrackerTick_Patch1 (object) <0x00154>
at (wrapper dynamic-method) Verse.Pawn.Tick_Patch2 (object) <0x003d7>
at (wrapper dynamic-method) Verse.TickList.Tick_Patch2 (object) <0x00497>

Verse.Log:Error(String, Boolean)
Verse.TickList:Tick_Patch2(Object)
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

 

Think it's from this mod?

 

//Thanks :D

Well, I don't have any "null"-checks in place because the game should only calculate the romance chance for existing (and living...) pawns. Without looking at RJWs code I also can't imagine how the changes for 1.9.9e affect that. Have you updated any other mods? Maybe the game is broken? ? j/k only looking for excuses ?

 

If you have debug logging enabled, there's a slim chance the error occurs when looking up the pawn's name, so you can disable that. Errors still appear in the console, so you would know if that helped.

 

When I find the time I'll add some checks in RTMO-code to prevent such errors, though be prepared that most factors won't work if a pawn or its faction is null.

Edit: done

Link to comment
On 4/22/2019 at 10:53 AM, nugerumon said:

Well, I don't have any "null"-checks in place because the game should only calculate the romance chance for existing (and living...) pawns. Without looking at RJWs code I also can't imagine how the changes for 1.9.9e affect that. Have you updated any other mods? Maybe the game is broken? ? j/k only looking for excuses ?

 

If you have debug logging enabled, there's a slim chance the error occurs when looking up the pawn's name, so you can disable that. Errors still appear in the console, so you would know if that helped.

 

When I find the time I'll add some checks in RTMO-code to prevent such errors, though be prepared that most factors won't work if a pawn or its faction is null.

Edit: done

Thanks! :D

Link to comment
  • 3 months later...

Ok, so when I edit incestOpinionOffset at BloodRelationAttraction.xml, if I set it to zero or positive, there is no opinion in game. It is properly displayed only when it's negative. Is there a way to make it really positive?

Also I set incest attraction to 1, then 10, then 20, then 200, in the mod options, and had zero incestuous pairs for 7 years. But once I edited attractionFactor to 10 in that same xml file, I got 2 lover couples and 1 fiancee in just 1 season. I get it that these mod options don't work? Have RJW & Psychology.

Link to comment
12 hours ago, SexPlz said:

Ok, so when I edit incestOpinionOffset at BloodRelationAttraction.xml, if I set it to zero or positive, there is no opinion in game. It is properly displayed only when it's negative. Is there a way to make it really positive?

Also I set incest attraction to 1, then 10, then 20, then 200, in the mod options, and had zero incestuous pairs for 7 years. But once I edited attractionFactor to 10 in that same xml file, I got 2 lover couples and 1 fiancee in just 1 season. I get it that these mod options don't work? Have RJW & Psychology.

I thought I saw positive incestOpinion in my game but I may have imagined it. Could be hardcoded in vanilla RimWorld to not be positive.

 

Two possible reasons why a factor in the mod options might not work:

- Both RTMO and Psychology inject code after the vanilla romance chance calculation. RTMO applies a factor to the result, Psychology discards the result and does its own calculations (with kinsey scale and stuff). So it's important which mod comes first, because if Psychology runs first, RTMO can still apply the factors - to the result of Psychology's calculations. But if RTMO runs first, its factors are discarded with the vanilla calculations. I tried to make sure RTMO's postfix runs last (by some Harmony magic), but obviously Psychology wants to run last, too, so I didn't manage to have it work reliably. Is RTMO after Psychology in your load order? Do the other factors work? Try to look at the debug output, if two pawns get factors greater than 1, but don't romance, another mod overwrites the values.

- There's another bit of trivia: Before the whole romance calculation starts, another factor is calculated, and if that is too small, romance doesn't happen. I don't remember what exactly is used for that pre-factor, but in my experience, that other factor is large enough most of the time. Depending on various settings, traits, etc, it still might become a problem. Maybe. It's been a few months since I looked into it.

 

The xml values are probably not overwritten by Psychology but used as-is (maybe the authors didn't even think of someone editing them), so they still have an effect even if RTMO's postfix-functions are ignored.

Link to comment

https://imgur.com/SHbP4wk

The first two, the ones with 923% and 950%, are a father and a brother to this woman. Until I changed it to be 10 in xml, their attractiveness wasn't like that, it was like for everybody else, relatively near 100%. They're also attracted to each other about the same way. And other relatives are like that too. Babies aren't though, babies have some sort of strong, possibly nullifying, debuff. 

 

My load order is:

Psychology

RJW

RTMO

Sexuality source in RJW is set to RJW. Used to be psychology, but I didn't notice any impact of this change on relations.

 

Don't know or care about other options, I have them at default 1, except breakup chance which is currently at 0.05.

Link to comment

RTMO should output some numbers to the console if you have debug/developer mode enabled in RimWorld and enabled Debug Logging in RTMO options.

 

The numbers only appear if pawns chat, which could make them hard to miss if you have many other mods that print to the console. Those numbers are the romance chances, and romance is guaranteed to happen if these numbers are larger than one. If they are, but romance doesn't happen, another mod discards them and does its own thing.

 

Maybe Psychology does some other magic when romance happens. In vanilla RimWorld these pawns just become lovers (guaranteed if romance success chance is larger than one). Doesn't Psychology add dating or stuff? That might complicate things.

Link to comment

Is there a reason the BloodRelationAttraction patch checks the defNames instead of doing:

<Operation Class="PatchOperationReplace">
    <xpath>Defs/PawnRelationDef[familyByBloodRelation="true"]/attractionFactor</xpath>
    <value>
        <attractionFactor>1</attractionFactor>
    </value>
</Operation>

Also */PawnRelationDef is slower than Defs/PawnRelationDef

Link to comment

@nugerumon, do you mean messages like :

[RomTw+] SecondaryLovinChanceFactor Postfix | Nikita + Fish = 0.6060052 (gender+age) * 0.3250944 (health) * 2.3 (beauty) * 1 (age1) * 1 (age2) * 1 (same-age) = 0.4531204

?

These are never over 1 in my log for 12+ hours of playing. I do have another screenshot though. There's an example of typical RomanceChanceFactor for a relative and not a relative. Also I had a breakup while it's chance was set to 0.05 in the mod options, so I checked debug breakup chances in the same place as on a screenshot in previous message here, and it was like 0.04 or so for some pawn. 0 for others. So i changed it to 1, reloaded the game and noticed only a slight increase of that chance, also not uniform. I'd expect 0.05 to 1 is 20 times, but got the chance actually like 00.2 to 0.04. Then changed it back, in game without reload, looked closer, and noticed the exact change, like 0.74 <> 0.04 and 0.23 <> 0.01. Finally, when I set breakup to 0, it was completely gone from debug details. So I assume that the original mod options work, maybe the game reload breaks something, but more likely I was inaccurate.

 

Oh, and dates in Psychology are a totally separate thing, not related to normal romance much. A wedding without ever dating is totally fine.

Link to comment
On 8/24/2019 at 2:38 AM, tase said:

Is there a reason the BloodRelationAttraction patch checks the defNames instead of doing:


<Operation Class="PatchOperationReplace">
    <xpath>Defs/PawnRelationDef[familyByBloodRelation="true"]/attractionFactor</xpath>
    <value>
        <attractionFactor>1</attractionFactor>
    </value>
</Operation>

Also */PawnRelationDef is slower than Defs/PawnRelationDef

Yes, the reason is I didn't think of doing it that way.

On the other hand I think it's nice that the original relationship groups are intact in case someone wants to fine tune them. I'll definitely change it though.

And I always did "*/SomeDef" because I had the impression that's the best way to do it. If "Defs/SomeDef" is faster that I'll change that, too.

Some day...

 

Thanks for sharing your knowledge!

7 hours ago, SexPlz said:

@nugerumon, do you mean messages like :

[RomTw+] SecondaryLovinChanceFactor Postfix | Nikita + Fish = 0.6060052 (gender+age) * 0.3250944 (health) * 2.3 (beauty) * 1 (age1) * 1 (age2) * 1 (same-age) = 0.4531204

?

These are never over 1 in my log for 12+ hours of playing. I do have another screenshot though. There's an example of typical RomanceChanceFactor for a relative and not a relative. Also I had a breakup while it's chance was set to 0.05 in the mod options, so I checked debug breakup chances in the same place as on a screenshot in previous message here, and it was like 0.04 or so for some pawn. 0 for others. So i changed it to 1, reloaded the game and noticed only a slight increase of that chance, also not uniform. I'd expect 0.05 to 1 is 20 times, but got the chance actually like 00.2 to 0.04. Then changed it back, in game without reload, looked closer, and noticed the exact change, like 0.74 <> 0.04 and 0.23 <> 0.01. Finally, when I set breakup to 0, it was completely gone from debug details. So I assume that the original mod options work, maybe the game reload breaks something, but more likely I was inaccurate.

 

Oh, and dates in Psychology are a totally separate thing, not related to normal romance much. A wedding without ever dating is totally fine.

The RomanceChanceFactor in the screenshots looks about right, I've never seen the SecondaryLovinChanceFactor, though.

The lines I'd be looking for are

Quote

[RTMO] Romance Chance Pawn1 -> Pawn2: OldValue -> NewValue
[RTMO] Romance Success Pawn1 -> Pawn2: OldValue -> NewValue

 

Link to comment
  • 4 weeks later...
  • 2 months later...
7 hours ago, PinkyAndTheBrain said:

Why does the XML patch even exist for values which the mod has options for and which it is supposed to change?

Historic reasons. It existed before I added it to the scripted part.

 

Aso it might be (I'm not sure as it's been a while) that the attractionFactor from the xml is evaluated at a different stage in the whole social-interaction-becomes-romance-interaction process (I believe that there was a value with less factors, not influenced by the scripting part, that determined if the romance chance factor is calculated at all - might be misremembering that though - where attraction is taken into account). Anyway I decided to keep it in, that way the so inclined users can experiment themselves. ?

Link to comment
16 hours ago, whitehawk200 said:

So what are the default values for each option in the vanilla game?

This mod should be named "Romance Reset More Options" since everything is just at 1 lol.

A factor of 1 in this mod only means that the chance the base game calculates (based on random compatibility, opinion, etc) isn't changed.

If, for example, two of your pawns have a 5% chance of romancing, and you set all factors in this mod to 1, then that 5% are multiplied by all the 1s from this mod. What's 1 * 5%? Let me tell you a secret: it's still 5% :)

If you were to set an applicable factor to, say, 10, that means these 5% are multiplied be 10, becoming 50%, so about every second interaction becomes a romance attempt.

Which also means that pawns that hate each others' guts and have a 0% chance of romancing each other will always have a zero percent chance, because any factor multiplied by zero ends up being zero.

Link to comment
6 hours ago, PinkyAndTheBrain said:

Any chance of getting this with up to date source? I just wanted to set some break points in the code to see what was happening exactly, but the source is out of date :(

What do you mean? The sources included are from 22nd April, which was the last update that changed the dll. The update after that only changed the xml.

Link to comment
9 hours ago, nugerumon said:

What do you mean? The sources included are from 22nd April, which was the last update that changed the dll. The update after that only changed the xml.

Look at RomanceTweakMod.cs, identifiers for incestmodifiers are not legal for hugslib. Settings.GetHandle<float>("IncestModifier (Close)" etc. should be Settings.GetHandle<float>("IncestModifier_Close" etc.

 

Those might be the only things not up to date, but I can't really know whether they are or not.

 

Link to comment
4 hours ago, PinkyAndTheBrain said:

Look at RomanceTweakMod.cs, identifiers for incestmodifiers are not legal for hugslib. Settings.GetHandle<float>("IncestModifier (Close)" etc. should be Settings.GetHandle<float>("IncestModifier_Close" etc.

 

Oh. You're right. Well, then I guess it also doesn't work in-game but no-one had noticed yet? ?

I'll try to update soonish. There's also the previously suggested xml-changes.

 

Should I separate the incest-xmls to their own download, and if yes, should they be packed as a standalone-mod?

Link to comment
10 hours ago, PinkyAndTheBrain said:

The DLL works though, it uses identifiers with an underscore (I've checked in ModSettings.xml). I'm going to guess you quick fixed it and got the source out of sync.

Did some more digging and found another source, but it seems that the IncestModifier-Handles are the only things changed.

 

Edit: Made a new upload. No functional changes, only source and adopted the xml-changes @tase suggested. The xml-changes are untested, so if someone could report back that would be nice ?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use