[TALK] Dependencies, thingDef extension and how we make mods work together

Started by Sunspots, March 03, 2014, 12:28:50 PM

Previous topic - Next topic

Sunspots

I really wanted to make a discussion thread about how we want the system to handle multiple mods and how we can help each other to make mods work well with each other.

These are a few ideas that could work together in order for us to collaborate and build upon each other's work.

Dependencies: Building mods that are dependent on other mods doesn't really work at this state.
If I'm making a mod that extends the wood economy, for example if I make a simple mod that adds a wooden bed (which can only work when there is wood in the game). There needs to be a way for me to make sure that the wood economy mod has been loaded into the game before mine.
A decently simple way to do this is if we can add dependencies in the About.xml, before my mod loads, check that the dependencies are enabled, then load dependencies in a tree-like fashion from the top dependency down to my mod.
An extension to this system would be optional dependencies - if the dependency is enabled, load it before the mod, if it's disabled then continue anyway.

The second feature I propose for this ecosystem is a way for us to extend existing thingDefs (or any other defs maybe for that matter).
If I have a dependency(including the core) that contains a definition, but I want my extension to only change a specific value, I should be able to extend the original thingDef and only change/add a specific property, instead of copying over the entire object and overwriting it (possibly breaking every time the original object updates).

The third suggestion is something that's up to us as a community. Now that we start making all of these wonderful mods, we should think about how our creations can work together with the greater mod infrastructure, beyond simply how it affects the core game.

These are my thoughts on the subject. How do you, fellow mod-makers, think we could get good integration between our creations?

AcDie

Dunno yet, but we must do something, in my plans extend/get some content from other mods... Aloha guys, i stole your copyrights ;D
For e.g Wood Economy: i'm planning to add some types of fruit trees, well this may extend "WE" by adding more wood sources ;)
In other side community mod pack.. same problem here i think.. Btw, dependencies great work in X3:TC+

Rokiyo

This is something that has been on my mind quite a bit.

Has anyone done any research into how we can already influence mod loading order? For example are mods always loaded alphabetically? Or is there something else going on there?

If the mods are loaded alphabetically, we could get away with what we did in World of Warcraft before dependencies became a thing: Prefix our library mods with an exclamation mark so they'd always be at the top of the list.

The general idea would be that we'd work together to put out a few libraries that provide some common functionality, and then we'd try to avoid directly depending on each other's mods (instead preferring to depend on the same libraries).

EDIT: But yes, an actual dependency system would be much much better.

Ender

so, i'm not a modder (yet?) but, i was thinking of doing this sort of thing as well, as I do happen to know some JavaScript, C++, and enough about how Rimworld works that i was going to tie up all of the mods that I and most of the community thinks are good, And work good together so its just one download, and on button check on the mod list instead of, at least for me around 7 checkmarks. Though maybe someone else should, as i have a feeling I may not be the most skilled to do this.
The voices in my head tell me to burn colonists....

WorldOfIllusion

dependencies would also allow a modder to make a core mod and then have optional mods that extend it that can be added if a user wants to use them. This could be really helpful if a mod developer wants to add new content to a mod that will significantly change gameplay without forcing all users of the original mod to also accept that change.
Artistically challenged modder seeking artistically talented texturer's help. Please, please, PM me :)

Evul

Quote from: WorldOfIllusion on March 04, 2014, 03:38:38 AM
dependencies would also allow a modder to make a core mod and then have optional mods that extend it that can be added if a user wants to use them. This could be really helpful if a mod developer wants to add new content to a mod that will significantly change gameplay without forcing all users of the original mod to also accept that change.

I work this way :)

I think avoid changing and replacing core files is the key for mod corporation. As far as I know now everyone is making non replaceable core mods and that is awesome making the mods compatible. :)

AcDie

Are we talking about core changes or crossmodding (chains)..?
I thought about something like that: UserA made mod that makes oil, UserB made mod that uses oil and produces fuel, and so on...

Rokiyo

Personally I'm talking about the ability writing a library that does things along the same lines as the OreDictionary from the Minecraft Forge mod:

So...

  • UserA made a mod that handles resource registrations from other mods.
  • UserB made a mod that registers an oil resource and uses it to fuel a power generator
  • UserC made a mod that registers an oil resource and uses it as fuel a flame-thrower
Because both UserB & UserC registered the same resource with UserA's mod, the oils from both mods are automatically merged into one single oil resource, and is freely usable between both mods.

As long as we can ensure that UserA's mod always loads first, the rest should be technically feasible.

hawkwing

I don't know if me coming in here and saying "look at implementation X from this other game" is welcome, but as I think it is a VERY directly applicable example, I think I'll go ahead and bring it up.

There is a plugin for Kerbal Space Program, called  Module Manager, which is designed to handle XML-like mod overloading and dependencies (technically ksp mods are not XML, but it works the same way and is functionally identical, if not syntactically).

And it does so quite well, I might add, having made or modified a number of mods for it myself. It's mostly just a minor syntax change for mods looking to change or remove values instead of declare new ones.

Anyways, go ahead and check out the link above, it's got implementation examples on the first post. Given how well it is already proven to work in the KSP modding scene, I'd strongly suggest adapting it, hopefully by getting Tynan to implement the feature inside the xml parser.

Strictly speaking, mods wouldn't be pure xml anymore. It's basically a marked-up xml format that is easily readable and looks, to the casual observer, like xml. You can think of them a little like precompiler directives, I suppose.

TLDR: to edit an thingdef, you'd write "@" before opening the node.
@<ThingDef Name="BasePawn" Abstract="True">
@<eType>ModdedPawn</eType>
</ThingDef>
Rimworld mods are now available on The Nexus!
Rimworld Nexus
(Goodbye, 600kb upload limit!)

ItchyFlea

From the looks of it, having something like Module Manager could be beneficial, and likely quite important, to making otherwise incompatible mods compatible with each other.

I guess the main question is, how would it deal with situations where ModA changes the prices traders pay for potatoes, and ModB also changes the price, but to a different value?
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

joshwoo69

Then the user will be able to choose an option between both of them :)

Tynan

Quote from: ItchyFlea on April 04, 2014, 02:31:47 AM
From the looks of it, having something like Module Manager could be beneficial, and likely quite important, to making otherwise incompatible mods compatible with each other.

I guess the main question is, how would it deal with situations where ModA changes the prices traders pay for potatoes, and ModB also changes the price, but to a different value?

I think such mods are just logically incompatible. Without more information about the intent behind these changes, there is no way to merge their functionality together.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

I was already thinking of making my mods compatible with other ones. It would really be nice to be able to list the mods and decide some sub-behavior.

Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

mrofa

Shared components would be nice. I.e 2 mods have a workench, its the same workbench but  each mod add a diffrent recipe for it, so insted of replacing each other common component, there could be a way that just add the recipes from one mod to other mod workbench if its the same.
This would allow to make some common components on the forum for modders to share, since atm with a mod pack i think i got more diffrent workbenches on the list that my entire mod got furniture :D

All i do is clutter all around.

JinxWolf

Bare with me, I know very little knowledge then what i've picked up from reading and viewing others own comments, but I would like too add into this discussion if I may.. if it may help in some sort.

Okay, if as said in another thread by Ty that there's no such thing as global implications and everything basically exist in an object, right? Why not in the simplest way code a specific object of sub-behavior for modders to simply "add" towards. Even if its not a tangible object such as a workbench of some sort?

Like for instance, this mod.. by priority, both share the same resource. That's dandy, they both will be rationally compatible. Yet if another mod in some form of the idea changes the resource but they both collide, why not enhance a passive behavior? Like one is using nuclear, one uses solar energy.. but they're both a form of energy?

Of course I know this may not work for thing such of the nature as a mod that implements lawn chairs and another makes nutrient paste turrets or some form of  shenanigans. Just of those with similar behaviors? Noo? Okay  :-\