Genie graphic data

From GenieWiki

Jump to: navigation, search

Genie graphic data, like sound data, has an "intermediary" data structure instead of units accessing the graphic resources in the DRS file directly. Ensemble Studios' primary reason for this data appears to be for the storage of frame and angle numbers, though much of the data's use is unknown. Another advantage of this setup is that the graphic data does not have to be duplicated for units that look alike (such as all civilization's champions), though some duplicate data appears to exist.

Contents

The data structure

Here are the C-style structures Genie uses for its graphic data:

struct genie_graphic
{
	char name1[21];
	char name2[13];
	short slp;
	short unused1;		//always 0 (or -1 if graphic is unused)
	char unused2;		//always 0
	char unknown2;
	char unknown3;
	short unknown4;
	char replay;
	long unknown5;
	long unknown6;
	short link_count;
	short sound;
	char extras;
	short frame_count;
	short angle_count;
	float unknown7a;
	float frame_delay;
	float unknown7c;
	char unknown7d;
	short id;
	char type;
	char on_building;
};

struct genie_graphiclink
{
	short graphic_id;
	long  unused1;		//always 0
	short unused2;		//always 0
	short dx, dy;
	short unused3;		//always -1
	short unused4;		//always 0
};

struct genie_graphicextra
{
	short unknown9[6];
};

The graphicdelta structures immediately follow the primary structure, then the graphicextra structures follow that. There appears to be one graphicextra structure per angle.

name1, name2

These two name strings appear to be equal in all graphics, so the second one's use is unknown. Like the genie unit's internal name value, they are heavily abbreviated, such as "ARRG2NNE" meaning "Archery Range Fuedal Age (North) European".

slp_id

The SLP resource ID that contains the images used.

unknown2

Possible values: 0, 1, or 2.

unknown4

Possible values: -1 or 10 (or 0 if graphic is unused).

link_count

The number of genie_graphiclink structures that follow.

frame_count

The number of frames per angle.

angle_count

The number of angles stored in the SLP and also the number of "extra" structures if graphic.extras is non-zero. Most moving units have 8. Note that there are not usually this many angles in the SLP, the game engine flips some of the graphics to produce the missing angles.

frame_delay

The time delay between each frame.

id

The id of this graphic slot used by both units and the graphic links.

on_building

This seems to be a boolean indicating whether it is an on-building graphic (such as flames or ice).

link.graphic_id

This value refers to another graphic structure in the datafile, sometimes for shadows and sometimes for the combination of multiple graphics in one (ie, damage flames). More investigation is needed.

link.dx, link.dy

These values are the x and y distances from the hotspot of the linking graphic to the linked graphics. These relative positions are used primarily for on-building graphics such as flames and snow but sometimes for shadows as well.

Naming

As mentioned above, Ensemble Studios uses very compact internal names. Buildings start with the unit's internal name (such as "ARRG" for "Archery Range"), followed by the age (1-4), shadow information (N for no shadow, 1 for shadow), and then the culture:

  • E for Eastern/Northern European
  • W for Western European
  • M for Middle East
  • F for Far East
  • X for South American (Expansion pack)

For example, "ARRG2NNE" is the Feudal Age Archery Range for Eastern Europe, and "ARRG2N0E" is its shadow (which, in this case, does not exist).

Units also start with the internal name, followed by an underscore and then the action being performed:

  • AN for Attacking
  • DN for Dying
  • FN for Fidgeting
  • SN for Rotting (spoiling?)
  • WN for Walking
  • CN for Carrying (villagers)

As in the case of buildings (see above), the N is replaced by a number for shadows.

Personal tools