What would make the game easier to mod?

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

Previous topic - Next topic

SpaceDorf

A Scrollbar or Resizable Pawn Character Menu.

Some Mods add Skills that can't be seen on the menu, because there is no room.
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

sera13

I vote for more XML documentation. For example there are some fields that aren't in the current xml documentation but exist, such as race immunity gain speed. Also maybe some explanation on what differnt things do.

GiantSpaceHamster

I'm going to use a specific example of a situation I ran into recently, but this concept applies to a lot of areas of the code base.

RimWorld has a sort order for displaying colonists, represented in the colonist bar (ColonistBar.cs). The logic for generating this sorted list is in a private method within ColonistBar.cs. This makes it difficult for mods to use the "RimWorld" sort order for pawns to present data in the same order. When the colonist bar is enabled, the public accessor ColonistBar.Entries provides the sorted list, but when disabled the list is empty. If there was a way to retrieve the sorted list of colonists regardless of whether the bar was enabled or not that would be helpful (whether that would be populating the entries even when the bar is hidden or a separate method somewhere else that the colonist bar uses).

More generally speaking there is a ton of business logic that's private or embedded in methods that do more than just that thing which forces mods to copy large chunks of RimWorld code, which is a maintenance nightmare. I realize that the reason the list is not being generated when the bar is hidden is to not run the calculations for generating the list, but I think there are going to be situations where such state-dependent calculations may be desirable by modders regardless of whether or not the one feature in the vanilla game that uses it is enabled at the time or not.

Wishmaster

That would be really great to allow us to easily detour methods without destroying original ones.

There is a common method used on some windows functions.

In the beginning of every method's code are filled with "nop" assembly instructions. A certain number (5 ?), enough to fit a "call" or "jump" instruction to the detouring method.
The new method that could decide whether to call the original method or not.

Tutankhamun

Being able to edit a pawn available skin/hair colors and body shapes through the race xmls. I tried to edit those things by decompiling the Assembly-CSharp.dll only to get errors while trying to generate a new world.
I just wasted 65 minutes of my limited lifespan trying to do a thing that could have been done in 5. And this is not fun at all.

dniwe_kore

can you please move DamageArmorCategory and other damage/armor stuff into xml's from .dll? It will make modding/adding weapons and armors more vary, and modding/adding types of damage/armor much easier and handy.
i know, my english not so ugly as mine

skullywag

Quote from: dniwe_kore on February 24, 2017, 09:38:34 AM
can you please move DamageArmorCategory and other damage/armor stuff into xml's from .dll? It will make modding/adding weapons and armors more vary, and modding/adding types of damage/armor much easier and handy.

Not sure what you mean by this, projectiles deal a damagedef, the damagedef has the armour category on it. This is already available in xml. Might need to explain exactly what you want to do here.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

dniwe_kore

#202
i wanted add new armor type to minimize stun duration, instead of blunt armor type. But because of DamageDef
public DamageArmorCategory armorCategory;
i can't. I'm bad at coding, but i guess vanilla DamageDef takes armor types from vanilla DamageArmorCategory. And if i'm going to add new armor types, i guess i should add them into vanilla DamageArmorCategory, changing CSharp library.
Also i guess interface takes values from DamageDef, so adding my own DamageDef will cause more stucks for me.
Of course i can change default types of armor(blunt+sharp to pysical, free blunt to blinding defence for stuns), but having opportunity to add new will be useful and good.

I'm sorry, if i'm wrong and if atm i aleady can add armor types.

[attachment deleted by admin due to age]
i know, my english not so ugly as mine

Sam_

What would make the game easier to mod is the implementation of hard and soft dependencies.

A few people have mentioned dependencies in general in various places but from what I have seen they usually only refer to hard dependencies. I've just recently started modding on a new project with Rimworld, but I've run into issues with implementing a modular modpack. It's easy to implement hard dependencies outside of the game simply by saying 'You need Mod-Core loaded to run Mod-1 and Mod-2", but what about the issue where Mod-3 could be standalone, using vanilla recipes and resources, but if Mod-1 exists then use resources from that instead.

An example I have is with a building that uses the stuff categories. It is in a standalone mod using this:

<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
</stuffCategories>


But, another mod I have which could be loaded before adds a lot of materials, specifically a Plastic stuffCategory. I could make the mod have a hard dependency and just define it as:

<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
<li>Plastic</li>
</stuffCategories>


But, the point of this post is the case where <li>Plastic</li> needs to be optional. I'm just thinking of a system I would add, or looking to add with my own assemblies but considered also posting here, which can define hard and soft dependencies. One option I have only considered so far is having an .xml in the About file for dependencies, defining each as hard or soft, prompting the user when a hard dependency is not met, and then for soft dependencies using xml attributes to define the correct block to use. So, to use the above example to illustrate you could have;


<ThingDef Name="Bench" Abstract="True">
<allOtherElements/>
</ThingDef>

<ThingDef ParentName="Bench" Dependency="None">
<DefName>Bench</DefName>
<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
</stuffCategories>
</ThingDef>

<ThingDef ParentName="Bench" Dependency="Mod-1">
<DefName>Bench</DefName>
<stuffCategories>
<li>Metallic</li>
<li>Woody</li>
<li>Stony</li>
<li>Plastic</li>
</stuffCategories>
</ThingDef>


Obviously the issue here results in how to handle the default option, or what to choose when Mod-1 isn't loaded. Instead of None maybe Default when no other dependency is valid. Also, what do you do with multiple soft dependencies.

I originally thought of this when I was making a mod for Factorio, in which modders use LUA instead of XML files to mod the game. The soft dependencies are enforced using standard conditional logic such as "if Mod-1=true then load this else load this". So, I'm looking into how I could add something similar to Rimworld, even if I have to hardcode my mod packs dependencies in an assembly somehow.
I'm not even sure if this is feasible to mod this in Rimworld in it's current state, or how much I would have to break to make it happen, but this is an idea I had that resolves a large number of issues with my current project that I thought I would share.


white_altar

@Tynan, it seems when reading through the posts in this topic, the requests seem to center around two Major Focii:

1.) Please provide thorough documentation.  (for example there a lot of "I heard that", "I noticed that", and "[So and so said]", comments in the forum as well as direct requests for docs.)

2.) The other one is "Public Classes".

3.) The third seems to be a wash.

My own opinion would be to make the 2 classes of Coders happy by Giving them solid templates or docs re XML files, for the XML folks, and then public classes more often, as well as hopefully comments or documentation in say, "Verse", "Rimworld" and "Verse.Sound".

AngleWyrm

Suggestion: Built-in Profiler
In the central time slice distributor/visitor track the portion of time spent in each mod and make that a visible pie chart in-game, when in developer mode.

The purpose is to apply some sense of competition for best use of the limited CPU cycles through easily understood comparative performance. It would help catch those "just for now" hacks that create lag.
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

WalkingProblem

I not sure if its been mentioned:

I think there is a need to change how we add animals into the various biomes. Because every mod that adds new wild animals tend to replace the same biomedefs xml files; as a result, there is a conflict. 

just my 5 cents

Multistream

It would be good if there were some templates for mods. Like we just need to draw a weapon/animal sprite, change some parameters in that template like health, dps, where it spawns, etc. And the mod would be ready

Wishmaster

Quote from: AngleWyrm on March 04, 2017, 09:16:18 PM
Suggestion: Built-in Profiler
In the central time slice distributor/visitor track the portion of time spent in each mod and make that a visible pie chart in-game, when in developer mode.

The purpose is to apply some sense of competition for best use of the limited CPU cycles through easily understood comparative performance. It would help catch those "just for now" hacks that create lag.

I would prefer to use the CPU use for every function (or at least a limited amount). therefore for every mod aswell.
Often I would like to see that part of a single mod is spending much CPU time.

The-Eroks

Quote from: Plymouth on June 10, 2016, 05:13:37 PM
I know it is a far call, but in case of changes, a sort of converter from old XML parameters to new ones would be a nice thing to have. Of course it is not something necessary, only very handy. Would save a lot of time in mod updates during alpha transitions, if such a program existed.

That would be a massive and ongoing project, so I'm afraid it's a bit out of the cards. I'm really looking for simple things that'd be useful forever.
[/quote]

I just got into this mod scene with [A16]... has this a big problem in the past? I already have a python script that basically does exactly what you're asking for (for a different application) --it would be rather straight forward to reconfigure it for RimWorld mod updates/conversions.