Langband Savefiles

Langband has been inspired by the ARFC002 penned by Andrew Sidwell, but has done some modifications. This document describes the Langband savefile format in v0.1.2:

General Information

The savefile is constructed of a "savefile header", then followed by blocks. Little endian is used for this savefile format.

File Header

The file header has a four-byte "magic number". This magic number differs from "83.97.118.101" in ARFC002 and is "83.97.118.102". (This spoils some of the magic number pun, but this is an iteration :-) This can easily be used to check if indeed this is a langband savefile. The magic number is followed by two u16b version numbers; a version number for the engine used and a version number for the variant. Langband is split in engine and variant and both of these numbers are relevant. Regular angbands may eventually need both numbers if lua-scripting expands and lua "mods" written by users change from a released version but needs savefile access.

104 bytes in total.
Format of file header
byteFake major: 83
byteFake minor: 97
byteFake patch: 118
byteFake extra: 102
u16bMajor/Engine version
u16bMinor/Variant version
24 bytesId that identifies variant/mod/patchset to use
u16bSavefile status, a code of 0 means the character is dead
64 bytesDescription of the savegame, useful for a savebrowser or when selecting one of many saves.
u16bNumber of saveblocks in the file

This header may be extended with a savedate, and other info at a later date. Input appreciated.

Format of saveblock

28 bytes in total + actual data in block
Format of a saveblock
u32b (4 bytes)Vendor of block, eg- personal "key" (Langband uses 1337)
u16b (2 bytes)Type of block
u16b (2 bytes)Block version number
u32b (4 bytes)Length of data-field in the block
u128b (16 bytes)Checksum for the savebuffer
xxxThe actual data (Length specified earlier in header)

stig@langband.org
Last modified: Fri Dec 6 18:34:42 CET 2002