Exposing Additional Code for Alpha 3 (if possible)

Started by palandus, March 01, 2014, 11:01:47 PM

Previous topic - Next topic

palandus

I was wondering Tynan if it would be possible to expose a few things for making more complex mods, where the things to be exposed aren't (as far as I know) that complex in of themselves.

In particular, could you consider exposing:

-> Damage Types, and by proxy allowing us to create new ones? (ie Different damage types have higher or lower incap chances; a Stun Gun would need to have a specific damage type associated with it so that the stun effect would have a higher chance of incapping over more conventional methods)
-> Being able to manually set Damage types for weapons. ie Having rubberized bullets that function like bullets, but have a higher incap chance than bullets.
-> Being able to make certain pieces of clothing resistant to one or more damage types (ie Bulletproof Armor) or be fully immune to that damagetype. (this may be a bit more difficult)
-> Being able to create our own area of effects; what I mean is that like a Grenade Exploding and creating a blast radius of damage, we could create our own area of effects, like say a flashbang grenade. (this may be a bit more difficult)
-> Being able to expose the code that controls Fire
-> Exposing the code determining how characters move. (ie when someone is on fire, they move a lot faster; maybe someone could utilize that code to create a sprint option)

Hope this isn't too demanding, but I thought I'd mention it nonetheless.

ItchyFlea

If you don't mind me adding something to that list:

• Ability to cause pawns to have specific thoughts when seeing specific situations. (Such as a high fear thought for seeing a rug made from human skin.)
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

Rokiyo

From what I've looked into so far, it sounds like all of that will be possible via .dll modding in Alpha 3.

The key will be in defining our own ThingClasses for use in our XML configs.

For example, instead of having something be a <thingClass>Equipment</thingClass>, we'd have it as a <thingClass>MyMod.CustomThing</thingClass>.

Then, in the C# side of things, we set up our CustomThing to fire off RimWorld's core code (e.g. for making explosions or light, or doing custom damage types)...

My hope is that we'll be able to put together some common libraries to cover off the functionality we're after, and then other modders will be able to use those libraries to their heart's content. The goal would be to push as much config as possible down into the XML files.

palandus

I've never heard of being able to do that with DLL modding. The only thing I've been able to do with DLL modding is change numerical values, or the rare word (ie swapping out turret gun L15 for M25). Unless there is a side to DLL modding I've not heard of yet.

Rokiyo

What Tynan is offering us here is somewhat unprecedented. The closest comparison is Minecraft, where the mods in that game have the ability to completely change how it functions from the ground-up. The only difference here is that Tynan is openly inviting that level of modability (the Mojang team just sort of begrudgingly accepted it, but they didn't ask for it).

The key to all the craziness that is about to unfold within RimWorld is that innocent looking <thingClass> element contained within all of the XML included within the Alpha 2 "Core" mod. Every single thingClass you see listed in this files refers to an executable piece of code sitting inside the core RimWorld files, which gets run each and every time that "Thing" gets created.

From every building, to every colonist, to every bullet.. Everything that you see in the game world is a "Thing" that ran a piece of code when it was created... And in Alpha 3 we'll be able to write that piece of code ourselves.

This isn't .dll modding in the sense that we're hex editing an existing file and trying to tweak a few variables, this is .dll modding in that we're being given the ability to create our own .dll files from scratch, and the game will run them for us at certain points in time.

Tynan

A bunch more stuff is getting exposed in A3 compared to A2, so you'll have some more power.

I'll also continue to restructure the code to be more extensible. For example, there's no way to make another damagetype now without recompiling the core game. This will change in A3.

Also, thingClass loading will work, as explained by Rokiyo.

So yeah, this whole system will continue to mature over time. Some of what the OP asks for will become available.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Architect

Will you be releasing a guide of some sorts for the DLL stuff? I'm looking at your miracle heal mod, and I cannot fathom what is making it be called from looking at it. Obviously the fact I've never used C# before doesn't help, but I think I understand most of whats going on.
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Tynan

Quote from: Architect on March 02, 2014, 04:44:04 PM
Will you be releasing a guide of some sorts for the DLL stuff? I'm looking at your miracle heal mod, and I cannot fathom what is making it be called from looking at it. Obviously the fact I've never used C# before doesn't help, but I think I understand most of whats going on.

It doesn't work that way in Alpha 3, but in Alpha 2 it just looks for all subclasses of IncidentDef using Reflection. Since MiracleHeal is a subclass, it gets loaded.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Cala13er

Quote from: ItchyFlea on March 02, 2014, 12:44:06 AM
If you don't mind me adding something to that list:

� Ability to cause pawns to have specific thoughts when seeing specific situations. (Such as a high fear thought for seeing a rug made from human skin.)

This is possible through dll.

ghosttr

I'm wondering aswell, hopefully we can do damn near everything (other than making our own executable for obvious reasons).

Here are some things that I would like to be able to do.

I really want to change how crafting is done. I think that crafting tables should have some inherent storage, instead of things getting dropped everywhere.

I want the paste dispenser to be a food dispenser (to solve the problems with meal quality vs range) with the best meal available getting dispensed.

But that being said containers should allow higher stack limits than storing items on the ground, and the storage stack limit needs to be different from the carry stack limit.

But if the carry limit is different from the stack limit could the limit be per character (and be improvable?)

Then I think can I make something to train my people to have better skills (so they can carry more crap).

And down the rabbit hole we go. ;D

Tynan

Quote from: ghosttr on March 03, 2014, 01:10:47 AM
I'm wondering aswell, hopefully we can do damn near everything (other than making our own executable for obvious reasons).

Here are some things that I would like to be able to do.

I really want to change how crafting is done. I think that crafting tables should have some inherent storage, instead of things getting dropped everywhere.

I want the paste dispenser to be a food dispenser (to solve the problems with meal quality vs range) with the best meal available getting dispensed.

But that being said containers should allow higher stack limits than storing items on the ground, and the storage stack limit needs to be different from the carry stack limit.

But if the carry limit is different from the stack limit could the limit be per character (and be improvable?)

Then I think can I make something to train my people to have better skills (so they can carry more crap).

And down the rabbit hole we go. ;D

Most of these changes would be very low-payoff and very difficult to do. I suggest you try to find projects that are easier and have a greater and more certain design payoff.

Just a thought.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

ghosttr

Quote from: Tynan on March 03, 2014, 01:46:14 AM


Most of these changes would be very low-payoff and very difficult to do. I suggest you try to find projects that are easier and have a greater and more certain design payoff.

Just a thought.

If only implementing things was as easy as theorycrafting.  ;)


Warduke

Is there a way to change the parameters for procedural map generation? For example, increase or reduce the amount of rock, increase or reduce the number of trees, etc? I'd find that very handy! If it's already in there, my bad, I was looking over the modding options last night and could have missed it.


Tynan

Quote from: Warduke on March 03, 2014, 04:09:41 PM
Is there a way to change the parameters for procedural map generation? For example, increase or reduce the amount of rock, increase or reduce the number of trees, etc? I'd find that very handy! If it's already in there, my bad, I was looking over the modding options last night and could have missed it.

I'm afraid it's only in A3.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Warduke

Quote from: Tynan on March 03, 2014, 04:14:07 PM
I'm afraid it's only in A3.

Ok, sounds good. I was hoping if it wasn't in there yet that it would be in the next Alpha. Keep up the good work!