Difference between revisions of "AGI Specifications: Chapter 10 - Savegame Files"

From AGI Wiki
Jump to navigationJump to search
Line 6: Line 6:
  
  
==<br /> <div id="ss10.1"></div><br />10.1 Format of the Savegame File ==
+
[[Adventure Game Interpreter Specifications|Table of Contents]]
  
The <code>object</code> file stores two bits of information about the inventory items used in an AGI game. The starting room location and the name of the inventory item. It also has a byte that determines the maximum number of animated objects.
+
<div align="center"><div id="savedgames"></div><div id="s10"></div><br /><span style="font-size: 22pt">Saved Game Files</span><br />
 +
''Begun by [[David Symonds]]''<br />
 +
''Continued by [[Lance Ewing]]''<br />
 +
''(Last updated: 8 March 2017)''</div>
  
 +
&nbsp;
  
 +
==<br /> <div id="ss10.1"></div><br />10.1 Introduction ==
 +
 +
AGI saved game files are named as follows:
 +
 +
<gameId>SG.<num>
 +
 +
where <gameId> is the ID of the game, e.g. KQ1, SQ2, etc., and where <num> is a number starting at 1. The format of the saved game file was relatively consistent between versions 2.4XX and 2.9XX apart from one minor addition. The specification below currently focuses on the format used by that version range. The format of AGI v3 saved games has not yet been explored, but it is known that AGI v2.272 differs somewhat in format and almost certainly those versions prior to 2.272 will therefore be different as well.
 +
 +
The saved game file consists of six sections. The first section contains only the description of the saved game. We'll call this the header. The other five sections follow a high level format where the first two bytes give the length of the section and the remainder is the data for that section.
 +
 +
Note that the byte offsets for each section are specified as being from the start of that section and not the start of the file.
  
 
Where a numeric value is specified over multiple bytes, it is always ''little-endian'', unless otherwise noted.
 
Where a numeric value is specified over multiple bytes, it is always ''little-endian'', unless otherwise noted.
  
 +
== <div id="ss10.2"></div><br />10.2 Saved Game Format ==
 +
 +
====<br /> Header ====
 +
 +
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-30</code>||<code>Savegame description. This can be up to 30 printable characters, and is padded out with NUL (\0) bytes to a total of 31 bytes.</code>
 +
|}
 +
</blockquote>
 +
 +
====<br /> General State ====
  
====<br /> Header (40 bytes) ====
+
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-1</code>||<code>Length of general state section.</code>
 +
|-
 +
|align="center"|<code>2-8</code>||<code>Game ID("SQ2", "KQ3", "LLLLL", etc.), NUL padded.</code>
 +
|-
 +
|align="center"|<code>9-264</code>||<code>Variables, 1 variable per byte</code>
 +
|-
 +
|align="center"|<code>265-296</code>||<code>Flags, 8 flags per byte, starting with highest bit first.</code>
 +
|-
 +
|align="center"|<code>297-300</code>||<code>Clock ticks since game started. 1 clock tick == 50ms.</code>
 +
|-
 +
|align="center"|<code>301-302</code>||<code>Horizon.</code>
 +
|-
 +
|align="center"|<code>WIP</code>||<code>WORK IN PROGRESS</code>
 +
|}
 +
</blockquote>
  
'''0-30''' (31 bytes) Savegame description. This can be up to 30 printable characters, and is padded out with NUL (\0) bytes to a total of 31 bytes.
+
====<br /> Animated Objects ====
  
'''31-32''' (2 bytes) Unknown (0xE1 0x05); maybe a savegame version number?
+
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-1</code>||<code>Length of animated objects section.</code>
 +
|-
 +
|align="center"|<code>WIP</code>||<code>WORK IN PROGRESS</code>
 +
|}
 +
</blockquote>
  
'''33-39''' (7 bytes) Game ID ("SQ2", "KQ3", "LLLLL", etc.), NUL padded.
 
  
====<br /> Game State ====
+
====<br /> Inventory Objects ====
  
'''40-295''' (256 bytes) Variables, 1 variable per byte
+
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-1</code>||<code>Length of inventory objects section.</code>
 +
|-
 +
|align="center"|<code>WIP</code>||<code>WORK IN PROGRESS</code>
 +
|}
 +
</blockquote>
  
'''296-327''' (32 bytes) Flags, 8 flags per byte
+
====<br /> Script Events ====
  
'''328-331''' (4 bytes) Clock ticks since game started. 1 clock tick == 50ms.
+
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-1</code>||<code>Length of script events section.</code>
 +
|-
 +
|align="center"|<code>WIP</code>||<code>WORK IN PROGRESS</code>
 +
|}
 +
</blockquote>
  
...
+
====<br /> Scan Offsets ====
  
'''344-345''' (2 bytes) ? 1 => player_control
+
<blockquote>
 +
{| class="wikitable"
 +
|-
 +
!Byte!!Meaning
 +
|-
 +
|align="center"|<code>0-1</code>||<code>Length of scan offsets section.</code>
 +
|-
 +
|align="center"|<code>WIP</code>||<code>WORK IN PROGRESS</code>
 +
|}
 +
</blockquote>
  
  

Revision as of 16:53, 8 March 2017

Table of Contents


Savegame Files

Written by

(Last updated: 31 August 1997).


Table of Contents


Saved Game Files

Begun by David Symonds
Continued by Lance Ewing

(Last updated: 8 March 2017)

 



10.1 Introduction

AGI saved game files are named as follows:

<gameId>SG.<num>

where <gameId> is the ID of the game, e.g. KQ1, SQ2, etc., and where <num> is a number starting at 1. The format of the saved game file was relatively consistent between versions 2.4XX and 2.9XX apart from one minor addition. The specification below currently focuses on the format used by that version range. The format of AGI v3 saved games has not yet been explored, but it is known that AGI v2.272 differs somewhat in format and almost certainly those versions prior to 2.272 will therefore be different as well.

The saved game file consists of six sections. The first section contains only the description of the saved game. We'll call this the header. The other five sections follow a high level format where the first two bytes give the length of the section and the remainder is the data for that section.

Note that the byte offsets for each section are specified as being from the start of that section and not the start of the file.

Where a numeric value is specified over multiple bytes, it is always little-endian, unless otherwise noted.


10.2 Saved Game Format


Header

Byte Meaning
0-30 Savegame description. This can be up to 30 printable characters, and is padded out with NUL (\0) bytes to a total of 31 bytes.


General State

Byte Meaning
0-1 Length of general state section.
2-8 Game ID("SQ2", "KQ3", "LLLLL", etc.), NUL padded.
9-264 Variables, 1 variable per byte
265-296 Flags, 8 flags per byte, starting with highest bit first.
297-300 Clock ticks since game started. 1 clock tick == 50ms.
301-302 Horizon.
WIP WORK IN PROGRESS


Animated Objects

Byte Meaning
0-1 Length of animated objects section.
WIP WORK IN PROGRESS



Inventory Objects

Byte Meaning
0-1 Length of inventory objects section.
WIP WORK IN PROGRESS


Script Events

Byte Meaning
0-1 Length of script events section.
WIP WORK IN PROGRESS


Scan Offsets

Byte Meaning
0-1 Length of scan offsets section.
WIP WORK IN PROGRESS


Table of Contents

< Previous: Chapter 9 - Sound ResourcesNext: Chapter 11 - Other Game Data >