Adding new tech levels

Started by Bog, August 09, 2014, 11:01:17 PM

Previous topic - Next topic

Bog

Does anybody know how to add new tech levels into the game?

Right now there seems to just be:

Neolithic
Midworld
Spacer
Ultra

For example, I'd like to be able to add Medieval, Industrial and a few others. This is specifically so I can make new factions that have their own sets of weapons. I'd especially like to be able to in .hml if possible, but I can take a stab at making a .dll if it's the only way.

In the end, I've thought of a work around, but it'll take a lot more effort to implement and about double the hassle to re-balance things afterwards.

So it's not essential for me to be able to add new tech levels, but it's make my new mod a lot easier to set up and work with.

Thanks in advance.
Divergence of Civilization Lead Developer (in this case that's the fancy way of saying "Only Developer")

Project Armoury Developer (New huge 2.13 Release now live!)

ZestyLemons

Heyo, good news and bad news.

Bad news: It's defined via code.

Good news: It's very simple code:

public enum TechLevel
  {
    Undefined,
    Animal,
    Neolithic,
    Medieval,
    Midworld,
    Spacer,
    Ultra,
    Transcendent,
  }

- From TechLevel.cs

There's also a Medieval category in the game already, lucky for you.
Help out with the wiki!

Steam: http://steamcommunity.com/id/Divaya/
Wiki: http://rimworldwiki.com/wiki/User:Zesty

Feel free to contact me about wiki questions or wiki admin stuff.

Bog

#2
Quote from: ZestyLemons on August 10, 2014, 12:41:49 AM
Heyo, good news and bad news.

Bad news: It's defined via code.

Good news: It's very simple code:

public enum TechLevel
  {
    Undefined,
    Animal,
    Neolithic,
    Medieval,
    Midworld,
    Spacer,
    Ultra,
    Transcendent,
  }

- From TechLevel.cs

There's also a Medieval category in the game already, lucky for you.
Very nice! That's exactly what I was looking for.

... but for whatever reason I can't find the TechLevel.cs file anywhere. I've looked all through the game files (both Core and the non-mod folders), I've looked through the Rimworld source code made available by Tynan that's stickied at the top of the help board, and I've even gone to the area where screenshots and saves are kept. Last but not least, I've used that gimmicky search bar in the start menu that usually doesn't work. ::) Anyways, I just can't seem to locate it.

Do you think you could point me in the right direction?

Divergence of Civilization Lead Developer (in this case that's the fancy way of saying "Only Developer")

Project Armoury Developer (New huge 2.13 Release now live!)

Shinzy

#3
I'm pretty sure the choise of pawn's weaponry was handled by the
    <moneyForWeapons>
      <min>400</min>
      <max>700</max>
    </moneyForWeapons>
    <weaponTags>
      <li>Gun</li>
    </weaponTags>

In the pawn kinds

And the weapon tag can be specified in the Weapons_Guns/Neolithic/etc.xml
Lot similar to how the Hairs and Apparel gets shared among the pawns
Atleast that's how I've understood it when I did my research
Never actually tried with weaponry yet

Cause I've had a lot similar ideas =P Just way more apparel oriented
and nowhere near as ambitious! I just don't want my raiders to look like total clowns wearing mixmatched clothing from dozen of different eras when I start to expand my wardrobe!

So I'm totally stepping on your toes here! *poke*
watch ooouuut!

Edit:
All that said! I'm not even completely sure of the purpose of the tech level =P
if anyone can clarify what it's used for /confused

ZestyLemons

Might just be there for flavour for now to be honest.
Help out with the wiki!

Steam: http://steamcommunity.com/id/Divaya/
Wiki: http://rimworldwiki.com/wiki/User:Zesty

Feel free to contact me about wiki questions or wiki admin stuff.

Rahjital

Quote from: Bog on August 10, 2014, 03:00:19 AM
Very nice! That's exactly what I was looking for.

... but for whatever reason I can't find the TechLevel.cs file anywhere. I've looked all through the game files (both Core and the non-mod folders), I've looked through the Rimworld source code made available by Tynan that's stickied at the top of the help board, and I've even gone to the area where screenshots and saves are kept. Last but not least, I've used that gimmicky search bar in the start menu that usually doesn't work. ::) Anyways, I just can't seem to locate it.

Do you think you could point me in the right direction?

You need to decompile the game's code using a tool like ILSpy to see that, and changing it through an assembly would be quite hard to do.

Quote from: Shinzy on August 10, 2014, 04:14:48 AM
All that said! I'm not even completely sure of the purpose of the tech level =P
if anyone can clarify what it's used for /confused

The Tech Level tag is used for deciding which faction can use which weapons. Both FactionDef and weapon ThingDef entries can have a <TechLevel> tag accepting one of the entries from the TechLevel.cs file.

Apparel is done in a different way, through PawnKindDefs and PawnOutfitDefs, both of which are defined in the XML files.

Shinzy

Quote from: Rahjital on August 10, 2014, 07:12:53 AM
The Tech Level tag is used for deciding which faction can use which weapons. Both FactionDef and weapon ThingDef entries can have a <TechLevel> tag accepting one of the entries from the TechLevel.cs file.

Oh I see, so the tags are used for picking a specific weapon from the right tech level
like with centipedes and scythers
Thanks Rahj =P that's actually really good to know
Probably gna save me from a lot of headaches if I ever start to play with weapons

Bog

#7
So where abouts is the TechLevel.cs file?

I've downloaded ILSpy, and if I run into problems with the assemblies I can always coerce my brother into helping me with it. (He's got a degree in math-comp and has won awards for his work)

But I'm still not really sure where I'm supposed to be looking or what I'm supposed to decompile to find the TechLevel.cs file. (if that's what I need to do)
Divergence of Civilization Lead Developer (in this case that's the fancy way of saying "Only Developer")

Project Armoury Developer (New huge 2.13 Release now live!)

Haplo

You can find the code you're searching for in this .dll:
..\RimWorldXXXXXXX_Data\Managed\Assembly-CSharp.dll

Spacedestructor

can anyone tell me how to add a new tech level to the .dll file without modifying the game files? i wanted to put in a new tech level for making the immersion of a scenario im making as good as possible but i feel like steam will come and complain to me if i just go ahead and edit the game files or simply just reverse my changes.

LWM

To be honest, I don't know that there's a way to add a value to the Enum...at the very least, it's not something I've ever found a way to do? So you may be out of luck, and have to make due with what's the vanilla.....

Unless your C# skills are pretty good and you want to try using Harmony to edit the weapon generation?