• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Reichl22

Sergeant
Mar 8, 2015
92
32
So, I started this in other topic, but Im feeling that this needs more clarifying. I didnt find it anywhere in this forum.

Question is simple as it is in the title: How do we know, if mods are working together?

Sadly the game is quiet broken in its original state (maybe somebody will tell that its not broken, just easy to play...ok) so we need these "hardcore elements fixing" mods...
 
Well if all the mods are doing what they are supposed to do, it works fine. I don't really see how a mod could break a different mod since they're compiled separately.
Could explain what you mean exactly?
 
What I was referring to is the following: Mods may swap out entire parts of the code. Now if you have one mod which modifies a part of the code and another mod which completely deactivates that part of the code or overrides it with their own modification, only one of the mods will take effect. Any mod tinkering with the AI will suffer from this drawback.
 
What I was referring to is the following: Mods may swap out entire parts of the code. Now if you have one mod which modifies a part of the code and another mod which completely deactivates that part of the code or overrides it with their own modification, only one of the mods will take effect. Any mod tinkering with the AI will suffer from this drawback.
If you override the code yes, however if you just put your code in the called method, I don't think it will override or cancel any other mods that use the same methods. As long as they don't override it either.
 
And how do you get your method to be called at all? You have to hook it into the existing code in some way. If you just use the modding API, you probably do not need to worry. To replace methods for the AI on the other hand, you must subclass. Then you need to exchange the existing objects with your custom implementations. If you have a better way of replacing the code, go ahead and explain it to me.

Edit: To be clear, you cannot just put your code in the called method. While the game being written in C# makes reversing much easier, it (ironically) makes patching and hooking at runtime much harder.
 
While not having played with MODs in this game, past experience in SC4 is that Mods that change the same thing will override each other and potentially cause issues. Usually the game just loaded the last one (by filename, which affected load order) and the earlier ones were ignored, but some stuff would break the game if loaded together. Terrain mods and ports were the worst culprits.
 
Copernicus, Inherit the class, copy-paste the method you need to change, change it, switch prefabs on load - that's the only way I guess. Maybe something similar could be done at runtime via reflection, but thats a big bag of dirty hacks.
 
This is just what I was saying -- and if two mods do this, you have a compatibility problem. I have spent the last three days looking for general a solution involving reflection or the use of Mono internal functions, but there is hardly anything to be done.
 
I use the Modding API ThreadingExtensionBase OnBeforeSimulationFrame() and OnAfterSimulationFrame() methods for most of my mods. Then I copy in the code from the related manager to loop through the buildings or citizens or whatever in the same way that the game does, essentially creating my own managers.

I identify the types of the AIs I am looking at if their type is equal to the one I am looking for or if they are a subclass of that type. Then I cast it to the AI type I am using and make calls, get and set data as needed. Some things are too locked up with private/protected for me to change much about them, but I've been able to do a few different things with what is available.

I haven't touched the AI classes because of the certainty of conflict between the mods that do. I'm not sure what can be done about that.