[A17] Reinforced Indiscernible Power Conduits (16/jul/2017)

Started by faltonico, January 05, 2017, 08:29:36 AM

Previous topic - Next topic

alkor

Quote from: faltonico on July 20, 2017, 05:04:16 AM
I had forgotten about this question here xD
Thank you for your reply!
Somebody answered that question for me not long ago. Indeed, I don't need to copy the abstracts, but now that it is copied, as long it is the same as in Core, it doesn't do any harm, other than an additional check for me the moment i update the mod to the next alpha. Well at least that is what i understand of it. If another mod wants to change the Core def on purpose, welp....
The thing is - the "welp" part is the important part, and I was arguing that unnecessary redefinitions *are*, well - can be, harmful.

Even in your case, something as seemingly harmless is the cause for this chain of events:
1) Vanilla BuildingBase is defined as a /Defs/ThingDef, yours is defined as a /ThingDefs/ThingDef instead.
2) So, in order to patch BuildingBase, I can't just target /Defs/ThingDef[@Name = "BuildingBase"], because plenty of mods redefine the bases for no reasons, under different locations, with inconsistencies in values (the bigger your mod, the more redefinitions you included, the easier it is to overlook that a vanilla value changed and you didn't reproduce the change - plenty of popular mods out on here which suffer from this).
3) As such, I have to target */ThingDef[@Name = "BuildingBase"]. Which effectively targets not just core - in which case I could skip the glob match because I know the exact path of the def - but all loaded packages. The operation is slower in and of itself.

Now, the person who actually pays for this is the player who has to sit through an extended loading time on each game startup.

You have to remember that a mod can exist as a single entity next to core, but it can also sit next to 100 other mods. And it really isn't that loading 100 mods takes a long time - but the time grows exponentially because many mods follow bad practices, not because the game is poorly coded. The game can't make certain optimization decisions without making some assumptions (considerably) limiting our ability to mod it (with just XML anyways). And it's *great* that it doesn't, speaking as a modder and programmer, but speaking as a player - sometimes I wish it did.

Imagine, as an example, 100 mods redeclare BuildingBase (because it is "harmless").
1) During normal resolution (without or after patching), BuildingBase gets resolved 100 times (objects for the def get created, then * 10-or-so objects for its properties and attributes, then those get read in, then inherited and merged/overridden...), one after another, 100 times. All of which - completely unnecessary.

2) During patching. It becomes even more convoluted. Imagine 100 mods which redeclare BuildingBase and then a handful others simply patch BuildingBase. Now "simply patching" happens 100 times the number of mods which apply a patch, per each patch operation - instead of just once per patching mod, for the core definition they actually intended to patch. Now imagine we want to replace not just one value, but several. This cannot be done in a single operation, so if I wanted to change a single "true" to a "false" somewhere, and then a "1" to a "0.8" somewhere else, this is not 2 operations - it becomes 200.

And step 1), the resolution of those defs, along with its own issues, happens afterwards on top of that.

Bottom line - this happens more often than necessary, consumes time and resources of the player, so I wouldn't call it harmless.

I'm aware that this an unrealistic example, but the same principle applies to every other redeclared def, abstract or not, in every single mod out there. So while it may not exponentially stack up to 100 times for a single def, it'll still happen in a manner of "one redeclaration here, one redeclarion there", and suddenly we're performing thousands more operations than necessary.

Apologies for another lengthy message, especially since my rant isn't really directed at you, but more generally at a lack of good neighbour policies and conventions in RW mods :P I'm aware it's not due to people's bad intentions or not giving a damn, but more often than not just outdated (or lack of) information and understanding.

Quote from: faltonico on July 20, 2017, 05:04:16 AM
Regarding your other question, i really don't know, but i think it is possible =D
In the help forums you can get help if you have an idea:
https://ludeon.com/forums/index.php?board=14.0
I did not really ask a question - but,... appreciated ^^

faltonico

Quote from: alkor on July 20, 2017, 11:35:01 AM
-Snip-
Apologies for another lengthy message, especially since my rant isn't really directed at you, but more generally at a lack of good neighbour policies and conventions in RW mods :P I'm aware it's not due to people's bad intentions or not giving a damn, but more often than not just outdated (or lack of) information and understanding.
No problem at all, i do appreciate you taking your time to explain that to me in such a nice way (effectively a noob at modding). And that makes sense because my game does takes a lot of time to start, but i have a ton of mods as well (2:10 m - 200 mods!). I thought about updating but i didn't know if it would break games (probably not). I'll test it and see what happens.

And I know it wasn't a question you made, I did't pick the appropriate word, just blame my poor English -_-'

ShEsHy

Is it possible to make it so that these conduits replace the vanilla ones (like floors do) and when a building is placed on them, they disappear? It drives me crazy that half of my base is covered with vanilla conduits and the other half with the reinforced ones