Engine: data structures (3.2.1) - adventuregamestudio/ags GitHub Wiki
AGS Engine defines a number of structures for storing game data. They may be roughly divided into static and runtime ones depending on their behavior during game run. Static data is saved by the editor when game is compiled and loaded when game is run by the engine; it may be partially written with the saved game. Runtime data is initialized at game start, written when game saves and read when game is being restored.
General game data
- Static type: GameSetupStruct, inherits GameSetupStructBase;
- Static object:
GameSetupStruct game
.
GameSetupStruct
is partially written to the saved game;
- Runtime type: GameState;
- Runtime object:
GameState play
.
Additionally, current game configuration is being stored as:
- Type: GameSetup;
- Object:
GameSetup usetup
.
It normally does not change hence may be considered static data.
Room data
- Static type: roomstruct;
- Static object:
roomstruct thisroom
.
thisroom
stores information of current room only (the room player character is in), other rooms are not stored in memory all the time, but being read to thisroom
as new room loads.
- Runtime type: RoomStatus;
- Runtime objects:
RoomStatus *roomstats
,RoomStatus troom
,RoomStatus *croom
.
roomstats
array stores MAX_ROOMS
runtime room states; troom
is a temporary room data used for non-state-saving rooms (those with number beyond MAX_ROOMS
); croom
is simply a pointer to current room's state: either one of roomstats
elements or troom
object.
Character data
- Static/runtime type: CharacterInfo;
- Static/runtime object:
CharacterInfo *chars
defined in GameSetupStructBase; - Runtime type: CharacterExtras;
- Runtime objects:
CharacterExtras *charextra
,CharacterInfo *playerchar
,CharacterInfo *facetalkchar
.
CharacterInfo
objects are being changed during game run. Array of CharacterExtras
provides extended data that cannot be put into CharacterInfo
struct due backward-compatibility considerations.
playerchar
is a pointer to player character's CharacterInfo
element from chars
array. facetalkchar
is a pointer to the character that is being speaking in Sierra-style dialogs with close-up portraits.