What would make the game easier to mod?

Started by Tynan, June 10, 2016, 04:01:27 PM

Previous topic - Next topic

keylocke

#210
can i suggest more tutorials?

there are many mod categories that plenty of modders can contribute on if there are more tutorials, since few people wanna scan all the xml defs files and trying to figure out which one actually does what, so tutorials can help minimize the repetitive effort required :

1)add/modify animal pawns : (FAQs) how to add or modify animals? what are the commonly relevant defs and an explanation for what it does. (ie : animal life stages, animal products through handling, animal products through butchering, etc..) can you force an animal to spawn at a certain life stage (baby)? can you milk them to produce chem fuel? can you butcher them and get components? etc..

2) add/modify humanoid pawns (pc/npc) : also good tutorial would be how to create custom playable/npc races

3) add/modify mechanoid pawns :

4) add/modify weapons/apparel :

5) add/modify furniture :

6) add/modify building :

7) add/modify crafting and work stations : this is probably more complicated than others.

etc..

post example tutorials of those things and you're likely to get flooded with tons of new mods adding content and graphics.

----------------

edit :

as an addendum :

look at adding a new animal pawn for an example. in order to do so you need to add entries to the following xml files stored in different folders :

-ThingDefs_Races > Races_Animal_YourNewAnimal : add a new xml file here to create a new "race" for your animal. has defs for move speed, attacks, life stages, graphics, draw size, market value, temp range, milkable/shearable/eggs, herd boolean, body size, hunger rate, food type, leather product, wildness, pack animal boolean, spawn biome, etc..

-ThingDefs_Items > Items_Exotic, Items_Resource_AnimalProduct, Items_Resource_Stuff : controls items spawned when animal is butchered, milked, sheared, or when laying eggs. : (defs defined here are called in ThingDefs_Races > Races_Animal_YourNewAnimal)


-Misc > LifeStages : it controls the lifestages, it's defs are later called in ThingDefs_Races > Races_Animal_YourNewAnimal

-Bodies > Bodies_Animal_YourAnimalX : defines the anatomy of your new animal

-RecipeDefs > Recipes_Surgery_RemoveOldScar, Recipes_Surgery_repairBodyPart : for healing your animal (refers to the defs defined in Bodies > Bodies_Animal_YourAnimalX)

^and the only reason why i know these things is coz i looked at the defs in an already existing mod, otherwise i probably would not have any idea which xml does what and which ones are interconnected with one another.

yet even with this as a guide, it's still quite confusing because of the interconnected defs/xmls and editing one file could break code if other affected xmls aren't edited as well.

so there should be a more easier way to add new content/assets.

Greep

#211
Quote from: Linq on December 24, 2016, 02:13:16 PM
I will sacrifice my firstborn to get Tynan to stop marking things private and forcing me to reflect them.

^ Pretty much this.  It's really awful for inherited classes in mods.  I'm sure it makes rimworld more stable, but I've basically just given into mass copy/paste instead for mods.  For instance, infinidrill is just a slight change on the deep drill, but it was just easier to paste it all and change 2 or 3 functions.  Which means if there's a bug fix in deep drill I'm going to miss it for my mod T_T

At the very least protected by default for classes that are predicted to have a low amount of child classes (i.e. 99% of concrete things in the game) would be so much nicer and have very little impact on the base game I think.  Making slight tweaks to existing things is a lot of what mods do and probably isn't as much what the base game does.  Don't kill me senior engineers :D
1.0 Mods: Raid size limiter:
https://ludeon.com/forums/index.php?topic=42721.0

MineTortoise:
https://ludeon.com/forums/index.php?topic=42792.0
HELLO!

(WIPish)Strategy Mode: The experienced player's "vanilla"
https://ludeon.com/forums/index.php?topic=43044.0

SpaceDorf

Not modding per se, but use and maintaining of mods :

Saveable Modlists

EdB's Modlist Interface -> active and inactive mods in two seperate lists.

Mods Sorted by name given in about.xml, not the name of the modfolder

Make Mode Version a required entry in the about.xml

select and move multiple mods at once.

hotkeys for activation/deactivation and movement of mods in the list.

sorting options for mods ( date, author, name, mod-intent* )

*intent being QoL, Content, Interface ..
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

roxxploxx

TL;DR: ThingWithComps as an interface. I think that would resolve an issue i'm having in creating a class PlantWithComps.

Basically, I want to add Comps to a Plant, for some really fun modding. But the two options I have for inheritance don't work.
* Inherit from Plant: If I create PlantWithComps inheriting from Plant, then when comps are added to PlantWithComps, the ThingComp.parent does not point to a ThingWithComps.
* Inherit from ThingWithComps: If I create a PlantWithComps inheriting from ThingWithComps, then all the classes that expect to operate on a Plant (ex. Designator_Plants*) all have to be rewritten.

As it is, I am recreating Thing-ThingWithComps functionality. If anyone has some syntactic sugar to resolve this, please let me know. I'm not a native c# dev.



skullywag

Spitballing but could you not have plantsWithComps extend Plant and copy all the thingWithComps into that new class. Therefore smushing everything together....I dont think theres any other way right now.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

roxxploxx

#215
Tried it. When PlantsWithComps (with copy/paste ThingWithComp code) instantiates its ThingComps (PlantsWithComps.comps), the ThingComp.parent is typed as a ThingWithComp but PlantsWithComp inherits from Thing, so it can't be cast as a ThingWithComp.

Now I guess you could create your own MyThingComp and do `public new PlantWithComp parent`... and that might work for all your own comps, but not any of the existing comps since they would not inherit off MyThingComp.

Good thinking, but bummer.

I wish I could have brought this up earlier as there may have been a possibility to have this incorporated into A17. It probably wouldn't be a hard fix with a code refactoring tool on  the RimWorld code. It wouldn't break existing plugins if an interface were used.

I'm creating an example for my own code so I should have a demonstration shortly. I'm using it basically as a complete reimplementation of Components for my own needs. I guess if I need an existing component, I can at least copy/paste that component in pretty easily.

roxxploxx

Here is functioning code to extend any "Thing" class in the game with Component-Like functionality (existing components can't be used because of their fixed types). In my case, I am using this code to add functionality to plants (Plant does not extend ThingsWithComps so current Components can't be used). See the Druid plants in my underdevelopment mod Unifica Magica which can spawn Entangling Vine Plants and Exploding Ferns.

Here's my Tutorial page for ExtendedThing.

Feedback welcome!


tiltos

Quote from: hemebond on January 09, 2017, 06:38:25 PM
As a newbie Rimworld modder I was surprised that it was impossible/difficult to just override textures and items. I expected mods to "stack", overriding any resources/definitions lower in the mod list. This is how most games I've modded/played seem to behave.

Just changing a texture means having to put the file into the Core mod directory or duplicating the Thing definition in the new mod directory.

100% this. Texture updates should really be a basic image override, and contextual of the mod hierarchy. This should also apply for _all_ textures (rather than needing to define graphics_linked etc).

Totally understand rolling up the sleeves if textures are different dimensions, but the basic updates should be super easy.

O Negative

Would be awesome to be able to customize the meshSize of an equipable item, mostly with respect to weapons.

If you want a gun to be huge, you pretty much have to make it a square, and that takes away from the creativity of it all.

I know Ohu accomplished this in his faction color mod, but it would be a great feature to have in the base game for some of us xml plebs :P

Fluffy (l2032)

I'd love to see the tags for PawnCapacityDefs defined in XML, possibly in some form of StatOffset. Currently they're all hardcoded in the various CapacityWorkers, making it impossible to know what body parts affect what stat.

Thundercraft

#220
Things that would make modding easier: A built-in system to do xml patches and overrides.

Though, I feel such are more important to ensure better mod compatibility and less headaches for modders, such as making mods easier to maintain. I talked about this in the Proposal: .patch system for better mod compatibility thread.

Granted, there is notfood's MFO (Mod Friendly Overrides) and AlcoholV's Ac-Override Injector. I've used both and both have their strengths. But both systems also have their limitations. And these rely on a modder maintaining them for each update. If not, mods that rely on them could be left up a creek without a paddle.

... I was going to also mention the need for a better way to do code injections. But, I just read that HugsLib now uses Harmony library, which is supposed to be a much better practice. So... never mind.

Edit:

Never mind... I just found out about the new PatchOperation system. That's pretty much what I was asking for.

kaptain_kavern

With the new patching possibility it could be nice to have way of triggering a patching "when something happen" in game. Like a research or a comp...

JT

#222
Currently, the only error produced if a PatchOperationSequence fails is: "[modName] Patch operation Verse.PatchOperationSequence failed"

This provides no information regarding the filename or structure of the failing sequence, nor which operation failed, which essentially means that the entire mod has to be discarded and then reassembled piecemeal until the failing sequence is located.  If the message could reproduce the failing node either in the log or as part of the crash message itself, it would simplify identification of the cause for error.

If nothing else, a subnode <log>My error message here!</log> for the <Operation class="..."> or <Operation class="PatchOperationSequence"><operations><li class="..."> nodes which will print the user-specified log message to the console when the operation fails would be most welcome.

[edit] It appears that root Operations do produce full messages as to what operation has specifically failed -- it's simply PatchOperationSequences that don't.

Weyrling

Quote from: kaptain_kavern on June 16, 2017, 11:47:07 AM
With the new patching possibility it could be nice to have way of triggering a patching "when something happen" in game. Like a research or a comp...
I'm not sure how you think this should work, but trying to patch files during run time would be a lot more complicated than it sounds.

I imagine what you want is the ability to replace a thing with a different thing when a condition is met, which could be useful for a ton of things.

CosmicDan

#224
I like how Tynan asked if modders could talk together about the major important things, but then almost a year later we still have newbie modders asking for every single little hardcoded thing to be moved out of the code and into XML...

Guys, just learn C#. Seriously, it's not THAT hard. This is the most modable game without direct programming knowledge I've ever seen (except maybe for Westwood's old C&C games), and so many are STILL unhappy  ::)

Quote from: JT on June 26, 2017, 09:04:01 AM
Currently, the only error produced if a PatchOperationSequence fails is: "[modName] Patch operation Verse.PatchOperationSequence failed"

[snip]

It's pretty easy to just diagnose this yourself. Just move each operation outside of the PatchOperationSequence and see which one fails. "(The) entire mod has to be discarded and then reassembled piecemeal" is a massive exaggeration - you dont NEED to have them inside a PatchOperationSequence to work; the whole point of PatchOperationSequence is to do multiple patches based on preconditions. But when you're developing yourself, you're in full control of the preconditions and environment. So just move them outside of the sequence to debug yourself - it's not that complicated.

Quote from: Weyrling on June 27, 2017, 02:42:28 PM
Quote from: kaptain_kavern on June 16, 2017, 11:47:07 AM
With the new patching possibility it could be nice to have way of triggering a patching "when something happen" in game. Like a research or a comp...
I'm not sure how you think this should work, but trying to patch files during run time would be a lot more complicated than it sounds.

I imagine what you want is the ability to replace a thing with a different thing when a condition is met, which could be useful for a ton of things.

This is already possible, it's called "write it in C# and compile an assembly". Patching is for modifying XML definitions, but you're trying to do runtime logic. You can't do runtime logic in definitions - this is the whole point of coding.

And if you think that's too hard, it really isn't. I've modded a lot of games in the past, and the RimWorld wiki with Harmony library and Visual Studio is some of the easiest and most powerful modding I've ever seen. Two days ago I didn't even know C# (albeit I am a Java developer by profession) and today my WIP mod replaces Steel with Iron Ore and makes Iron Ore > Steel production (done only via XML and Patches) and I've also managed to make Charcoal from cuproPanda's Powerless! Mod and Coal from Black Fuel mod act as a fuel that is 3x as potent a fuel source as wood (done via C# and the Harmony library).

Considering how great the Harmony library is, I don't consider *any* of these features as important - they can already be done. What WOULD be nice is a pre-patch system that runs before XML loading, or some kind of automatic *Def Name attribute resolution so we can use ParentDefName="AParentThingDefToInheritFrom" - but the chances of developers ever seeing these serious technical requests are likely slim because everyone spams all these open-ended and vague wishes that are extremely novice things that only lazy or unpracticed people would have trouble with.

No offense, it's just frustrating seeing so few legitimate concerns that are lost in the screams of amateurs.