mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
3.2 KiB
3.2 KiB
Savegame Structure
- The Savegame is a TerranVirtualDisk archive that stores multiple files in the disk's root directory
- Savegame stores metadata, Worlds and Actors in the game
- A player gets one unique Savegame
- A player can have Multiple worlds
- Worlds are identified using integer ranged 1 through 32767 (inclusive)
- Actor ID is unique within the scope of the Savegame
- A World stores list of Actor IDs that resides in the world
File Structure
Each file on the Savegame has following convention:
| Type | Filename | ID |
|---|---|---|
| Metadata | savegame | -1 |
| Blocks Properties | blocks | -16 |
| Items Properties | items | -17 |
| Wires Properties | wires | -18 |
| Materials Properties | materials | -19 |
| Factions Properties | factions | -20 |
| Other Properties used by modules | modprops | -1024 |
| Worlds | world$n ($n is a world index) | $n |
| Actors | actor$n ($n is an Actor ID) | $n |
User formats can have ID of -2147483648..-65536
Solving Problems
How do I determine which world to read in?
Load the player (always has the entry ID of 9545698) and the property "worldCurrentlyPlaying" should contain an integer that is a world index. Only the actors that are instance of IngamePlayer will have the property.
Save File Examples
Following code is an example Savegame JSON files.
savegame.json
{
savename: "Test World 1",
genver: 0x00030001, /* generator version in integer; always use TerrarumAppConfiguration.VERSION_RAW */
terrseed: "84088805e145b555",
randseed: "19b25856e1c150ca834cffc8b59b23ad",
weatseed: "e5e72beb4e3c6926d3dc9e3e2ef7833b",
playerid: 9545698,
creation_t: <creation time in real-world unix time>,
lastplay_t: <last play time in real-world unix time>,
playtime_t: <total play time in real-world unix time>,
thumb: <Ascii85-encoded gzipped thumbnail image in TGA>,
loadorder: <LoadOrder serialised>,
worlds: [1,2,6,7]
}
world1.json
File is named as "world"+world_index+".json".
The fields are auto-generated by GDX's JSON serialiser.
{
worldName: "New World",
worldIndex: 1,
width: 9000,
height: 2250,
spawnX: 4500,
spawnY: 248,
creationTime: 1629857065,
lastPlayTime: 1629857065,
totalPlayTime: 0,
layerTerrain: {
h: <SHA-256 hash of 'b'>,
b: <Ascii85-encoded gzipped terrain layerdata>,
x: 9000,
y: 2250
},
layerWall: {
h: <SHA-256 hash of 'b'>,
b: <Ascii85-encoded gzipped wall layerdata>,
x: 9000,
y: 2250
},
wallDamages:{},
terrainDamages: {},
fluidTypes: {}
fluidFills: {},
wirings: {},
wiringGraph: {},
gravitation: {y:9.8}
globalLight: {
r:0.8826928,
g:0.8901961,
b:0.9055425,
a:0.93691504
},
averageTemperature: 288,
generatorSeed: 0,
worldTime: 27874,
tileNumberToNameMap: {},
extraFields: {},
genver: 4
comp: 1
}
actors.json
The fields are auto-generated by GDX's JSON serialiser.
[
{ /* actor serialised in JSON *
class: "net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer", /* depends on the actor */
referenceID: 1342111743,
actorValue: { /* actorValue serialised in JSON */ },
hitbox: ...,
...
},
...
]