JohN100x1 / IsekaiMod

An unbalanced gameplay mod for Pathfinder: Wrath of the Righteous
MIT License
19 stars 10 forks source link

Mod incompatibility: Dark Codex #134

Closed Mythalar closed 1 year ago

Mythalar commented 1 year ago

Hey, thank for the update it's great!

Was stuck on loading so I tried activating mods one by one (36...) and it seems that Dark Codex is the culprit here.

No issue with the others, but quite sad since DarkCodex is a great addition! Don't know what/if you need some logs or whatever.

JohN100x1 commented 1 year ago

how does dark codex conflict with isekai mod? what does it say in the logs?

Rinelw commented 1 year ago

It works for me just fine though.

Mythalar commented 1 year ago

Will look into this tomorrow evening, it must be a setting issue, perhaps the one that changes the psycho base stat

Mythalar commented 1 year ago

This is the end off the player logs :

[IsekaiMod] Null Value in selection of=156a6a1e62a24504a47c4d1e8b44982e [IsekaiMod] Null Value in selection of=2a9ee5e4e745461ebddf361a0aab060b NullReferenceException: Object reference not set to an instance of an object at IsekaiMod.Content.Heritages.IsekaiHumanCrossbreedLegacy.Patch () [0x0011a] in <4a9f668a01bb43b5852c37e07e6aaa46>:0 at IsekaiMod.Content.StartGameLoader_LoadAllJson.PatchHeritages () [0x00000] in <4a9f668a01bb43b5852c37e07e6aaa46>:0 at IsekaiMod.Content.StartGameLoader_LoadAllJson.Postfix () [0x0002e] in <4a9f668a01bb43b5852c37e07e6aaa46>:0 at (wrapper dynamic-method) Kingmaker.Blueprints.JsonSystem.StartGameLoader.Kingmaker.Blueprints.JsonSystem.StartGameLoader.LoadAllJson_Patch7(Kingmaker.Blueprints.JsonSystem.StartGameLoader,string) at Kingmaker.GameStarter+d__25.MoveNext () [0x003a8] in <00306b2fa77c4a0993735a8f1c2b44d1>:0 at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00026] in <25a85da7c6f04932b86e339dfd12957d>:0

There is no error in DarkCodex logs but I can attach the file if need be

kjk001 commented 1 year ago

what exact version of dark codex are you using? Dark Codex and its Descendent Expanded Elements are rather notoriously "friendly" when it comes to integration and require extra patching or handling, so my guess would be you are using an older version or a newer one that contains something unhandled and the only way to replicate would be to use the exact same version of dark codex... @Mythalar

Mythalar commented 1 year ago

I only ever use the latest version of any mods actually so 1.5.29 as if now.

Mythalar commented 1 year ago

So I downgraded DarkCodex step by step since you pointed some version issue.

The reported bug only occures on @Truinto 1.5.22 update and up (1.5.21 works).

kjk001 commented 1 year ago

Yeah, dark codex likes creating nullpointers that are not resolved till later that then screw over anyone trying to patch anything they touched, or in some cases never get resolved...

I will add handling to deal with it to the patch method or better yet an even later patch phase to run our code in, not sure if there are any though...

kjk001 commented 1 year ago

every single item on the following list contains a nullpointer after the phase BlueprintInit:

[IsekaiMod] ERROR: Unpatachable Feature= 637329bf936244668c55d81985c4eaf8name= Venom Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= e9021412e87847b3b104d4d31bfe5403name= Venom Infusion, Greater at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 96360bedde8648a8a6762e2de41b60a5name= Disintegrating Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= e9cf588e2ef64fb68d0ec8c566e8b294name= Dampening Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 8662ccb8dd484a2f8139d46621c641fdname= Enervating Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 3ae954ad56a2497b92fada3dc493b4e1name= Pulling Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= e53160d091914d50bfc1d8d4fa482e30name= Unnerving Inufsion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 922fd10e3e994d7793821da1583cdfeaname= Vampiric Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 987dc633dbae49b0adc11cd9c5672553name= Weighing Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 1cd0cd60997d4288be1fc85f753e53dename= Spore Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= fdc63fd61b794e40ba3c5446ba8ea1c2name= Toxic Infusion at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 56567887f604473797dc8223c68999daname= Toxic Infusion, Greater at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 94341284499343c0b5652f082bd677d1name= Self Telekinesis, Greater at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= c03b1a6d297843c584b763378024ea7aname= Telekinetic Finesse at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 8d3e9c13037d4d4f944887b517bbf86bname= Gravity Control, Greater at level= 2 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 70322f5a2a294e54a9552f77ee85b0a7name= Metakinesis — Empowered at level= 1 reason= Object reference not set to an instance of an object [IsekaiMod] ERROR: Unpatachable Feature= 562e997e20a34bc9a8d4624fa7151761name= Metakinesis — Selective at level= 1 reason= Object reference not set to an instance of an object

kjk001 commented 1 year ago

And the game compiles with the newest Dark Codex version for me again.

Either way convincing John that you need this as an emergency patch is on you @Mythalar or you just have to wait for the next regular release

Mythalar commented 1 year ago

Oh no need I can wait, currently theoricrafting my next 3 Isekai runs so no worries!

kjk001 commented 1 year ago

just use the older dark codex version in the meantime then

Mythalar commented 1 year ago

That's what I'm doing, thanks again :)

Was weird to me since it compiles without Darcodex but most of the errors (in your logs too) concern Kineticist Expanded Elements new features but I guess they are linked.

kjk001 commented 1 year ago

Kineticist Expanded Elements has Dark Codex as a hidden dependency, providing its own version of the darkcodex library dll for people that don't actually have Dark Codex. About half the code for Kineticist Expanded Elements is actually defined inside Dark Codex, so yeah, there is a slight link there...

Mythalar commented 1 year ago

Ok that's quite clear this way... X)

kjk001 commented 1 year ago

There should be a few rants on the topic amongst the closed threads here when the sheer degree of their interdependency got to me as I was trying to get the first Kineticist Legacy to work, still thinking that I actually need to know the guid-values of the different blasts at that point because I was handling them one by one rather than with a patch method and their guid-values as well as most of their code was missing in KEE itself.

Truinto commented 1 year ago

Tl;dr; I am happy to help, but you gotta tell me.


Dark Codex and its Descendent Expanded Elements are rather notoriously "friendly" when it comes to integration and require

Wow, that sounds quite condescending. I don't even know what you are referring to. Obviously there are patches that won't work together, especially if both mods try to do something similar. And I keep adding new features, so I keep making new patches. But I get rarely pinged for compatibility issues. I won't fix stuff I don't know about.

The reported bug only occures on @Truinto 1.5.22 update and up (1.5.21 works).

Thanks to git I can tell that there is literally no change in code on my part. Maybe there are new fields that I am unaware of.

Yeah, dark codex likes creating nullpointers that are not resolved till later that then screw over anyone trying to patch anything they touched, or in some cases never get resolved...

Can you elaborate that? I have very few features, which are finalized after everything else. I do that specifically for compatibility. E.g. for spell selection I get all BlueprintAbility last, since there could be other spells getting added, but I don't want to wait to introduce that feature last either because I need it somewhere else early. I think you are probably reading a field on all features without doing null checks, which works sometimes. But it obviously is better to check.

every single item on the following list contains a nullpointer after the phase BlueprintInit:

Can you tell me on which field? Tho, most of them are from Spencer, so I am not sure how much I can fix.

Kineticist Expanded Elements has Dark Codex as a hidden dependency, providing its own version of the darkcodex library dll for people that don't actually have Dark Codex. About half the code for Kineticist Expanded Elements is actually defined inside Dark Codex, so yeah, there is a slight link there...

It's a recourse... like BlueprintCore. I put a lot of my utility functions and components there. But the library doesn't do anything on its own.

There should be a few rants on the topic amongst the closed threads here when the sheer degree of their interdependency got to me as I was trying to get the first Kineticist Legacy to work, still thinking that I actually need to know the guid-values of the different blasts at that point because I was handling them one by one rather than with a patch method and their guid-values as well as most of their code was missing in KEE itself.

Oh yes. Kineticist is a nightmare to navigate through. There are so many blueprints. CodexLib has a class called KineticistTree, where I mapped all the guids. It made building new infusions a lot easier. You can probably copy that class.

Truinto commented 1 year ago

[IsekaiMod] ERROR: Unpatachable Feature= 562e997e20a34bc9a8d4624fa7151761name= Metakinesis — Selective at level= 1 reason= Object reference not set to an instance of an object

I set m_AppliableTo some time after creating that feature. Obviously because other mods could add new blasts (KEE does). I will set it to an empty array. I guess I could make a validation routine that checks that all features have a value on all fields.

If you have incompatibility with a patch let me know. I am happy to adapt my patches.

JohN100x1 commented 1 year ago

👀 an OG came to respond to slander 🙏 we apologise for any offence caused.

kjk001 commented 1 year ago

@Truinto if it sounded condescending I am sorry. It wasn't meant to its just that even if you try to patch stuff implemented in your mod with the very lowest priority that the game allows for initiating blueprints you sometimes still get nullpointers because blueprints are not initialized yet which can be frustrating for someone trying to hack their stuff onto it as addons.

kjk001 commented 1 year ago

As for the nullpointers inside the actual stuff you declare I actually think you somehow found a way around having to declare a component list on items of the type Blueprintfeature, thus allowing that list to be null while still being of that type rather than a BlueprintFeatureSelection or something else that is actually allowed not to have that list, or accidentally add a null component to the list somehow. There is a nullpointer somewhere in there but I will honestly admit that after finding a way to catch it I never cared to find exactly where as everything works anyway

Truinto commented 1 year ago

No offense taken. Was just surprised. So you think it's a component and not a field on a component that is null? Well, it seems like a good idea to validate that too. Feedback received :) Tell me, if I can do things to make your life easier.

kjk001 commented 1 year ago

Well looking at what we are doing when the nullpointer in the last patch occured it seems to be the component itself:

The original check was if (component is PrerequisiteFeature prereq) and we got a nullpointer fail, correction is if (component != null && component is PrerequisiteFeature prereq). And it was either that place or two lines above it the check if there even is a component list on the feature but that field is declared mandatory by the game itself

kjk001 commented 1 year ago

I am aware that your mod adds a lot of functionality beyond the basic lib and that the dark codex lib and the full dark codex mod could be considered two separate mods in a way.

But even so, Kineticist Elements Expanded leans heavily onto that library and quite a few of the classes that it needs like the KineticistTree are actually in this lib.

So thanking you and that lib for providing some functions and a bit of inspiration is about as honest as most of us modders saying we took a bit of inspiration from TTT-Core for our Primary Patch methods. Technically true and technically giving credit where it is due, but.... Honestly more credit should be given.

Truinto commented 1 year ago

The 'is' operator can never return null and itself never throws. I am very sure of that. if (someobject.Component is PrerequisiteFeature prereq) that could throw, if someobject is null.

Now you make me blush. You are welcome.

kjk001 commented 1 year ago

well the full codeblock now is:

                    if (print != null && print.Get() != null && print.Get() is BlueprintFeature feature) {
                        bool toPatch = false;
                        if (feature.Components != null && feature.Components.Length > 0) {
                            foreach (var component in feature.Components) {
                                if (component != null && component is PrerequisiteFeature prereq) {
                                    if (prereq.m_Feature != null && races.Contains(prereq.m_Feature)) {
                                        toPatch = true;
                                        if (prereq.Group.Equals(Prerequisite.GroupType.All)) {
                                            prereq.Group = Prerequisite.GroupType.Any;
                                        }
                                    }
                                }
                            }
                        }

new are the nullcheck on the Get() result in the first line, the one on the Components list and the one above.

While I did add a nullcheck on the Get result it never really should trigger because if a reference exists the item should exist too. In a similiar vein, while I did add the check for the components list itself the field is actually declared non nullable, so should never trigger either. That leaves either the component itself or the feature inside the component.

kjk001 commented 1 year ago

@Truinto ok so Componentsapparently is nullable, that is the null check that was triggered in all cases.

kjk001 commented 1 year ago

Though while we are on the topic of being patch friendly, anyone that declares something like: [HarmonyPriority(Priority.Last - 5)] can't complain when others put the fiendly in airquotes and I am saying that fully aware that we are just as bad because we totally violate that rule as well and are thus just as bad.

But in both Truintos and our defense far too many people declare stuff with priority last that has no business having that priority because it should be first or at least normal and thus make it hard to work within what should be the official range...

KoshiirRa commented 1 year ago

Could this be what is causing my saves to not load? I updated both DarkCodex and this mod yesterday. I can provide log data this evening if needed.

JohN100x1 commented 1 year ago

@KoshiirRa try the new release and let me know if it works

KoshiirRa commented 1 year ago

@JohN100x1 no dice. If I roll back to 4.3.0 it'll load. Respecced out of Iseki Protagonist, made a new save, updated to 5.0.3 and now I get a new error.

2023-04-19 18_54_32-Pathfinder Wrath Of The Righteous
JohN100x1 commented 1 year ago

Ok the reason it won't load is because it's incompatible. There are breaking changes in 5.0.0 because of removed features, so 4.3.0 saves won't load. It looks like there are lingering blueprints which no longer exist. You'll have to stick to the previous version to keep your save.

KoshiirRa commented 1 year ago

Sounds like its time for a speedrun then 🤣