Step By Step Guide To Data Editing - Part 2

Article written by Jatayu
Published on 07-09-2016; updated on 07-10-2016
Tags: Modding Archives

Part 2 - Graphics Continued

Frames and angles

Angle: This is a little confusing concept. An angle is a set of frames that usually denotes a rotation. For example, the first 10 frames of slp gra00002 form the first angle. However angles do not necessarily relate to rotation. Gaia objects (the hay stack for example) also contain multiple angles. The haystack has 3 angles. You can put down a haystack and change the angle using the 'rotate' option on the units menu of the map editor.

A unit typically has 8 angles. However in an SLP only 5 angles need to be specified. This is because the game engine recognizing the graphic as a unit graphic will 'create' 3 angles - north eastern, eastern, south eastern by mirroring the north western, western and south western frame sets.

Certain units have more than 8 angles eg. ships. Ships and their sails typically have 16 angles. You can see the effect when they 'rotate into position'.

Buildings usually contain one angle. There are a few like the house which can be rotated to give different views.

Now let's look at the data relating to frames and angles in graphics_other.txt.

graphic_627_numframes: 10
graphic_627_angles: 8

The value of numframes is the number of frames in a single angle. Remember, for a unit this number will be (total number of frames / 5). This is because although the unit has 8 angles, there are only 5 in the SLP and the other 3 are created by mirroring.

Now look up the number of frames of an attacking longbowman. It has 75. Therefore numframes should be changed to 15.
You can look up the resource for the attacking longbowman in DRS_AoK (or MPS) to confirm (resource 702). The 1st 15 frames will have the archer facing southwards, the next south west and so on.

So we should make the following change in patches.txt:

graphic_627_numframes: 15
graphic_627_angles: 8

And our 'Archer to longbowman' mod is complete. This is exactly what oliver achieves with hex editing here, though this is a lot simpler.

Changing frames and angles can lead to a number of very interesting tricks.

Suppose the numframes is changed to x (where x is the total number of frames) and angles to 1. Then it will go through the entire frame set and cannot be rotated. In fact this is usually the case with flags.

Suppose I do this with a standing arbalest. Then he will appear to stand for a while in one angle, then rotate to the next and so on. In fact this is what I have done in the bombard tower's garrison graphic (look at patches.txt).

graphic_5258_slp: 2704
graphic_5258_numframes: 55
graphic_5258_angles: 1

(5258 is the garrison tag graphic of the bombard tower and 2704 is the slp of the attacking arbalest. You can get these two values from Genied2 and the SLP list)

In a similar way, if I use 1 frame and 100 angles. Then the unit will be 'frozen', but can be rotated to 100 different positions using the rotate command in the map editor. Eg.

graphic_1962_slp: 15014
graphic_1962_numframes: 1
graphic_1962_angles: 100

The graphic of SHALW is changed to the swamp terrain. 15014 refers to an slp in terrain.drs which contains the swamp terrain. This is used to create the impression of 'shoreless shallows'. Btw you can use interface graphics as well.

The changeable cloud, changing trees etc. were all done using this. Try to figure it out.

Delta values

One of the most important things, this allows you to combine several different graphic slots into one. Let's take another look at the ARCHR_AN and note these lines:

graphic_627_delta_count: 3
graphic_627_delta_000: 625 0 0 0 0 0 -1 0
graphic_627_delta_001: -1 0 0 0 0 0 -1 0
graphic_627_delta_002: 626 0 0 0 0 0 -1 0

The value 625 refers to graphic slot 625. Look up the graphic slot 625. You will find that it references the slp 0. Similarly 626 references slp 1.
The value of -1 in delta_001 means no slot is used.

graphic_626_slp: 1

Of course slp 1 does not exist, you can look it up in MPS/DRS_AoK. It is not known why ES chose to do things this way. However references to non existent slps will mean that no graphic will be displayed in it's place.

This notion of non existent slps abounds in the graphic slots. Consider the galleon standing graphic.

graphic_3885_name1: WARGA_ANW
graphic_3885_name2: W
graphic_3885_slp: 2263
graphic_3885_unknown01a: 00 00 00 01 14
graphic_3885_unknown01b: -1
graphic_3885_replay: 1
graphic_3885_unknown01c: 00 00 00 00 00 00 00 00
graphic_3885_delta_count: 9
graphic_3885_sound: 428
graphic_3885_extras: 0
graphic_3885_numframes: 10
graphic_3885_angles: 16
graphic_3885_unknown02: 1 0.15 0
graphic_3885_unknown03: 3
graphic_3885_id: 3885
graphic_3885_type: 12
graphic_3885_delta_000: 3894 0 0 0 0 0 -1 0
graphic_3885_delta_001: 4065 0 0 0 0 0 -1 0
graphic_3885_delta_002: 4069 0 0 0 0 0 -1 0
graphic_3885_delta_003: 4073 0 0 0 0 0 -1 0
graphic_3885_delta_004: 4061 0 0 0 0 0 -1 0
graphic_3885_delta_005: 4077 0 0 0 0 0 -1 0
graphic_3885_delta_006: 4081 0 0 0 0 0 -1 0
graphic_3885_delta_007: 4085 0 0 0 0 0 -1 0
graphic_3885_delta_008: 1895 0 0 0 0 0 -1 0

This is the standing graphic for the west European ships (that is why it is _ANW, _ANE is for east European, _ANF for Asian, _ANM for middle eastern. This is seen in buildings too).

This graphic references the slp 2263, which does not exist. In fact references to non existent slp 2263 abounds in graphics_other.txt (and confused me a lot), it seems to be a favourite whipping boy =). So the galleon entirely depends on its delta values for its graphics. These are no less than 8 separate graphics. The first one 3894 turns out to be the hull. The middle 6 are various sails and the last one 1895 is the shadow.

The Juggernaut ship is made by copying the Arabic galleon and substituting the turtle ship's hull and shadow. Look up patches_graphics.txt.


It wouldn't be much good if you could combine various graphics if you couldn't place them properly with respect to each other and got them all on top of each other. This is where the anchor displacement values come in. Take a look at the new champion attack graphic from patches.txt:

graphic_2896_delta_count: 4
graphic_2896_delta_000: 2896 0 0 0 0 25 -1 0
graphic_2896_delta_001: 2896 0 0 0 25 0 -1 0
graphic_2896_delta_002: 2896 0 0 0 0 -25 -1 0
graphic_2896_delta_003: 2896 0 0 0 -25 0 -1 0

The 2 values before the '-1' (which I don't know what it stands for) turnout to be the anchor displacements. They are in this form:

graphic__delta_: 0 0 0 x y -1 0

x is the distance from the left on which the new slot is placed. y is the distance from the bottom. Thus if you want to place a flag 190 units on top of your unit, it should be like this:

graphic_5258_delta_000: 4472 0 0 0 2 -190 -1 0

A few more interesting things about delta values:

  1. Delta values can refer to themselves: See the champion example, it puts a copy of itself 25 units to the top, left, right and bottom of itself. However in this case, the original is not displayed (there is no champion in the middle)
  2. Delta graphics do not inherit the number of frames and angles of the graphic slot. They behave independantly. Thus it is possible to combine a building with a unit (see chu ko noi with wall).
  3. Delta graphics reference to other deltas is ignored. Eg. if the elephant graphic slot referred to a boar standing next to it, and the boar referred to a jaguar next to it , then the elephant will have only the boar, not the jaguar. Had this been not so, 1. would have resulted in an infinite loop.
  4. Delta graphics of higher index are superimposed on those of lower index. Eg. the sails of a ship are superimposed on its hull - not the other way round!
Try aligning the sails/hull of the Renaissance gallease, oliver was apparently too lazy to do it himself =)

Unknowns and other things

There are also several other useful things in the graphics data. Eg, the_replay value is 1 if it is meant to replay, 0 otherwise.

Some useful things also come packaged as unknowns. For example:

graphic_627_unknown02: 0 0.07 0

The value in the middle is the amount of time in seconds to change from one frame to another. If we change this to say 0.7, the archer will be really slowed down in attacking. In my example I have slowed down the frame rate of the samurai and the two handed swordsman and speeded up the mill.

graphic_2630_unknown02: 0 0.8 0
graphic_1083_unknown02: 0 1.06 0
graphic_380_unknown02: 0 0.0465 0

By the way, I do not randomly know which value contains what. It is a little bit of intelligent guessing, looking at the corresponding numbers for projectiles, which change frames extremely fast, and decaying graphics which change extremely slow. Then I change a value and test it to see if my guess is right.

There is a lot of other things in the graphics data which I haven't discovered/forgotten to write just now. But that's all for now.

Part 3, which I haven't made as yet (and probably won't) is about research and techage slots. However the following threads and Genied1 help will give you most of the information you need. It is a part of Advanced Genie Editor.

Basically every technology, like training buildings or improving armour etc. are all stored in research and tech slots. Therefore you need to modify them to change technologies.

Altering a techage slot and Technology tree by scenario_t_c (in Genied1 helpsection)
Techediting notes by Trisolo

I hope you enjoyed this tutorial and will make your own data files. It's about time that data editing becomes part of the scenario designing community and is accepted as a norm, not an exception.

Do you want to comment on this article? Thank the author? Tribute resources for its improvement? Raze it to the ground?

Come by and visit its thread in the University Forum!