Save file structure

Started by Galileus, November 13, 2013, 06:57:56 AM

Previous topic - Next topic

Galileus

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

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 ;)

Galileus

#1
<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!

deadbeat88

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.  :(
Whatever you do, don't do it!

Galileus

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 :)

deadbeat88

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
Whatever you do, don't do it!

Galileus

<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>

Wopian

#6
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


Bobstudios | James Harris Creative Design

Galileus


Wopian

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.


Bobstudios | James Harris Creative Design

Galileus

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

Wopian

<Realtime>
  <TimeUnpaused />
<Realtime>

appears to be the time in seconds the game has been running in real life seconds.


Bobstudios | James Harris Creative Design

deadbeat88

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]
Whatever you do, don't do it!

Galileus

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!

Tynan

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.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Galileus

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