Ludeon Forums

RimWorld => Mods => Help => Topic started by: Galileus on November 13, 2013, 06:57:56 AM

Title: Save file structure
Post by: Galileus on November 13, 2013, 06:57:56 AM
This is a discussion topic, I'll move all the data to Modding Database later on.

Saves are in XML format - if you need info on how that works try XML Introduction (http://www.w3schools.com/xml/xml_whatis.asp)

Ok, so onto a save file and how it is done! Notes - green means "how does it work", yellow is assumption on my part and red is unknown/uncertain! Notes on bottom.

Contents:

Overview:

Quote<?xml version="1.0" encoding="utf-8"?>
<Map> Main tag
   <GameVersion/> Self explanatory
   <MapInfo/> Saves map name (same as colony name?), size and max ID that was given out.
   <ColonyInfo/> For now only the name of the colony
   <PlaySettings/> Setting of gameplay, rather empty right now :)
   <RealTime/> Counts time since last pause? Only one thing in it now, and other time counters are in TickManager...
   <GameEnder/> Empty for now, will hold win conditions most likely
   <LetterStack/> No idea, seen it only empty for now
   <CameraMap/> Holds camera coordinates and zoom level
   <Resources/> Amount of resources player have
   <TickManager/> Time in-game
   <WeatherManager/> All things weather
   <ResearchManager/> Everything research
   <Storyteller Class="Storyteller_Random"/> Details of the storyteller and it's class Need ID's for different storytellers
   <ReservationManager/> Holds all the reservations made by pawns - if they do anything, they reserve the item they are interacting with so that no-one else can take it
   <DesignationManager/> No idea, seen it only empty for now. Would need testing with different saves (raiders attack, madness, prisoners...?)
   <AIKingManager/> Holds all things raiders, probably enemy animals too?
   <VisitorManager/> All things visitors - travelers and such - will need more testing on saves with visitors.
   <Tutor/> Keeps all info on tutorials seen already, reserved to be seen and currently displayed.
   <MapConditionManager/> Events? Will need tests with during-events saves
   <RoomManager/> List of all rooms recognized by the game
   <FogGrid/> Map of fog of war - discovered tiles, undiscovered tiles and so on. Will need tests on it.
   <RoofGrid/> Will ignore, as it is being redone right now.
   <TerrainGrid/> Map of terrain. Need much testing.
   <CleanGrid/> Home zones map? Clean tiles map?
   <HistoricalPawns /> Not used right now, will hold people who left the colony to return sometime later?
   <CompressedThingMap/> Compressed map of everything to be used by game? Need much research.
   <Things /> The huuuuuuge part. List of everything ID'd in game. Buildings, pawns, plants, dirt, weapons, animals...
</Map>

To be continued - the easy (small) categories first, will go into things at last as it'll require more work than the whole rest ;)
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 09:14:25 AM
<MapInfo>

Quote
<Name>Name of the map - not sure if used at all yet, maybe a placeholder for saving the map? Seems to be always the colony name, probably Crashville on new game but will need a test</Name>
<Size>(250, 1, 250)</Size> Size of the map - in XZY coordinates most likely. Trying to modify it would most possibly need a better understanding of Grid tags.
<MaxThingIDIndex>2260314</MaxThingIDIndex> The last ID given out by the game. New added items would take next ID, this would be needed to be changed too (unless it's automatic)

<ColonyInfo>

Quote<ColonyName>Name of the colony</ColonyName>

<PlaySettings>

Quote<UseWorkPriorities>True</UseWorkPriorities> Use work priorities - changes if work priorities are set to manual.

<RealTime>

Quote<TimeUnpaused>25311.3</TimeUnpaused> Unknown. Measures ticks spent out of pause?

<CameraMap>

Quote<CamRootPos>(80.7, 65.0, 131.4)</CamRootPos> Coordinates of tile that camera is centred on.
<DesiredSize>60</DesiredSize> Zoom. May be used to make full-map screenshots?

<Resources>

Quote<Money>12505</Money>
      <Food>5426</Food>
      <Metal>8865</Metal> Quite obvious. Ignored the unused resources for now.

<TickManager>

Quote<TickCount>2171901</TickCount> Amount of ticks counted by game so far

<WeatherManager>

Quote<CurWeather Class="Weather_Rain" /> Type of weather currently in place, need list of weathers
<LastWeather Class="Weather_Clear" />Type of last weather in place, need list of weathers
<ticksSinceTransition>54710</ticksSinceTransition> Ticks since weather was last changed. How does it work? Do weather always have X ticks of lifetime? Is it per-weather or random?

<ResearchManager>

Quote<CurrentProject>FearTech1</CurrentProject> Project currently selected to be researched.
<ProjectList>...</ProjectList> List of research projects available in game and their status

Quote<ProjectList><ResearchProject Class="ResearchProject"> Class of project? Maybe separation to new things or upgrades planned later on.
            <RType>Hydroponics</RType> ID of the research project to find it's effect?
            <Label>Hydroponics</Label> Name of the project in-game.
            <Progress>22000.12</Progress> Points already spent on research.
            <TotalCost>22000</TotalCost> Total points to finish research.
            <Description>Allows you to build hydroponics tables to rapidly grow crops indoors.</Description> Description of project in-game.
         </ResearchProject>   (...) </ProjectList>   

<Storyteller Class="X"/>

Need list of names for different storytellers. Quite a lot of tags I may have missed here!

Quote<AnimalSpawner /> Unknown, will need testing Re-populationg game world with animals?
<IncidentQueue>(...)</IncidentQueue> Unknown, will need testing Events planned for future?
<WeatherDecider>(...)</WeatherDecider> Not quite sure, for now one tag inside, may be more in different situations?
<StoryState>(...)</StoryState> Decides aggresive events? How different from Incident Queue? Used only to decide what to throw at player next, and queue is somewhere else?
<IntenderPopulation>(...)</IntenderPopulation> Counts the time to throw another population gain possibility at player. Different values or things in other storytellers?

Quote<WeatherDecider>
         <LastWeatherStartTick>2117192</LastWeatherStartTick> Counts how long current weather is in effect?
      </WeatherDecider>

Quote<StoryState>
         <LastThreatQueueTime>2171568</LastThreatQueueTime> Time since last raid or any aggresive event?
         <NumThreatsQueued>14</NumThreatsQueued> Many speculations, no answers ;)
         <LastQueueTicks>
            <KeyList>(...)</KeyList>
            <ValueList>(...)</ValueList>
         </LastQueueTicks> Two lists of <Int32> entries - not quite sure what they represent.

Quote<IntenderPopulation>
         <LastPopGainTime>1821753</LastPopGainTime> Does it count last time when population went +1, or a chance to gain +1? Absolute value or relative one?
      </IntenderPopulation>

That's as much as I have time for now, will sit down and do another batch later!
Title: Re: Save file structure
Post by: deadbeat88 on November 13, 2013, 12:24:59 PM
you should also add the character structure (Skills, traits).

I wanted to remove the "ManualDumb"etc. traits in my colonist, but all im seeing is skills levels. changing those  wont do anything.  :(
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 12:30:10 PM
I know where they are, but they are on the bottom of the list. Will do when got time, it's more time consuming to write it all down than it looks :)
Title: Re: Save file structure
Post by: deadbeat88 on November 13, 2013, 12:48:43 PM
yes, I have looked into the save file as well.
I also play prison architect and I can tell they have similar structure (PA is more cluttered, though)

I also would like to know how to keep the electricity running even when EMP happens. I hate that thing. lol
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 01:43:09 PM
<ReservationManager>

Quote<Reservations> List of reserved items.
         <ThingReservation Class="ThingReservation">
            (...) Things reserved - see below
         </ThingReservation>
</Reservations>

Quote<ThingReservation Class="ThingReservation">
            <Claimant>Pawn1841167</Claimant> ID of pawn that made the claim
            <InteractionType>Sowing</InteractionType> Type of claim. Seen sowing and total so far...
            <Target> details on the claimed target
               <TargetThing>null</TargetThing>  ID of targeted thing. Null if sowing
               <TargetLoc>(75, 0, 144)</TargetLoc> Location fo target. Present only if sowing
            </Target>
         </ThingReservation>

Example of Total reservation:

         <ThingReservation Class="ThingReservation">
            <Claimant>Pawn1253621</Claimant>
            <InteractionType>Total</InteractionType>
            <Target>
               <TargetThing>PlantPovertyGrass1800230</TargetThing>
            </Target>
         </ThingReservation>

<AIKingManager>

Probably closely depending on raiders present on map. Needs testing.

Quote<KingList> List of "kings" - AI's controling raiders? Will be to different ones if two parties are there, probably.
      <AIKing Class="AIKing"> Entry of AI King
             <Config> Config stuff for the King</Config>
            <FleeChecker> Conditions for fleeing Needs testing to properly understand </FleeChecker>
            <Cortex>Timers for raiders</Cortex>
            <BaseCenter>(187, 0, 36)</BaseCenter> Tile considered "base" for raiders - they will wander in that location
            <OwnedPawns>List of <Ref> entries with ID's of raiders owned by that AIKing</OwnedPawns>
         </AIKing>
</KingList>

Quote<Config>
<Team>Raider</Team> Team of the raiders. Can be "mad" if there is animal attack?
<StagingTime>10000</StagingTime> How long raiders stage an attack.
<AssaultingTime>14000</AssaultingTime> How long assault can take before they give up. Seems to be on top of staging time - so 10k ticks for staging and 14k for assault means they have 4k ticks of assault before they give up. How does poking raiders work in that case? Seems if you poke them, their assault can last longer!
</Config>

Quote<FleeChecker>
   <NumPawnsGained>18</NumPawnsGained> "Gained" is throwing me off here. Logically should be how many pawns Raiders have to lost before they flee. Needs checking.
</FleeChecker>

Quote<Cortex>
      <TicksSpentStaging>334</TicksSpentStaging>
      <TicksSpentAssaulting>334</TicksSpentAssaulting> Timer of ticks on staging and assault. The same number seems to prove theories above.
</Cortex>

<VisitorManager> - placeholder until I get a save with a visitor

<Tutor>

Quote<UnusedItemNamed>List of unused tutorials - <string> entries</UnusedItemNamed>
      <ActivePointers /> Conditions deciding what tutorial to show? Need a tutorial-enabled save to test.
      <ActiveNote IsNull="True" /> What tutorial is shown, null if none. Need a save with tutorial to see properly.

Quote<UnusedItemNamed>
         <String>MapPointer_MineMinerals</String>
         <String>MapPointer_Unforbid_Food</String>
         <String>MapPointer_Unforbid_Metal</String>
         <String>MapPointer_TakeGun</String>
         <String>TutorNote_IntroA</String>
         <String>TutorNote_IntroB</String>
         <String>TutorNote_Codex</String>
         <String>TutorNote_Pause</String>
         <String>TutorNote_WorkSettingsA</String>
         <String>TutorNote_WorkSettingsB</String>
         <String>TutorNote_MiningA</String>
         <String>TutorNote_MiningB</String>
         <String>TutorNote_WorkOverview</String>
         <String>TutorNote_CaptureEnemy</String>
         <String>TutorNote_CaptureEnemyB</String>
         <String>TutorNote_CombatIntro</String>
         <String>TutorNote_CombatIntroB</String>
         <String>TutorNote_PrisonerHandlingA</String>
         <String>TutorNote_FireExtinguishing</String>
      </UnusedItemNamed>

<MapConditionManager> - placeholder until I test a save with event active

<RoomManager>

Quote<RoomList> List of <Room> entries
         <Room Class="Room"> Room entry. Can there be other classes than room, or is it a placeholder for future?
            <AirTight>True</AirTight>  If room is airtight -not sure if useful for anything right now
            <Air>0</Air> Not used right now?
            <Squares>List of <IntVec3> entries for tiles recognized as said room</Squares>
         </Room>
      </RoomList>

Quote<Squares>
               <IntVec3>(54, 0, 162)</IntVec3> Entries for each tile in room - again XZY coordinates
               <IntVec3>(54, 0, 163)</IntVec3>
               (...)
               <IntVec3>(63, 0, 165)</IntVec3>
               <IntVec3>(63, 0, 166)</IntVec3>
</Squares>
Title: Re: Save file structure
Post by: Wopian on November 13, 2013, 01:46:19 PM
Quote from: Galileus on November 13, 2013, 09:14:25 AM
<MapInfo>

Quote
<Name>name of the map - doe sit affect anything at this time?</Name>
<Size>(250, 1, 250)</Size> Size of the map - in XZY coordinates most likely. Trying to modify it would most possibly need a better understanding of Grid tags.
<MaxThingIDIndex>2260314</MaxThingIDIndex> The last ID given out by the game. New added items would take next ID, this would be needed to be changed too (unless it's automatic)


<name> is the saved name of the savefile. Although it doesn't visibly change anything yet
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 01:48:16 PM
One more for green! Thanks! :)
Title: Re: Save file structure
Post by: Wopian on November 13, 2013, 01:49:11 PM
Quote from: Galileus on November 13, 2013, 01:48:16 PM
One more for green! Thanks! :)


I lied :c


I thought it was since it was the same ID as my maps; turns out it's just filled with the savefile name.
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 01:52:22 PM
No worries. Any input is appreciated, as it's one less thing for me to try and figure out, and in worst case scenario always a new though to fool around with.

Also, I've checked for that earlier in my auto-saves as well. Just hard to remember with all these texts and numbers flying before my eyes right now :P
Title: Re: Save file structure
Post by: Wopian on November 13, 2013, 02:04:26 PM
<Realtime>
  <TimeUnpaused />
<Realtime>

appears to be the time in seconds the game has been running in real life seconds.
Title: Re: Save file structure
Post by: deadbeat88 on November 13, 2013, 03:21:14 PM
Code for Colonists:
*note that all this is wrapped inside ONE <Thing Class="Pawn"></Thing>


[spoiler]

<Def>Pawn</Def> -- dunno whats this for
<ID>Pawn541013</ID>  --ID
<Pos>(242, 0, 158)</Pos>   --location of unit
<Team>Colonist</Team>  --Colonist/Raider
<Kind>Colonist</Kind> --Colonist/Raider
<CharacterName>Fletcher</CharacterName> --unit name
<Sex>Female</Sex> --unit gender
<Age>38</Age> -- age
<CarriedThing IsNull="True" /> --if hauling stuff

[/spoiler]


--for body appearance

<Drawer>
<Renderer>
<BodyName>Hippa</BodyName>
<HeadName>Molly</HeadName>
</Renderer>
</Drawer>



--health and rest

<HealthTracker>
<PawnHealth>100</PawnHealth>
<TicksToNextBleed>624</TicksToNextBleed>
</HealthTracker>



--Jobs and Priorities

<WorkSettings>
<WorkPriorities>

---things only listed if they are ticked
<KeyList>
<WorkType>Firefighter</WorkType>
<WorkType>Construction</WorkType>
<WorkType>Repair</WorkType>
<WorkType>Growing</WorkType>
<WorkType>Mining</WorkType>
<WorkType>PlantCutting</WorkType>
<WorkType>Hauling</WorkType>
<WorkType>Cleaning</WorkType>
<WorkType>Doctor</WorkType>
</KeyList>


--value of ticked priorities
<ValueList>
<Int32>1</Int32>
<Int32>1</Int32>
<Int32>1</Int32>
<Int32>2</Int32>
<Int32>2</Int32>
<Int32>4</Int32>
<Int32>4</Int32>
<Int32>4</Int32>
<Int32>1</Int32>
</ValueList>
</WorkPriorities>
</WorkSettings>
</Mind>



--current task

<Jobs>
<CurJob>
<JType>Mine</JType>
<TargetA>
<TargetThing>Rock1682489</TargetThing>
</TargetA>
<TargetB IsNull="True" />
</CurJob>
<CurJobDriver Class="JobDriver_InteractMine">
<CurToilIndex>0</CurToilIndex>
<CurToilCompleteMode>PatherArrival</CurToilCompleteMode>
</CurJobDriver>
</Jobs>



--equipped weapon
note that there is <Secondaries /> tag. hinting for multi items :D

<Equipment>
<Primary>
<Def>Gun_M-24Rifle</Def>
<ID>Gun_M-24Rifle1349804</ID>
<Pos>(235, 0, 119)</Pos>
<Health>100</Health>
</Primary>
<Secondaries />
</Equipment>



--Inventory, atm its only keys for doors. possibly to prevent raiders from opening your doors

<Inventory>
<InventoryList>
<Thing Class="ThingWithComponents">
<Def>DoorKey</Def>
<ID>DoorKey546643</ID>
<Health>30</Health>
</Thing>
</InventoryList>
</Inventory>



--carried filth
<Filth>
<CarriedFilth>
<Filth Class="Filth">
<Def>FilthDirt</Def>
<ID>FilthDirt1901961</ID>
<Thickness>1</Thickness>
<Sources />
</Filth>
</CarriedFilth>
</Filth>



--needs(food and rest level)

<Food>
<PieceFood>
<CurLevel>95.57443</CurLevel>
</PieceFood>
</Food>
<Rest>
<PieceRest>
<CurLevel>75.82912</CurLevel>
</PieceRest>
</Rest>



-- Psychology
tells you about levels of loyalty, happiness and fear. you can  edit them here
you can also delete the thoughts if necessary
-note that there is 'Prisoner isnull', i wonder if you can use this on a raider's codes

<Psychology>
<LoyaltyBase>
<CurLevel>31.34386</CurLevel>
</LoyaltyBase>
<PieceHappiness>
<CurLevel>31.34369</CurLevel>
</PieceHappiness>
<PieceFear>
<CurLevel>13.65661</CurLevel>
</PieceFear>
<PieceEnvironment>
<CurLevel>43.4</CurLevel>
</PieceEnvironment>
<PieceOpenness>
<CurLevel>68.5</CurLevel>
</PieceOpenness>

<ThoughtHandler>
<ThoughtList>
<Thought Class="Thought">
<ThoughtType>SocialTalk</ThoughtType>
<Age>279</Age>
</Thought>
<Thought Class="Thought">
<ThoughtType>SocialTalk</ThoughtType>
<Age>1554</Age>
</Thought>
<Thought Class="Thought">
<ThoughtType>SocialTalk</ThoughtType>
<Age>1017</Age>
</Thought>
<Thought Class="Thought_Observation">
<ThoughtType>ObservedLayingCorpse</ThoughtType>
<Age>3257</Age>
<TargetHash>-895731747</TargetHash>
</Thought>
<Thought Class="Thought_Observation">
<ThoughtType>ObservedLayingCorpse</ThoughtType>
<Age>3660</Age>
<TargetHash>288713867</TargetHash>
</Thought>
<Thought Class="Thought_Observation">
<ThoughtType>ObservedGibbetCageFullStranger</ThoughtType>
<Age>2450</Age>
<TargetHash>382561408</TargetHash>
</Thought>
<Thought Class="Thought">
<ThoughtType>AteNutrientPaste</ThoughtType>
<Age>1107</Age>
</Thought>
</ThoughtList>
</ThoughtHandler>
</Psychology>

<Prisoner IsNull="True" />



--personal bed, new items might be added here as well in the future

<Ownership>
<OwnedBed>Bed1486191</OwnedBed>
</Ownership>



--Skill level
edit them here.
note that if they have incapables, it wont change anything, they cant still use that skill

<Skills>
<Level_Construction>12</Level_Construction>
<XpSinceLastLevel_Construction>3267.073</XpSinceLastLevel_Construction>
<Level_Growing>7</Level_Growing>
<XpSinceLastLevel_Growing>3630</XpSinceLastLevel_Growing>
<Level_Research>7</Level_Research>
<XpSinceLastLevel_Research>0</XpSinceLastLevel_Research>
<Level_Mining>7</Level_Mining>
<XpSinceLastLevel_Mining>3775.209</XpSinceLastLevel_Mining>
<Level_Shooting>5</Level_Shooting>
<XpSinceLastLevel_Shooting>1472</XpSinceLastLevel_Shooting>
<Level_Melee>3</Level_Melee>
<XpSinceLastLevel_Melee>660</XpSinceLastLevel_Melee>
<Level_Social>1</Level_Social>
<XpSinceLastLevel_Social>1600.408</XpSinceLastLevel_Social>
<Level_Cooking>3</Level_Cooking>
<XpSinceLastLevel_Cooking>0</XpSinceLastLevel_Cooking>
<Level_Medicine>3</Level_Medicine>
<XpSinceLastLevel_Medicine>0</XpSinceLastLevel_Medicine>
<Level_Artistic>3</Level_Artistic>
<XpSinceLastLevel_Artistic>0</XpSinceLastLevel_Artistic>
<Level_Crafting>3</Level_Crafting>
<XpSinceLastLevel_Crafting>0</XpSinceLastLevel_Crafting>
</Skills>



--Their story. you know, like Vagran Soldier and stuff.
1st- as child
2nd-as adult

<Story>
<StoryItems>
<Int32>14</Int32>
<Int32>0</Int32>
</StoryItems>
</Story>

-SOMEBODY MAKE A LIST OF THIS!


--traits. not implemented yet
I havent tested if you can have more than 2 traits, though.

<Traits>
<TraitList>
<Trait Class="Trait">
<DefName>Broad-minded</DefName>
</Trait>
<Trait Class="Trait">
<DefName>Dog lover</DefName>
</Trait>
</TraitList>
</Traits>



*not all codes have been posted. only notable ones.
ATTACHED IS THE RAW FILE for code above.
*you can delete this and append to original post.

[attachment deleted by admin: too old]
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 04:28:44 PM
Thanks for that :) I'll get to it eventually, but I want to go "chronologically". I don't think you filled in any gaps in my own findings, which is a shame... welp! Will have to get to it eventually!
Title: Re: Save file structure
Post by: Tynan on November 13, 2013, 04:57:06 PM
Story items will be references by hashes in the next version (in this one it's by index), hence the small numbers.

The only thing that does nothing at all is HistoricalPawns.

AssaultingTime is independent of StagingTime. If you poke them the assaulting time starts immediately.

I hope the rest is mostly self-explanatory. The only place you're unlikely to have any success is editing jobdrivers or jobs in progress, especially the toil indices, because those refer to sub-tasks which aren't documented anywhere.
Title: Re: Save file structure
Post by: Galileus on November 13, 2013, 05:11:22 PM
Many thanks for your input :) This should be good to go into database in mostly green/yellow soon. Can't wait to see what I can do with these terrain maps :P
Title: Re: Save file structure
Post by: Zanaras on November 13, 2013, 10:27:59 PM
LetterStack is the list of all messages you receive about passing traders, raiders, wanderers, and wild critters, that you have not deleted/acknowledged.
Title: Re: Save file structure
Post by: Galileus on November 14, 2013, 03:53:24 AM
Quote from: Zanaras on November 13, 2013, 10:27:59 PM
LetterStack is the list of all messages you receive about passing traders, raiders, wanderers, and wild critters, that you have not deleted/acknowledged.

No wonder I had it empty, I delete 'em as soon as they show :) Great, should finish the easy list in few hours and can start with specific saves!
Title: Re: Save file structure
Post by: Galileus on November 14, 2013, 12:56:59 PM
My brain is not brainin today, so instead of planned tests on different saves I'm going to just go on with some more raw data from the basic one.

<FogGrid>

The grid of known and unknown tiles. Like other grids later I believe they are literally grids made up of different values, so the only real job here is to make up list of symbols/values used. Should be easy enough to confirm or reject that theory with Rhodes' mods for all-mountain or all-plains maps. Comparing amount of symbols to amount of tiles on map should do the trick too (unless specyfic values are of different length)

Quote<Fog>
P
z8/Pz8/Pz8/Pz8/Pz8HAAAAAAAAAAAAADA/DwAAAAAAAAAAOD8/BwAwPz8/Pz8/Pz8/Pz8/Pz8BAAAAAAAAAAAAADA/AwAAAAAAA
AAAPj8HAAA8Pz8/Pz8/Pz8/Pz8/Px8AAAAAAAAAAAAAAAAfAAAAAAAAAAAgPx8AAAA/Pz8/Pz8/Pz8/Pz8/PwcAAAAAAAAAAAAAA
AAAAAAAAAAAAAA4PwAAADA/Pz8/Pz8/Pz8/Pz8/PwAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+BwAAADw/Pz8/Pz8/Pz8/Pz8/DwAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAfAAAAAD8 (...) AAAAAAAAAAAAA==
      </Fog>

" == " seems to end all grids.

<RoofGrid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1AAAANTU1NTU1NTU1NTU1N
QAAAAAAAAAAAAAAAAAAAAA3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAADcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN
TU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1N
TU1NTU1NTU1NTUANTU1NTU1NTU1NTU1NTU1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==

Title: Re: Save file structure
Post by: Tynan on November 14, 2013, 01:00:57 PM
This is the code that saves boolean grids into that compressed format. It uses Base64 to save characters after bit-packing the booleans several at a time into an array of bytes.


public static void ExposeBoolGrid( ref bool[,] grid, string label )
{
string fogBase64 = "";
int numBytes = (int)Math.Ceiling((Find.Map.Size.x * Find.Map.Size.z) / 6f );
byte[] fogBytes = new byte[ numBytes ];

if( Scribe.mode == LoadSaveMode.Saving )
{
//Pack the fog of war map into an array of bytes in base64
int byteInd = 0;
byte bitInd = 1;
for( int k=0; k< Find.Map.Size.z; k++)
{
for( int i=0; i< Find.Map.Size.x; i++)
{
if( grid[i,k] )
fogBytes[byteInd] |= bitInd;

bitInd *= 2;
if( bitInd > 32 )
{
bitInd = 1;
byteInd++;
}
}

}

fogBase64 = System.Convert.ToBase64String( fogBytes );

fogBase64 = AddLineBreaksTo(fogBase64);
}


Scribe.LookField( ref fogBase64, label);


if( Scribe.mode == LoadSaveMode.LoadingVars )
{
fogBase64.Replace("\n", "");

//Unpack the Base64 into the fog map

fogBytes = System.Convert.FromBase64String( fogBase64 );

int byteInd = 0;
byte bitInd = 1;
for( int k=0; k< Find.Map.Size.z; k++)
{
for( int i=0; i< Find.Map.Size.x; i++)
{
if( grid == null )
grid = new bool[Find.Map.Size.x, Find.Map.Size.z];

grid[i,k] = (fogBytes[ byteInd ] & bitInd) != 0;

bitInd *= 2;
if( bitInd > 32 )
{
bitInd = 1;
byteInd++;
}
}
}
}

}

Title: Re: Save file structure
Post by: Galileus on November 14, 2013, 01:05:08 PM
So, no puzzle for me? Fair enough :)

You put Skyrim's modding support to shame, Tynan. And RimWorlds is good in alpha and before modding ;)
Title: Re: Save file structure
Post by: Galileus on November 14, 2013, 02:11:33 PM
Note to self - look at a save with half-builded thingies.
Note to self - I'm the self inflicted, mind detonator. Yeah! I'm the one infected, twisted animator. I'm a firestarter, terrific firestarter.

I'll make a basic sketch here, will fill it up with <Def> tags, <Rot> description and such after getting a better save to do so

<Things>

By far most interesting category for most save file editors right after "resources" ;) Contains list of all things on map - colonists, raiders, guns, rubble, filth, steam geysers... Every entry is enclosed in <Thing Class="X">...</Thing> so this is what I'm going to concentrate on.

Common tags

These tags exist in most entries

Quote<Def>Reference to the object class, ex. RockRubble, PlantPincushionCactus</Def>
         <ID>ID of the specyfic object in the world, ex. RockRubble30727</ID>
         <Pos>Position of the object in world in XZY coordinates, ex. (118, 0, 3)</Pos>
         <Rot>Rotation, seems the tag isn't there if rot=0 (standard 12'o clock direction)</Rot>
         <Team>Owner of thing</Team>
         <Health>Health/damage of thing</Health>

Marked at the beginning of every class description:

<Def> ; <ID> ; <Pos> ; <Team> ;

In that example said class have <Def>, <ID>, <Pos> and <Team> tags, but does not have <Rot> or <Health> tags.

Electric buildings tags:

Quote<PowerOn>Is power turned on? (item menu option) True/False</PowerOn>
<DesirePowerOn>Requires power to use? True/False</DesirePowerOn>

Storage buildings tags:

Quote<SlotGroup>
<AcceptColonistCorpses>True</AcceptColonistCorpses> Do/don't accept colonists corpses
<AcceptStrangerCorpses>True</AcceptStrangerCorpses> Do/don't accept stranger corpses
<AcceptAnimalCorpses>True</AcceptAnimalCorpses> Do/don't accept animal corpses
</SlotGroup>

Tags are present only is True, removed if False. If all these tags are false, the group is empty: <SlotGroup />

Interaction tag:

Quote<Forbidden>True</Forbidden> Is that thing forbidden for interaction? Not present if False

<Thing Class="Building">

<Def> ; <ID> ; <Pos> ; <Team> ; <Health>

<Thing Class="Building_Battery">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

Quote<StoredPower>873.2795</StoredPower> Power stored in battery... duh!

<Thing Class="Building_Bed">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<Thing Class="Building_Chair">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<Thing Class="Building_CommsConsole">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<PowerOn> ; <DesirePowerOn>

<Thing Class="Building_Door">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<PowerOn> ; <DesirePowerOn>

To be continued... when plants and filth stops flying right in front of my eyes ^^'
Title: Re: Save file structure
Post by: Rhodes on November 15, 2013, 10:29:31 AM
I've been cautious of posting anything in this thread because I didn't want to put something in that shouldn't be.  However, I think I should be safe with this edited list.

Normal Buildings:

            Comms console:
                maxHealth = 250;
                desc = "Communicate with nearby ships here for negotiation and trade.";
                workToBuild = 400f;
                costList.Add(new ResourceCost(EntityType.Metal, 120));
                filthLeavings.Add("SlagRubble", 2);
                basePowerConsumption = 200f;
                startElectricalFires = true;

            Nutrient paste dispenser:
                maxHealth = 350;
                flammability = 1f;
                desc = "Synthesizes nutrient paste from organic feedstocks.";
                workToBuild = 600f;
                costList.Add(new ResourceCost(EntityType.Metal, 90));
                filthLeavings.Add("SlagRubble", 3);
                startElectricalFires = true;

            Grave:
                useStandardHealth = false;
                desc = "Place the dead in graves to give them a decent final resting place.";
                workToBuild = 200f;
                costList.Add(new ResourceCost(EntityType.Metal, 0));
                storables.Add(StoreType.Corpse);
                maxNumStoreSlots = 1; //(I already tried modding this to make mass graves - doesn't work)

            Gibbet cage:
                maxHealth = 120;
                desc = "Place corpses in gibbet cages for display. These inspire disgust and fear.";
                workToBuild = 200f;
                filthLeavings.Add("SlagRubble", 2);
                maxNumStoreSlots = 1;
                researchPrerequisite = ResearchType.FearTech1;

            Solar generator:
                maxHealth = 300;
                flammability = 1f;
                desc = "Produces electricity from sunlight. Does not work in the dark.";
                workToBuild = 500f;
                costList.Add(new ResourceCost(EntityType.Metal, 80));
                leavings.Add(new LeavingRecord(EntityType.DebrisSlag, 8));
                filthLeavings.Add("SlagRubble", 2);
                transmitsPower = true;

Geothermal generator:
                maxHealth = 500;
                flammability = 1f;
                desc = "Produces electricity from geothermal steam geysers. Must be placed on a geyser.";
                workToBuild = 1000f;
                costList.Add(new ResourceCost(EntityType.Metal, 250));
                leavings.Add(new LeavingRecord(EntityType.DebrisSlag, 0x10));
                filthLeavings.Add("SlagRubble", 3);
                transmitsPower = true;
                placementRestrictions.Add(PlacementRestriction.OnSteamGeyser);

            Battery:
                maxHealth = 100;
                flammability = 2f;
                desc = "Stores electricity when there is excess power and yields it when there is not. Warning - charged batteries tend to explode when heated.";
                workToBuild = 200f;
                costList.Add(new ResourceCost(EntityType.Metal, 50));
                leavings.Add(new LeavingRecord(EntityType.DebrisSlag, 1));
                filthLeavings.Add("SlagRubble", 2);
                transmitsPower = true;
                startElectricalFires = true;


Building Areas:

            Stockpile area:
                useStandardHealth = false;
                desc = "Colonists drop resources here.";
                workToBuild = 0f;
                costList.Add(new ResourceCost(EntityType.Metal, 200));

            Dumping area:
                useStandardHealth = false;
                desc = "Designates an area where colonists will dump unwanted items.";
                workToBuild = 0f;
                storables.Add(StoreType.Corpse);
                storables.Add(StoreType.Debris);
                storables.Add(StoreType.Meal);
 
            Growing area:
                useStandardHealth = false;
                desc = "Designates an area where colonists will plant crops. Usually grows enough for one or two people.";
                workToBuild = 0f;
                plantToGrowDefName = "PlantPotato";
                supportsPlants = true;


Natural Buildings:

            Rock:
                maxHealth = 240;
                selectable = true;
                neverMultiSelect = true;
                desc = "Divides and encloses rooms. Mine to remove.";
                rotatable = false;
                naturalBuilding = true;
                mineable = true;
                makeFog = true;
                leaveTerrain = TerrainDefDatabase.TerrainWithLabel("Rough stone");
                filthLeavings.Add("RockRubble", 2);
                holdsRoof = true;
                isBarrier = true;

            Mineral:
                maxHealth = 1000;
                selectable = true;
                neverMultiSelect = true;
                desc = "Mine this for metal.";
                mineableResource = EntityType.Metal;
                naturalBuilding = true;
                mineable = true;
                makeFog = true;
                leaveTerrain = TerrainDefDatabase.TerrainWithLabel("Rough stone");
                filthLeavings.Add("RockRubble", 2);
                holdsRoof = true;
                isBarrier = true;

            Steam geyser:
                destroyable = false;
                useStandardHealth = false;
                selectable = true;
                desc = "Natural steam source.";
                beauty = BeautyCategory.Gorgeous;
                neverBuildFloorsOver = true;


Security Buildings:

Auto-turret:
                maxHealth = 140;
                basePowerConsumption = 350f;
                desc = "Automatically fires a machine gun at nearby enemies. Will explode when badly damaged.";
                flammability = 1f;
                costList.Add(new ResourceCost(EntityType.Metal, 160));
                workToBuild = 1000f;
                combatTargetBuilding = true;
                beauty = BeautyCategory.Ugly;
                leavings.Add(new LeavingRecord(EntityType.DebrisSlag, 2));
                filthLeavings.Add("SlagRubble", 1);

            Blasting charge:
                maxHealth = 50;
                flammability = 1f;
                desc = "Detonates on command.";
                workToBuild = 30f;
                costList.Add(new ResourceCost(EntityType.Metal, 0x23));
                researchPrerequisite = ResearchType.BlastingCharges;


Building Structures:

            Wall:
                maxHealth = 280;
                flammability = 1f;
                desc = "Divides and encloses rooms.";
                workToBuild = 75f;
                costList.Add(new ResourceCost(EntityType.Metal, 3));
                selectable = true;
                neverMultiSelect = true;
                leavings.Add(new LeavingRecord(EntityType.DebrisSlag, 1));
                filthLeavings.Add("SlagRubble", 2);
                holdsRoof = true;
                transmitsPower = true;
                isBarrier = true;
 
            Door:
                maxHealth = 240;
                flammability = 1f;
                selectable = true;
                desc = "Seals rooms apart.";
                workToBuild = 150f;
                isBarrier = true;
                costList.Add(new ResourceCost(EntityType.Metal, 0x19));
                placementRestrictions.Add(PlacementRestriction.NotAdjacentToDoor);
                basePowerConsumption = 50f;
                holdsRoof = true;
                transmitsPower = true;
 
            Power conduit:
                flammability = 1f;
                maxHealth = 80;
                desc = "Transmits power.";
                workToBuild = 10f;
                costList.Add(new ResourceCost(EntityType.Metal, 1));
                selectable = true;
                neverMultiSelect = true;
                transmitsPower = true;
   
            Sandbags:
                pathCost = 60;
                coverPercent = 0.6f;
                maxHealth = 300;
                desc = "Cover from gunfire.";
                workToBuild = 50f;
                costList.Add(new ResourceCost(EntityType.Metal, 3));
                filthLeavings.Add("SandbagRubble", 2);
                selectable = true;
                neverMultiSelect = true;
                beauty = BeautyCategory.UglyTiny;
Title: Re: Save file structure
Post by: Galileus on November 15, 2013, 10:32:50 AM
Beautiful. Wanted to do such a stat-list too in future, but with your code it's way better!
Title: Re: Save file structure
Post by: Tynan on November 15, 2013, 11:24:48 AM
This kind of stuff really would enrich the wiki (http://rimworldwiki.com). And people will actually find it there.
Title: Re: Save file structure
Post by: Galileus on November 15, 2013, 11:34:39 AM
I was already contacted by one of wiki contributors. I will do it myself or ask for help in that matter when the whole thing is in a bit better shape - at least 100% noted (red/yellow or green) and perfectly with some holes filled and a little better construction.

People will find it on wiki, true - so better to get it there in best state possible :) Here it's easy to ask and reply and people can see the whole discussion.
Title: Re: Save file structure
Post by: Galileus on November 17, 2013, 08:29:33 AM
<Thing Class="Building_EquipmentRack">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<SlotGroup> :
<AcceptAnimalCorpses> Animal corpses on equipment rack?

<Thing Class="Building_Glower">

<Def> ; <ID> ; <Pos> ; <Team> ; <Health>

<PowerOn> ; <DesirePowerOn>

Quote<GlowOn>True</GlowOn> Defines that this is a lamp-tyle (glowing) object?

<Thing Class="Building_Grave">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>

<SlotGroup> :
<AcceptColonistCorpses> ; <AcceptStrangerCorpses> ; <AcceptAnimalCorpses>

<Thing Class="Building_NutrientDispenser">

<Def> ; <ID> ; <Pos> ; <Rot> ; <Team> ; <Health>
<PowerOn> ; <DesirePowerOn>

<Thing Class="Building_PlantGrower">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Team> ; <Health>

<Thing Class="Building_PowerPlantSolar">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Team> ; <Health>
<PowerOn> ; <DesirePowerOn>

<Thing Class="Building_PowerPlantSteam">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Team> ; <Health>
<PowerOn> ; <DesirePowerOn>

<Thing Class="Building_SteamGeyser">

<Def> ; <ID> ; <Pos> ; <Rot>

<Thing Class="Building_Storage">

<Def> ; <ID> ; <Pos> ; <Team>

<SlotGroup> :
<AcceptColonistCorpses> ; <AcceptStrangerCorpses> ; <AcceptAnimalCorpses>

<Thing Class="Corpse">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Health>

<Forbidden>

Quote<TimeOfDeath>2084927</TimeOfDeath> Tick in which pawn died
<SourcePawn>...</SourcePawn> Whole <Thing Class="Corpse"> content of the pawn that died

<Thing Class="Equipment">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Health>

<Forbidden>

<Thing Class="Filth">

<Def> ; <ID> ; <Pos>

Quote<Thickness>1</Thickness> Amount (density? sprite type?) of filth
<Sources>
   <String>Horton, Oaf</String> If type of filth can have "owner", he's defined here. In this example - Horton's blood.
</Sources>

<Thing Class="Plant">

<Def> ; <ID> ; <Pos> ; <Health>

Quote<GrowthPercent>0.4075205</GrowthPercent> How close is the plant to full growth, 1=fully grown
<Age>86000</Age> How old is the plant.

<Thing Class="Seed">

<Def> ; <ID> ; <Pos> ; <Rot>  ; <Health>

Quote<Origin>(196.5, 0.0, 152.5)</Origin> From where the seed travels
<Destination>(191.3, 0.0, 146.3)</Destination> To where the seed travels
<AssignedTarget>null</AssignedTarget> Can be anything other than null?
<TicksToImpact>28</TicksToImpact> How long till it gets to destination? Or how long till it's travel ends even if not reaching the destination?

<Thing Class="ThingResource">

<Def> ; <ID> ; <Pos> ; <Health>

Quote<StackCount>12</StackCount> Amount of resource in the stack
Title: Re: Save file structure
Post by: Galileus on November 17, 2013, 09:14:52 AM
<Thing Class="Pawn">

<Def> ; <ID> ; <Pos> ; <Team>

Quote<Kind>Mercenary</Kind> Description of pawn's role - Colonist, Grenadier, Sniper and so on. Only for human-based pawns.
<CharacterName>Moon</CharacterName> Name. Uses animal type for animals - but I do find it funny to name some muffalos or squirrels ;)
<Age>28</Age> Age of the pawn
<CarriedThing IsNull="True" /> If is carrying anything. Need a save where it does.

Quote<Drawer>
   <Renderer>
      <BodyName>Gray</BodyName>
      <HeadName>Bob</HeadName>
   </Renderer>
</Drawer> Names of body and head variation. There is only body variation for animals.

Quote<HealthTracker>
   <PawnHealth>100</PawnHealth> HP
</HealthTracker>

For animals:

Quote<Mind Class="Pawn_MindAnimal"> Defines the AI type for pawn Need a save with mad animal.
   <MindState>
      <EnemyTarget>null</EnemyTarget> Is in fight with anyone?
   </MindState>
</Mind>

For humans:

Quote<Mind Class="Pawn_MindHuman"> Defines the AI type for pawn
   <MindState>
      <DutyLocation>(187, 0, 36)</DutyLocation> Where is it's work destination
      <EnemyTarget>null</EnemyTarget> Is in fight with anyone?
   </MindState>
   <WorkSettings>
      <WorkPriorities>
         <KeyList> List of jobs this pawn can take
            <WorkType>Firefighter</WorkType>
            <WorkType>Construction</WorkType>
            <WorkType>Repair</WorkType>
            <WorkType>Growing</WorkType>
            <WorkType>Mining</WorkType>
            <WorkType>PlantCutting</WorkType>
            <WorkType>Hauling</WorkType>
            <WorkType>Cleaning</WorkType>
            <WorkType>Warden</WorkType>
            <WorkType>Doctor</WorkType>
         </KeyList>
         <ValueList> List of priorities for jobs above
            <Int32>4</Int32>
            (...)
            <Int32>4</Int32>
         </ValueList>
      </WorkPriorities>
   </WorkSettings>
</Mind>

Quote<Jobs>
   <CurJob>
      <JType>Goto</JType> Type of job pawn is currently performing
      <TargetA> Target and location for job
         <TargetThing>null</TargetThing> Job is targeted at that thing
         <TargetLoc>(188, 0, 36)</TargetLoc> Location of the job
      </TargetA>
      <TargetB IsNull="True" /> Secondary target and location for job location Examples?
   </CurJob>
   <CurJobDriver Class="JobDriver_Goto" /> Type of driver that processes the current job. May have sub-sections depending on the driver
</Jobs>

Quote<Pather>
   <Moving>True</Moving> Is pawn in motion?
   <NextSquare>(187, 0, 35)</NextSquare> Next tile it'll move to
   <TicksUntilMove>5</TicksUntilMove> Tick until start or finish of movement? Not present if <Moving>False</Moving>
   <TotalMoveDuration>40</TotalMoveDuration> How long was it walking?
   <Destination> Destination of the movement, not present if <Moving>False</Moving>
      <TargetThing>null</TargetThing> Thing it moves to - if any
      <TargetLoc>(188, 0, 36)</TargetLoc> Location of the destination
   </Destination>
</Pather>

Quote<Equipment>
   <Primary IsNull="True" /> No primary equipment - always like that for animals

   OR

   <Primary>
      <Def>Gun_M-24Rifle</Def> Name of equipment
      <ID>Gun_M-24Rifle2259836</ID> ID of equipment
      <Health>100</Health> HP of equipment
   </Primary>
   <Secondaries /> Secondary equipment - not present as of now
</Equipment>

Quote<Inventory>
   <InventoryList /> For animals and raiders

   OR

   <InventoryList> For colonists
      <Thing Class="ThingWithComponents">
         <Def>DoorKey</Def> Type of inventory - key to pen doors seems to be the only one in there now
         <ID>DoorKey1619941</ID> ID of the item
         <Health>30</Health> HP of the item
      </Thing>
   </InventoryList>
</Inventory>

Quote<Filth>
   <CarriedFilth> Filth the pawn has on itself (<CarriedFilth /> if no filth)
      <Filth Class="Filth"> Complete <Thing Class="Filth" for the filth carried on pawn
         <Def>FilthSand</Def>
         <ID>FilthSand2259568</ID>
         <Thickness>1</Thickness>
         <Sources />
      </Filth>
   </CarriedFilth>
</Filth>

Quote<Food>
   <PieceFood>
      <CurLevel>87.49426</CurLevel> Hunger. Lower = more hungry
   </PieceFood>
</Food>

For animals:

Quote<Rest IsNull="True" />
<Psychology IsNull="True" />
<Prisoner IsNull="True" />
<Ownership IsNull="True" />
<Talker IsNull="True" />
<Skills IsNull="True" />
<Story IsNull="True" />
<Traits>
   <TraitList />
</Traits>

For humans:

Quote<Rest>
   <PieceRest>
      <CurLevel>81.93433</CurLevel> Rest. Lower = more exhausted
   </PieceRest>
</Rest>

Quote<Psychology>
   <LoyaltyBase>
      <CurLevel>49.77994</CurLevel> Loyalty level
   </LoyaltyBase>
   <PieceHappiness>
      <CurLevel>49.77755</CurLevel> Happiness level
   </PieceHappiness>
   <PieceFear>
      <CurLevel>47.75155</CurLevel> Fear level
   </PieceFear>
   <PieceEnvironment>
      <CurLevel>35</CurLevel> How much it likes current environement
   </PieceEnvironment>
   <PieceOpenness>
      <CurLevel>52.5</CurLevel> How claustrophobic it gets (it's cramped thoughts)
   </PieceOpenness>
   <ThoughtHandler>
      <ThoughtList> List of thoughts it currently has
         <Thought Class="Thought">
            <ThoughtType>EnvironmentUgly</ThoughtType> Thought type
         </Thought>
      </ThoughtList>
   </ThoughtHandler>
</Psychology>

Quote<Prisoner IsNull="True" />  Is prisoner? Need save with a prisoner

Quote<Ownership>
   <OwnedBed>Bed1734551</OwnedBed> ID of bed it owns
</Ownership>

Quote<Talker>
   <LastTalkTime>2168790</LastTalkTime> Tick in which pawn had last social talk
</Talker>

Quote<Skills>
   <Level_Construction>10</Level_Construction> Level of a skill
   <XpSinceLastLevel_Construction>9428.652</XpSinceLastLevel_Construction> XP gained since last level-up
   <Level_Growing>7</Level_Growing>
   <XpSinceLastLevel_Growing>6737.5</XpSinceLastLevel_Growing>
   <Level_Research>7</Level_Research>
   <XpSinceLastLevel_Research>0</XpSinceLastLevel_Research>
   <Level_Mining>7</Level_Mining>
   <XpSinceLastLevel_Mining>128.7</XpSinceLastLevel_Mining>
   <Level_Shooting>3</Level_Shooting>
   <XpSinceLastLevel_Shooting>2497</XpSinceLastLevel_Shooting>
   <Level_Melee>3</Level_Melee>
   <XpSinceLastLevel_Melee>0</XpSinceLastLevel_Melee>
   <Level_Social>1</Level_Social>
   <XpSinceLastLevel_Social>746.803</XpSinceLastLevel_Social>
   <Level_Cooking>3</Level_Cooking>
   <XpSinceLastLevel_Cooking>0</XpSinceLastLevel_Cooking>
   <Level_Medicine>3</Level_Medicine>
   <XpSinceLastLevel_Medicine>0</XpSinceLastLevel_Medicine>
   <Level_Artistic>3</Level_Artistic>
   <XpSinceLastLevel_Artistic>0</XpSinceLastLevel_Artistic>
   <Level_Crafting>3</Level_Crafting>
   <XpSinceLastLevel_Crafting>0</XpSinceLastLevel_Crafting>
</Skills>

Quote<Story>
   <StoryItems>
      <Int32>18</Int32>
      <Int32>12</Int32> Backgrounds of the pawn
   </StoryItems>
</Story>

Quote<Traits>
   <TraitList> List of pawn's traits
      <Trait Class="Trait">
         <DefName>Double-jointed</DefName> Name of pawn's trait
      </Trait>
      <Trait Class="Trait">
         <DefName>Facial scars</DefName>
      </Trait>
   </TraitList>
</Traits>
Title: Re: Save file structure
Post by: Galileus on November 17, 2013, 02:37:52 PM
Started going through a cheat-game to get some useful saves, ended up loosing yet another 3 hours of my life.

DARN YOU, TYNAN! Why can't you be happy doing shitty games, like everyone else? WHYYY!?

And seriously, gathered some good saves there, so should be able to fill quite a few holes and whole thing will be good to go onto wiki soon.
Title: Re: Save file structure
Post by: ItchyFlea on November 25, 2013, 03:25:40 AM
While figuring out the save file structure myself so I could create my scenarios, I learned some things are aren't written here yet, so I thought it would be best to contribute. I used pink for the notes as my explanation may not be entirely accurate.

The following is taken from a boomrat I modified in an early test.
Quote
<CarriedThing Class="ThingResource">
<Def>Metal</Def> Type of resource carried
<ID>Metal22540</ID> Not entirely sure. Doesn't seem to matter if the ID is used multiple times.
<Pos>(98, 0, 103)</Pos> Position of the resource graphic. Best to use the same <Pos> as the entity.
<StackCount>60</StackCount> How much of the resource is being carried.
</CarriedThing>
Quote<Sex>Female</Sex> If this tag is present and contains 'Female' the entities gender is female. If this contains anything else, nothing is shown for gender. If this tag doesn't exist, the entities gender is Male.

This is taken from my Pirate Raid Scenario for droppods:

Quote
<Thing Class="DropPodIncoming">
<Def>DropPod(Incoming)</Def>
<ID>DropPod(Incoming)22115</ID>
<Pos>(100, 0, 98)</Pos> Where on the map the drop pod will land.
<TicksToImpact>150</TicksToImpact> How long until it lands. There seems to be a limit to how long this can be. 200?
<Contents>
<ContainedThing Class="Pawn">
Same contents as <Thing Class="Pawn">
</ContainedThing>
</Contents>
</Thing>

Also, for <Thing Class="Building"> Using this: <Team>Raider</Team> prevents the player from interacting with said building. This can be applied to pretty much anything, walls, doors, beds, etc. The player cannot sell Buildings owned by Raiders. (But can target and destroy them with the appropriate weapon.)
If an entity has a doorkey in their <Inventory> they can walk through any door unhindered, regardless of the Team setting.

I hope this helps.  :)
Title: Re: Save file structure
Post by: ItchyFlea on January 02, 2014, 11:04:12 PM
Weapon tags. Each weapon should have a unique number in the <ID> tag. It should also be 6 characters long.
The capitalization of the weapon name matters. If it is wrong, the game will fail to load the save file.

Pistol:
<Def>Gun_Pistol</Def>
<ID>Gun_Pistol211111</ID>


Shotgun:
<Def>Gun_Pump Shotgun</Def>
<ID>Gun_Pump Shotgun446694</ID>


T9:
<Def>Gun_T-9 Incendiary Launcher</Def>
<ID>Gun_T-9 Incendiary Launcher446696</ID>


Uzi:
<Def>Gun_Uzi</Def>
<ID>Gun_Uzi446694</ID>


Lee Enfield:
<Def>Gun_Lee-Enfield</Def>
<ID>Gun_Lee-Enfield446694</ID>


M16:
<Def>Gun_M-16Rifle</Def>
<ID>Gun_M16446694</ID>


R4:
<Def>Gun_R-4 charge rifle</Def>
<ID>Gun_R-4 charge rifle446694</ID>


M24:
<Def>Gun_M-24Rifle</Def>
<ID>Gun_M-24Rifle446694</ID>


Molotov:
<Def>Weapon_GrenadeMolotov</Def>
<ID>Weapon_GrenadeMolotov446694</ID>


Frag Grenade:
<Def>Weapon_GrenadeFrag</Def>
<ID>Weapon_GrenadeFrag446694</ID>


Turret Weapon (Extremely Over Powered):
<Def>Gun_Minigun</Def>
<ID>Gun_Minigun888111</ID>


Example weapon tag for a colonist holding a pistol. The <Pos> tag for the weapon is the same as the colonist <Pos> tag.
<Equipment>
<Primary>
<Def>Gun_Pistol</Def>
<ID>Gun_Pistol21111</ID>
<Pos>(100, 0, 95)</Pos>
<Health>100</Health>
</Primary>
<Secondaries />
</Equipment>
Title: Re: Save file structure
Post by: Darker on January 05, 2014, 06:38:48 PM
Oh, this post is very usefull, thank you. Now I see there is not much clear info about "binary" grids, so here is what I've found out:

As it's obvious thanks to == at the end, they are base64 encoded binary arrays. You may have mentioned that above, I don't know.

After decoding them, you will get byte array of width*height squares, so it's simply 1 byte per square. And the codes seem to be folowing (incomplete list!):

<TerrainMap>


27Concrete
28Rough hewn rock
29Rough stone
30Smooth stone
... ? ...
36Pawed tiles
37That spaceship tiles
38Blue carpet
39Green carpet
40Red carpet
... ? ...
49Gravel
50Dirt
51Dessert



Also, roofs seem to be revealed for now:
<RoofMap>


21Metal roof
22Thin rock roof
23Thick rock roof



There is an important thing to keep in mind though: [0,0] is in bottom left corner!

Title: Re: Save file structure
Post by: Darker on January 06, 2014, 03:45:15 PM
<LetterStack>
   
Quote
   <Letters> Located in the <Map> and contains letters similar to following:

         <Letter Class="Letter">  Letter wraper
            <Text></Text>  Letter text. Is there max length?


            <LookTarget> Determines "Jump to location behavior"
               <TargetThing>thingID or null</TargetThing> Thing id. What Ids are allowed?
               <TargetLoc>(80, 0, 74)</TargetLoc>Target coordinates, must not conflict with thing id. Z coordinate is ignored
            </LookTarget>
         </Letter>

      </Letters>
   </LetterStack>

More about <Text> so far:

Unicode characters render normaly, even insane ones, like chess symbols (http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode). This means theoretically, a UNICODE formating (underline, crosstext) should be possible.

HTML tags are stripped from the text. Does that mean HTML formating is planned, but not implemented?
Title: Re: Save file structure
Post by: Coenmcj on January 09, 2014, 11:54:36 PM
Quote from: deadbeat88 on November 13, 2013, 03:21:14 PM

<Kind>Colonist</Kind>  -- This actually links to the persons job or occupation, eg. Noble, settler, Assassin

Title: Re: Save file structure
Post by: ItchyFlea on January 10, 2014, 02:38:52 AM
Quote from: Coenmcj on January 09, 2014, 11:54:36 PM
Quote from: deadbeat88 on November 13, 2013, 03:21:14 PM

<Kind>Colonist</Kind>  -- This actually links to the persons job or occupation, eg. Noble, settler, Assassin

The <Kind> tag gives the pawn a description, ie: Raider, Colonist, Traveller, Psychotic, etc.
The pawn job/occupation is contained within the <Story> tag. (Specifically the <Int32>##</Int32> part)
Title: Re: Save file structure
Post by: ItchyFlea on January 10, 2014, 04:11:05 PM
The droppods you see when something is coming down from space can also be used as building's in-game.
They have a health of 500. Other than aesthetics, I don't think they have any use.
<Thing Class="Building">
<Def>DropPod</Def>
<ID>DropPod446837</ID>
<Pos>(107, 0, 99)</Pos>
<Team>Colonist</Team>
<Health>500</Health>
</Thing>
Title: Re: Save file structure
Post by: Darker on January 11, 2014, 08:31:50 AM
That's true. Also, you can add a contained thing to the drop pod:

Quote
      <Thing Class="DropPod">
         <Def>DropPod</Def>
         <ID>DropPod29875</ID>
         <Pos>(181, 0, 100)</Pos>
         <Health>500</Health>
         <TicksToOpen>200</TicksToOpen>  How long is one tick? Assume 1 ms
         <Contents>
          <ContainedThing Class="Building_TurretGun">So far, I haven't found anything that crashes the game.
             <Def>Auto-turret</Def>
             <ID>Auto-turret470207</ID>
               <Pos> Doesn't matter and can be omitted. It will be updated when thing is released. Nope, you can't warp things from drop pods around the map
             <Team>Raider</Team>
             <Health>600</Health>
             <PowerOn>True</PowerOn>
             <DesirePowerOn>True</DesirePowerOn>
          </ContainedThing>
         </Contents>
      </Thing>
Title: Re: Save file structure
Post by: DoomerDGR8 on January 15, 2014, 01:49:06 AM
Hi!

How to determine the colonist's type? I.e. Oaf, Miner, etc...

The mentioned nodes under a Pawn are:
<Team>Colonist</Team>
<Kind>Colonist</Kind>

But for each of my colonist, the values are always Colonist and Colonist. How do I know what the dude is from looking at the save file?

Thanks.
Title: Re: Save file structure
Post by: ItchyFlea on January 15, 2014, 05:20:52 AM
Quote from: DoomerDGR8 on January 15, 2014, 01:49:06 AM
Hi!

How to determine the colonist's type? I.e. Oaf, Miner, etc...

The mentioned nodes under a Pawn are:
<Team>Colonist</Team>
<Kind>Colonist</Kind>

But for each of my colonist, the values are always Colonist and Colonist. How do I know what the dude is from looking at the save file?

Thanks.

I mentioned this just a few posts up: http://ludeon.com/forums/index.php?topic=1083.msg14981#msg14981
The save file does not contain the pawn's type. The game generates that based on the pawn's backstory, which is contained in this:
<Story>
<StoryItems>
<Int32>17</Int32>
<Int32>3</Int32>
</StoryItems>
</Story>

I don't think anybody has compiled a list of what element corresponds to what Int32 value, or how the game determines the type based on those values. If you want a bit of a laugh though, set both those numbers to 20.
Title: Re: Save file structure
Post by: DoomerDGR8 on January 15, 2014, 05:53:49 AM
Quote from: ItchyFlea on January 15, 2014, 05:20:52 AM
Quote from: DoomerDGR8 on January 15, 2014, 01:49:06 AM
Hi!

How to determine the colonist's type? I.e. Oaf, Miner, etc...

The mentioned nodes under a Pawn are:
<Team>Colonist</Team>
<Kind>Colonist</Kind>

But for each of my colonist, the values are always Colonist and Colonist. How do I know what the dude is from looking at the save file?

Thanks.

I mentioned this just a few posts up: http://ludeon.com/forums/index.php?topic=1083.msg14981#msg14981
The save file does not contain the pawn's type. The game generates that based on the pawn's backstory, which is contained in this:
<Story>
<StoryItems>
<Int32>17</Int32>
<Int32>3</Int32>
</StoryItems>
</Story>

I don't think anybody has compiled a list of what element corresponds to what Int32 value, or how the game determines the type based on those values. If you want a bit of a laugh though, set both those numbers to 20.
Sorry! I went out for a quick lunch. In fact, I have completed the list myself and didn't updated my post. Here are my findings:


   
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
NameBackstoryCodeStatus
Colony settlerAdulthood0
Medieval farm oafAdulthood1
Medieval lordAdulthood2
Urbworld entrepreneurAdulthood3
Deep space minerAdulthood4
Navy scientistAdulthood5
Military commissarAdulthood6
Con ArtistAdulthood7NA
Space pirateAdulthood8NA
Pit BrawlerAdulthood9NA
Illegal shipwrightAdulthood10NA
CourteseanAdulthood11NA
Space MarineAdulthood12NA
AssassinAdulthood13NA
Midworld nerdChildhood14
Medieval slaveChildhood15
Medieval lordlingChildhood16
Urbworld urchinChildhood17
Vatgrown soldierChildhood18
Manufactured in a factoryChildhood19NA*
Traded aroundChildhood20NA*

Here, status of NA mean this perk is not available at character creation. NA* means secret perks.

Sorry for the delay and thanks for the reply.
Title: Re: Save file structure
Post by: Tynan on January 15, 2014, 03:13:39 PM
I'm afraid those numbers will change on next release. But hopefully not thereafter.

As for the pawns, there are some distinctions I'll just toss out.

A pawn has several different categories they belong to:

Team - This determines behavior in terms of who they'll attack/ignore/etc. Include special teams like Psychotic.
Race - This determines various physical characteristics and some parts of appearance.
Kind - This is a sub-kind of person under race. For example, there are important differences between a drifter and a pirate which aren't encoded in the race, but which I don't want to save over and over for every pawn. Most of them are technical and not saved, but this category is useful internally. Your colonists always get their kind changed to "colonist" on recruit. For reference, here are the fields of Kind, most of which are used internally only:

//Basics
public string raceName = ""; //Resolved on spawn
public string kindLabel = "UndefinedKindLabel";
public TeamType defaultTeam = TeamType.Neutral;
public ThinkNodeConfig thinkConfig = ThinkNodeConfig.Undefined;
public PawnSetupMethod setupMethod = null;
public bool aiAvoidCover = false;
public float recruitmentLoyaltyThreshold = 50;
public PathingParameters pathParams = PathParameters.smart;
public float baseIncapChancePerDamage = 0.01f;
public BackstoryCategory backstoryCategory;

//Visuals
public string standardBodyGraphicPath = "";

//Wild spawn parameters
public bool wildSpawn_spawnWild = false;
public float wildSpawn_EcoSystemWeight = 1f;
public IntRange wildSpawn_GroupSizeRange = IntRange.one;
public float wildSpawn_SelectionWeight = 1.0f;


This way, you could have two kinds of muffalo with different body graphics and setup methods (the setup creates the pawn and can randomize different health levels etc). Or two kinds of pirates with different health and weapon pools to draw from - like the game does with pirate vs drifter vs mercenary, etc.

Hope that's useful.

Title: Re: Save file structure
Post by: keensta on January 15, 2014, 03:32:59 PM
Quote from: Tynan on January 15, 2014, 03:13:39 PM
I'm afraid those numbers will change on next release. But hopefully not thereafter.

As for the pawns, there are some distinctions I'll just toss out.

A pawn has several different categories they belong to:

Team - This determines behavior in terms of who they'll attack/ignore/etc. Include special teams like Psychotic.
Race - This determines various physical characteristics and some parts of appearance.
Kind - This is a sub-kind of person under race. For example, there are important differences between a drifter and a pirate which aren't encoded in the race, but which I don't want to save over and over for every pawn. Most of them are technical and not saved, but this category is useful internally. Your colonists always get their kind changed to "colonist" on recruit. For reference, here are the fields of Kind, most of which are used internally only:

//Basics
public string raceName = ""; //Resolved on spawn
public string kindLabel = "UndefinedKindLabel";
public TeamType defaultTeam = TeamType.Neutral;
public ThinkNodeConfig thinkConfig = ThinkNodeConfig.Undefined;
public PawnSetupMethod setupMethod = null;
public bool aiAvoidCover = false;
public float recruitmentLoyaltyThreshold = 50;
public PathingParameters pathParams = PathParameters.smart;
public float baseIncapChancePerDamage = 0.01f;
public BackstoryCategory backstoryCategory;

//Visuals
public string standardBodyGraphicPath = "";

//Wild spawn parameters
public bool wildSpawn_spawnWild = false;
public float wildSpawn_EcoSystemWeight = 1f;
public IntRange wildSpawn_GroupSizeRange = IntRange.one;
public float wildSpawn_SelectionWeight = 1.0f;


This way, you could have two kinds of muffalo with different body graphics and setup methods (the setup creates the pawn and can randomize different health levels etc). Or two kinds of pirates with different health and weapon pools to draw from - like the game does with pirate vs drifter vs mercenary, etc.

Hope that's useful.

Ah, I'm currently developing a Save Editor for RimWorld I've just got the code down that allows the player to convert all raiders to colonists. (This is not good when I tested it on 43 raiders :( my computer started to lag slightly) But just so I understand is If you have a prisoner and you recruit them it makes them "Colonist, Colonist" does this mean to make Convert Raider work correctly I should do the same?

Currently it seems when I do this convert raider it turns them into colonists but some of them gang up on 1-4 other colonists and kill them off :(.. 
Title: Re: Save file structure
Post by: Tynan on January 15, 2014, 03:38:17 PM
Colonist, Colonist is the right configuration of Team/Kind.

Also be sure you're wiping out their jobs (replace with a short wait job) or they'll finish what they had started before you changed them.
Title: Re: Save file structure
Post by: keensta on January 15, 2014, 03:52:45 PM
Quote from: Tynan on January 15, 2014, 03:38:17 PM
Colonist, Colonist is the right configuration of Team/Kind.

Also be sure you're wiping out their jobs (replace with a short wait job) or they'll finish what they had started before you changed them.

Ok, Thanks for the information. I'll make sure to implement the change straight away.

Slightly off topic -
Also just to say I do love your involvement with the Community I've never been on a games forum and seen a developer like your self help the way you do.  I'm going to stick around for a long time and I will be sure to buy any future games that your studio produces.
Title: Re: Save file structure
Post by: Tynan on January 15, 2014, 05:51:48 PM
Quote from: keensta on January 15, 2014, 03:52:45 PM
Quote from: Tynan on January 15, 2014, 03:38:17 PM
Colonist, Colonist is the right configuration of Team/Kind.

Also be sure you're wiping out their jobs (replace with a short wait job) or they'll finish what they had started before you changed them.

Ok, Thanks for the information. I'll make sure to implement the change straight away.

Slightly off topic -
Also just to say I do love your involvement with the Community I've never been on a games forum and seen a developer like your self help the way you do.  I'm going to stick around for a long time and I will be sure to buy any future games that your studio produces.

Well, I came up from the modding scene long ago, I couldn't make a game and then ignore the people modding it!
Title: Re: Save file structure
Post by: Darker on January 16, 2014, 05:41:47 AM
Quoteconvert all raiders to colonists
You might also want to give them the "door key" item (look how colonists inventory looks like).
Title: Re: Save file structure
Post by: Tynan on January 16, 2014, 11:09:34 AM
Quote from: Darker on January 16, 2014, 05:41:47 AM
Quoteconvert all raiders to colonists
You might also want to give them the "door key" item (look how colonists inventory looks like).

Yes, this would be essential.