What would make the game easier to mod?

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

Previous topic - Next topic

CannibarRechter

#105
Thank you, and understood. I'll look into that. I think the request remains the same, though. The base game should offer the ability to do this, either through incorporating CCL (as previously discussed in this thread), or doing something similar.

Edit; you said "methods". Does a Detour permit overriding of the Core XML/load data?
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

1000101

There is no way the game can change the behaviour of the C# compiler or .Net runtime. What you are asking for is something that is simply impossible.  There is nothing Tynan can do to change how the programming language, compiler, and .Net runtimes work.

C# is a strongly typed object-oriented language.  You cannot add to a class without inheriting it and if you want the new features to carry forward you need to write new child classes which inherit from your class.

In fact there are no programming languages that would allow what you are asking for.  Even loose cruddy ones like Java and Javascript.

What you can do is write extension methods, write your own child class with the functionality you want, and/or use CCL to detour a method or multiple methods.

Really, those are your options.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

CannibarRechter

I don't know why you are talking about the C# compiler or the .Net runtime when I am referring to the XML files the game loads from the Defs directories. It appears that you are saying that there is some strong relationship between that XML and the CLR, but a modder who hasn't touched the game code can't really know that.

As for your sweeping generalization (there is are "no" programming languages that can do that), I would encourage you to cease speaking so grandiosely. Plenty of dynamically typed languages allow runtime modifications of the basic class definitions. Python for example.


CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

1000101

#108
python isn't a programming language, it's a scripting language.  There's a difference.  Although I will agree that the blanket statement of "no" isn't 100% accurate but in C# it's is accurate.  But then, all general statements are false.

And in RimWorld there is a direct relationship to the xml and C# classes.  Every xml class is a C# class.  The tags are the C# fields of the class.

(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

CannibarRechter

There are *compiled* languages, like lisp, that have all sorts of dynamic properties. I wouldn't be surprised at all if you could modify a base class at run time in lisp. I would bet a lot of money you could. Scripting languages are programming languages, and it is common to refer to them that way. Consider this IEEE article: http://spectrum.ieee.org/computing/software/the-2015-top-ten-programming-languages. In it, Python is acknowledged to be presently slightly more popular as a programming language than C#.

On the topic, will the CCL detour permit the override of a getter, and therefore permit you to override the fetching of basic attribute data for a class?

I understand that the design of the game is what it is, but it is a bit unfortunate in this particular use case, as it makes certain kinds of modding activities more difficult.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

1000101

Well, let's leave the debate on what separates a programming language from a scripting language aside as it's non-productive.  :)

As to CCLs detouring and property methods (getters and setters) the short answer is "yes" and the long answer is "yes, but."

The "but" in this case is that if the method (any method) is shorter than 32-bytes of IL code then the JIT marks it as a candidate for inlining (not guaranteed that it will, but it's a candidate for).  Further, generic methods also have issues with being detoured.  So far nobody has seemed to crack the issue to find a way to detour those but in theory they can be detoured.

I suspect the issue with generics is that the compiler creates a template for the method and then creates the proper method at runtime depending on the circumstances of its usage.  Without knowing what the method name of the circumstantial usage is, it seems to be almost impossible to make it work correctly.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Tapkevich

I've got some, its about how slaver create slaves for trade. Now it just pick any race that have intelegence = Humanlike and put them in his stock. They problem i have, is that i cant strictly define what race\faction slave will belong to. I need it mostly becouse i want to use mechanics of game to support lore of races and factions i have ingame. So situations, when slavers race sell member of their own spicies do not happen ingame.

So i suggest, to change criteria slaver use, or add additional, so we can specify what race\faction slaves he can acquire during stock generation.

zlj

Would you kindly change the SkillRecord => pawn attribute from private to public or protected so it can be accessed from a derived class (imo that (being able to access base class objects from derived classes) should be the case for all objects, if you want to make things easier for modders ;) ).

Additionally a way to override/detour get/set methods (this apparently doesn't work with CCL if i read the above entries correctly), would also help.

Thanks

Master Bucketsmith

#113
I'm really new to XML and C# and modding with it. The thread has become so large that it's a lot to read so excuse me if my proposition has already been noted.

Unless I'm wrong, I noticed that certain things work with a radius. Explosions, light, affected areas to some effect, it's all circular and based on a radial value, right?
Since this game is based on square tiles, I'd love to see options to define in, let's say, a square or rectangular way. Or perhaps even a rough triangle. Light armatures in real life do a good job of shaping the area that its light directly shines on. I'd love to be able to make TL armatures for the game that light up a rectangular area.
I'd love to be able to easily make a big spotlight 'turret' that has a triangle shaped beam of light shining onto the target.
Or as another example perhaps a claymore mine that explodes in a triangle area in front of it.

EDIT: As someone with ADD, having the eventual long list of mods and having to figure out the right load order when multiple mods have their own dependencies is often reason for me to stop playing a game for a while. I've always run into that problem with the X3 series of games. There's too much info, too much 'cross interference' so to say, too much to figure out where what mod goes in the load order.
So as a user (and testing mods and compatibility), modders having the ability to set up their dependancies and loadBefore/loadAfter + a system that automagically solves (or at least attempts to) would mean the world of a difference!
Also, being able to easily move mods around in the mod list would be nice. Those tiny arrows become bothersome if the list becomes big. :)

twoski

I am trying to add more trait-specific mental breaks but i cannot do any for spectrum traits because multiple spectrum traits share the same DefName. So basically, what i'd like is an extra field for mental breaks that lets you specify the trait degree (ie. Neurotic is -1 and Very Neurotic is -2). This way i could make a mental break for the DefName encompassing Neurotic and Very Neurotic and give it an integer that lets it figure out which degree of that trait to associate with

TrashMan

Quote from: Tynan on June 10, 2016, 04:01:27 PM
I'd like to make the game easier to mod, but it's hard to tell, from my perspective, what would be the most useful changes to make to make this happen.

So I'm soliciting requests.

Just try to think of the most important things you'd want that would make modding easier for you. I'll aggregate the suggestions and try to implement the most cost-effective and popular ones.

Thanks all!

Make backstories accesible again.

Support for weapons bigger than 64x64. Like 128x64. I make halberds and then realized that the game shrinks them. Also reach/range for melee weapons?
If I make a halberd, I better be able to hit from the second row.

JaxelT

A lot of classes (like Need and its children) have a this.pawn field which is private or protected. Please make it public.

Actually, many classes have somewhat strange logic for whether their fields are private or public. I've seen a class which had two almost identical fields for holding a float, one private, one public.

GHXX

Something that I noticed during coding was, that I always had to restart the game to reload my .dll file. It would be helpful, if possible, if you could add the ability to reload all mods while still staying in the world. Maybe as an option in the Debug-Actions menu.

Orion

I spend half my time telling people over and over to turn on developer mode and tell me what errors they are getting, instead of "All my pawns stopped moving" or whatever.
I practically have to tell it to every player individually.
Anything that would ease that pain would help. A note in the mod menu, lots of money, a personal help desk, whatever you can spare, really.

Then saving mod configurations / choices per alpha. I have to switch back and forth sometimes to fix errors for the previous alpha. This would help.

I've recently made Hospitality change the ToString of ModPackThingy from identifier to name, so the output log shows all mod names instead of random numbers. This should be in the core game.

Ykara

Just give <addsHediff></addsHediff> <li>s. Please. I want an operation to give more than just one hediff. That's everything I'm asking for. Make it look like this:       
<addsHediff><li>SimpleProstheticArm</li></addsHediff>