Savegame - codingstyle/swift-dune GitHub Wiki

Filename

Dune saved gamed use the following naming convention:

DUNE[x][y]S[z].SAV

Where:

  • x is the game major version number
  • y is the game minor version number
  • z is the saved game slot number

Five versions of the game exist, with a specific saved game set of files for each:

Version Filename format
v2.1 DUNE21Sz.SAV
v2.3 DUNE23Sz.SAV
v2.4 DUNE24Sz.SAV
v3.7 DUNE37Sz.SAV
v3.8 DUNE38Sz.SAV

[!NOTE] File names is the only way to know which version of the game is running.

Dune creates five slots for the game during installation:

Filename Type Description
DUNExyS0.SAV Automatic restarts at the beginning of the game
DUNExyS1.SAV Manual user save slot #1
DUNExyS2.SAV Manual user save slot #2
DUNExyS4.SAV Automatic last place visited by player
DUNExyS5.SAV Automatic last new sietch explored by player

SAV file format

File decompression

SAV file format uses RLE compression. Compressed bytes are defined with 3 bytes:

  • F7 marks the beginning
  • Second byte is the number of occurences to uncompress
  • Third byte is the value to recreate

Example: F7 04 C4 must be decompressed to C4C4C4C4.

Format descriptors

Header

TO BE DEFINED

Map state

TO BE DEFINED

Game state

TO BE DEFINED

Locations

70 locations (palaces, forts and sietches) are defined in the file.

Each location is a structure containing 28 bytes (once decompressed).

Name Size Description
Location prefix 1 byte See table of prefixes below
Location suffix 1 byte See table of suffixes below
Unidentified 6 bytes Unidentified
Appearance 1 byte Unidentified
Troop ID 1 byte Reference to troop. See Troops below
Status 1 byte See table of statuses
Unidentified 5 bytes Unidentified
Spice field ID 1 byte Unidentified
Unidentified 1 byte Unidentified
Spice density 1 byte 0x00 to 0xFA for spice density
Unidentified 1 byte Unidentified
Harvesters 1 byte Number of harvesters
Ornithopters 1 byte Number of ornithopter
Knives 1 byte Number of knives
Guns 1 byte Number of guns
Weirding modules 1 byte Number of weirding modules
Atomics 1 byte Number of atomics
Bulbs 1 byte Number of bulbs
Water 1 byte Water supply amount

Troops

67 troops are defined in the savegame file.

Each troop is a structure containing 27 bytes (once decompressed).

Name Size Description
Troop ID 1 byte Troop unique identifier
Next Troop ID 1 byte Refers to the next troop is several in the same sietch. Last troop has next ID = 0x00
Position 1 byte See table of troop positions
Occupation 1 byte See table of troop occupations
Unidentified 2 bytes Same for each troop staying in same sietches
GPS location 4 bytes Coordinates on the map
Unidentified 8 bytes Related to troop activities
Dissatisfaction 1 byte For some bytes, troop refuse to work (0xFF for example)
Speech message 1 byte See table of troop messages
Miss You message 1 byte Unidentified
Motivation 1 byte 0x00 to 0x64 (0x64 or above is 100% motivation)
Spice skill 1 byte 0x00 to 0x5F (0x5F is expert)
Army skill 1 byte 0x00 to 0x5F (0x5F is expert)
Ecology skill 1 byte 0x00 to 0x5F (0x5F is expert)
Equipment 1 byte See table of equipment flags
Population 1 byte Population value divided by 10 (0xFF = 2550 people)

NPC

TO DO

Smugglers

TO DO

Appendices

Location names

Prefixes

Value Name
0x01 Arrakeen
0x02 Carthag
0x03 Tuono
0x04 Habbanya
0x05 Oxtyn
0x06 Tsympo
0x07 Bledan
0x08 Ergsun
0x09 Haga
0x0A Cielago
0x0B Sihaya
0x0C Celimyn

Suffixes

Value Name
0x00 No suffix
0x03 Tabr
0x04 Timin
0x05 Tuek
0x06 Harg
0x07 Clam
0x08 Tsymyn
0x09 Siet
0x0A Pyons
0x0B Pyort

Statuses

Flag Description
0x00 Visible sietch/village/palace
0x01 Vegetation present (no more spice mining possible)
0x02 In battle
0x04 Unknown
0x08 Unknown
0x10 See the inventory of the sietch
0x20 Wind-trap constructed
0x40 Area of sietch has been prospected
0x80 Sietch has not been discovered

Troop positions

Value Description
0x01 Sietch - South
0x02 Sietch - South-East
0x03 Sietch - South-West
0x04 Sietch - East
0x05 Sietch - West
0x06 Sietch - North-East
0x07 Sietch - North-West
0x08 Sietch - North
Other Various positions around the sietch

Troop occupations

[!NOTE] Seems like like [0x00]->[0x0F] upper list jobs

Value Description
0x00 Spice mining
0x01 Spice prospecting
0x02 Waiting orders
0x03 Spice miners going to search equipment
0x04 Military training
0x05 Espionage
0x06 Attacking
0x07 Militaries going to search equipment
0x08 Irrigation & Tree care
0x09 Wind-trap assembly
0x0A Bulb growing
0x0B Ecologists going to search equipment
0x0C Blue harkonnen spice mining
0x0D Blue harkonnen prospecting
0x0E Blue harkonnen waiting orders
0x0F Blue harkonnen spice miners going to search equipment
0x10 to 0x1F Upper jobs finished
0x1F Blue harkonnen militaries going to search equipment (CD: 150K/sec in text ^^)
0x20 Spice mining - No more orders to give
0x21 Troop prospecting captured - No more orders to give
0x22 Troop apologize for been captured
0x23 Spice miners going to search a spice harvester - No more orders to give
0x40 to 0x7F Moving to another place
0x80 to 0x9F Not yet hired
0xA0 to 0xFF Complain about slaving by harkonnen

Troop messages

Flag Description
0x01 Unknown
0x02 Gives the message that a small troop has merged with this troop
0x04 Troop is ill
0x08 Unknown
0x10 Gives the message that a fortress has been transformed into a sietch
0x20 Spice skill showing in troop characteristics
0x40 Army skill showing in troop characteristics
0x80 Ecology skill showing in troop characteristics

Troop equipment

Flag Description
0x01 Not assigned
0x02 Bulb
0x04 Atomic weapon
0x08 Weirding modules
0x10 Laser guns
0x20 Krys knives
0x40 Ornithopter
0x80 Spice harvester