A question regarding seasons

Started by dnks, February 18, 2017, 09:29:20 AM

Previous topic - Next topic

dnks

I've searched in the Core folder for any info on the seasons, but it seems that seasons aren't coded into the game like many other values (at least I couldn't find it). I also checked in Source but didn't see anything either, so I'm guessing it's in a .dll or .asset file or somewhere...

If I wanted to modify how seasons work (their length, temperature, visual effects...) how would I go about it? Has anyone made changes like this before?

Thirite

Not everything can be modified just by playing with xmls- most of the game's code is in packed up computer-readable-only compiled C#. This is a misconception commonly made about how RimWorld code works so I figure I'll elaborate.

RimWorld's 'code' is made up of two types: Compiled C# Classes and human readable XML files. The C# is what defines the game logic- it controls how everything works under the hood. Compiled C# must be decompiled using specials tools to read and modify. XML files on the other hand are like little dictionaries of variables which the C# reads the contents of and executes code based on what it says. XML files can't hold game logic unlike C#, but C# can hold game data like XML can. So not all the game data is held in the XMLs; much of it is hidden away in the compiled C# along with the game logic that uses it.

TL;DR
The values you're looking to modify are probably in the game's dlls, not xml files.

dnks

Quote from: Thirite on February 18, 2017, 09:12:17 PM
Not everything can be modified just by playing with xmls- most of the game's code is in packed up computer-readable-only compiled C#. This is a misconception commonly made about how RimWorld code works so I figure I'll elaborate.

RimWorld's 'code' is made up of two types: Compiled C# Classes and human readable XML files. The C# is what defines the game logic- it controls how everything works under the hood. Compiled C# must be decompiled using specials tools to read and modify. XML files on the other hand are like little dictionaries of variables which the C# reads the contents of and executes code based on what it says. XML files can't hold game logic unlike C#, but C# can hold game data like XML can. So not all the game data is held in the XMLs; much of it is hidden away in the compiled C# along with the game logic that uses it.

TL;DR
The values you're looking to modify are probably in the game's dlls, not xml files.
Quote from: dnks on February 18, 2017, 09:29:20 AM
I also checked in Source but didn't see anything either, so I'm guessing it's in a .dll or .asset file or somewhere...
Quote from: dnks on February 18, 2017, 09:29:20 AM
Has anyone made changes like this before?

Thanks for the heads up I guess

Thirite

Oh, I guess I missed that line. Duh

zeidrich

Weather stuff in in Verse.WeatherDef, WeatherEvent, WeatherEventHandler, WeatherEventMaker, WeatherWorker.

Season stuff is in RimWorld.SeasonUtility

You might need to look in Verse.TickManager

Temperature stuff is in RimWorld.MapCondition_ClimateCycle

Time conversion is in RimWorld.GenDate

I'm not sure when you said you looked at the source whether you mean you looked at the source whether you mean you looked at the source in the game folder, or whether you looked at the disassembly.  You'll have to do the latter to get a fuller picture. There's tutorials on the wiki.

You also don't really say what you're trying to do. Seasons aren't really a thing. The game is run on ticks. The date is calculated based on the number of ticks that have passed. The climate cycle is a sin wave that repeats each year. The only "seasons" are the result of seeing which quarter of the years' worth of ticks have passed.  There's no real definition of spring, summer, winter, fall, except for when they get triggered.

If you wanted to change that, it's certainly possible to do so, probably a fair bit of work though.  If you want to change the length of seasons displayed, maybe detour RimWorld.MonthUtility.GetSeason. If you want to change the length of the year, then look at GenDate. If you want to change how the temperature reacts to seasons, then make a new Map Condition to replace climate cycle.  You can use that map condition to change the sky color and overlay as well, look at toxicfallout.

If I were to try it myself, I'd focus on the mapconditions and not worry about trying to change the fundamentals of the year. 

dnks

Thank you zeidrich, that's great insight. By Source I meant the files inside the folder named like that.

And thanks for letting me know about the seasons just being abstract representations of clicks, a step in the right direction.