Suggestions for modding compatability.
Posted: Thu Mar 10, 2022 8:55 pm
Just so we have an official Post about it
I already suggested this in the Roadmap thread but i think it might deserve its own thread incase other people want to add to this
"Hello Elliot,
Its me, that annoying guy that was harrasing you for code mods the last few months. Thanks for the headsup!
I also have a suggestion for modding compatibility espacially for XML.
Rimworld is one of the best examples on how it should be done. Basically there is something called "patch operation" and "xpathing"
You can create a new xml that has certain operations and requirements attached, that get read by the engine and modify xml files on runtime. (this is only a simple explanation, but the things that can be done with it are huge)
I would highly suggest checking out this post: https://rimworldwiki.com/wiki/Modding_T ... Operations
once you read into it, you will realize that its basically the holy grail of compatibility between many mods and has proven to be the foundation of rimworlds modding scene. I dont know of any other game that uses this system, atleast not in xml.
One example is: PatchOperationFindMod. With this you check for loaded mods and only if another mod is present, the actual operation runs. This can be combined with many others like: Patchoperationconditional, basically this will check for a xml node and if present it will atach itself to that xml node
"PatchOperationConditional can branch logic based on a match/nomatch. The following example patch adds a <comps> node if it does not yet exist, and adds itself"
This basically allows mod authors to create cross mod compatibility and also allows mod authors to attach their own xml snippets to other mod authors xml node. Depending on load order you could add snippets to snippets indefinetly.
The whole system is also fairly easy to implement code wise compared to some very complex api that is supposed to handle this and provides much deeper control for authors.
Hope i could be of some help!"
Any other suggestions to make modding as great as it can be? Just pump them out. I think it is always good to make suggestions that benefit everyone.
I already suggested this in the Roadmap thread but i think it might deserve its own thread incase other people want to add to this
"Hello Elliot,
Its me, that annoying guy that was harrasing you for code mods the last few months. Thanks for the headsup!
I also have a suggestion for modding compatibility espacially for XML.
Rimworld is one of the best examples on how it should be done. Basically there is something called "patch operation" and "xpathing"
You can create a new xml that has certain operations and requirements attached, that get read by the engine and modify xml files on runtime. (this is only a simple explanation, but the things that can be done with it are huge)
I would highly suggest checking out this post: https://rimworldwiki.com/wiki/Modding_T ... Operations
once you read into it, you will realize that its basically the holy grail of compatibility between many mods and has proven to be the foundation of rimworlds modding scene. I dont know of any other game that uses this system, atleast not in xml.
One example is: PatchOperationFindMod. With this you check for loaded mods and only if another mod is present, the actual operation runs. This can be combined with many others like: Patchoperationconditional, basically this will check for a xml node and if present it will atach itself to that xml node
"PatchOperationConditional can branch logic based on a match/nomatch. The following example patch adds a <comps> node if it does not yet exist, and adds itself"
This basically allows mod authors to create cross mod compatibility and also allows mod authors to attach their own xml snippets to other mod authors xml node. Depending on load order you could add snippets to snippets indefinetly.
The whole system is also fairly easy to implement code wise compared to some very complex api that is supposed to handle this and provides much deeper control for authors.
Hope i could be of some help!"
Any other suggestions to make modding as great as it can be? Just pump them out. I think it is always good to make suggestions that benefit everyone.