You must be logged in to post messages.
Please login or register

Scenario Design and Modding
Moderated by Suppiluliuma, PhatFish, Fisk, Epd999

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Structure of the 'command' line in AoEd/RoRd
posted 07-23-10 12:28 PM ET (US)   
In RoRd, the "command" is stored all on one line as a set of 59 bytes per command. It seems to control which effects are activated depending on which units are targeted.

I have discovered that the format used in the command line is actually the same format as units.txt in AoK/SWGB GeniEd and is what StSB77 calls the "Unit Abilities" in AGE.
The alpha version of Age of Empires (that Litude sent me) also comes with extracted data from the DAT. The tr_obj.txt from that alpha includes all of the unit data, and in it, the commands each contain 29 values.

Note: All of the names in the C structure were either made up my me or came from AGE, and are not the official names.

C struct:
struct aoe_command
{
short one; //always 1
short id; //sequence number counting from 0
char flag_1; //0 or 1
short attr; //the "Type" in AGE
short class; //the "Class" in AGE
short unit; //the "Unit" in AGE
short unknown_s_1; //2 only for transports, -1 elsewhere
short res_in; //the "Resource In" in AGE
short unknown_s_2; //47 only for gold miners, -1 elsewhere
short res_out; //the "Resource Out" in AGE
short unknown_s_3; //always -1
float unknown_f_1;
float unknown_f_2;
float unknown_f_3;
char flag_2; //0 or 1
float unknown_f_4;
char flag_3; //0 or 1
char flag_4; //0 or 1
short flag_5; //0 or 1
short unused_s; //always 0
char unknown_c_1; //holds multiple values (0, 2, 3, 4, 5)
char flag_6; //0 or 1
char flag_7; //0 or 1
short graphics[6]; //graphics ID
} command[command_count];

That is not a mistake, flag_5 is actually a short. All shorts are -1 when unused, except for the unused_s and flag_5, which are 0. All floats and bytes are 0 when unused. A flag means that it can hold either 0 or 1.

Perl template:
s2cs8f3cfc2s2c3s6

The Perl template can be used with Perl's pack and unpack functions.

About the values:

one
Must be one. Setting it to 0 makes the game crash when loading a scenario or the Scenario Builder.

id
The id number of the specific command, counting from 0 until command_count-1.

attr
The type of command (attack, heal, garrison, etc.).
Example: 5 is used for Fishing Boats and Fishermen

class
Use this command only on units of this class.
Example: 9 and 10 for Hunters are prey and predator animals, respectively
Example: Transports are class 20, used for garrison ability

unit
Use this command only on this specific unit.
Example: 50 for the Farmer is the Unit ID of the Farm

res_in
The civ header resource the unit takes in. Usually the same as the actual civ header resource. For food, depends on the type of food. For trading, uses the Trade Goods resource.
Example: 9 is Trade Goods, 15 is meat, 16 is berries and grain (farm), 17 is fish

res_out
The civ header resource the res_in is converted into. In AoE, used only for food and trade. If res_in is the same as res_out, res_out is unused and set to -1.
Example: 0 is Food, see here

graphics
Transforms unit graphics unto this while command is in effect.
Example: the Hunter's 685 471 472 92 -1 -1

graphics[0]
Graphic used when walking with tool, but carrying no resources. (chopping tree, hunting, etc.)

graphics[1]
Graphic used when proceeding to gather a resource. (chopping tree, hunting, etc.) Also used for the running Lion.

graphics[2]
Graphic used when actually gathering a resource. (getting meat, foraging, mining, etc.) Also used for converting Priests and grazing Gazelles (considered an "attack").

graphics[3]
Graphic used when carrying a resource. (carrying meat, fish, gold, grain, etc.)

graphics[4]
graphics[5]

Unknown graphics. Both are always -1.
Replies:
posted 07-23-10 01:11 PM ET (US)     1 / 11  
Looks like a great find, if it hasn't been discovered yet.
posted 07-23-10 01:29 PM ET (US)     2 / 11  
Allthough a very few aspects of the command line were known, no one really understood what all the endless numbers are for. This might indeed be useful, but I can't say I understand what you wrote down here. Maybe it's because I'm very tired, but could you expand the information a little?
posted 08-04-10 02:21 PM ET (US)     3 / 11  
Excellent! I will check this out shortly
posted 08-04-10 04:16 PM ET (US)     4 / 11  
Breakthrough!! This means a lot to us Darks, this information will mean a lot to the modders of this community.

Thompson, this means we could add any ability to any unit, it also solves the mystery of alternate attack graphics, this means we could make hoplites walk with their spear high, but lower it if ordered to attack an enemy!

Once again, breakthrough.

//The warrior of Isola

"I lack quotes that demonstrate Humor Intelligence or anything about me."

Pineapplefish
Cleidopus gloriamaris
posted 08-22-10 07:50 PM ET (US)     5 / 11  
Other things we could do with this:
* Add garrisoning to any object (both "can be garrisoned" and "can garrison inside" abilities).
* Give units previously unknown special abilities (Artifact/Traitor team changing, conversion, healing, trading, attack capability for buildings, Wonder victory, gathering different resources).
* Give units multiple attacks (like a Priest or SWGB Jedi).
* Have different abilities for different targets (like bombing buildings, but shooting arrows at other units).

And just like with the Resources, the values are basically the same as in AoK, except without the AoK-specific stuff like Trebuchet packing/unpacking and Relic pickup/dropping.
posted 08-24-10 07:15 AM ET (US)     6 / 11  
Frukty, I don't think that this is going to change anything for the hoplite-attack. The walk and attack graphic are different slp in any case. It's just to hard to make it go smoothly from spear leaning on shoulder to spear high attack.

Darkrain, that are just some of the things I need to do in my modding. Thanks! Maybe you want to start experimenting with some of the features, like the town capture thing and garrison of building? That would be greatly appreciated.
posted 08-25-10 03:13 AM ET (US)     7 / 11  
Other things we could do with this:
* Add garrisoning to any object (both "can be garrisoned" and "can garrison inside" abilities).
* Give units previously unknown special abilities (Artifact/Traitor team changing, conversion, healing, trading, attack capability for buildings, Wonder victory, gathering different resources).
* Give units multiple attacks (like a Priest or SWGB Jedi).
* Have different abilities for different targets (like bombing buildings, but shooting arrows at other units).

And just like with the Resources, the values are basically the same as in AoK, except without the AoK-specific stuff like Trebuchet packing/unpacking and Relic pickup/dropping.
@DarkRain654

//example transporting a villager into another one
civ_1_unit_83_class: 20 //original class for transport / shows garrison amount display
civ_1_unit_83_garrison_amount: 5
civ_1_unit_83_command_attribute: 7 //sets so you can see the unload button and use it.

The only problem that lies though is you can only transport if you right along land that is next to a body of water. If you could explain how that code you posted above could solve or if anyone else has a solution. I would be greatful to hear.
posted 08-25-10 06:02 PM ET (US)     8 / 11  
Command attributes (taken from here and edited for AoE/RoR):
0 = Gives build command only for villagers, and no commands for other units.
1 = Animal
2 = Building
3 = Villager
4 = Military Unit
5 = Trading Unit
6 = Priest
7 = Transport Ship
8 = Artifact / Ruins
9 = Fishing Ship
In addition to the commands and status box, they control the "Click to select this ..." messages. These also control whether you survive if you only have those types of units left.

@ZacG:
In RoRd, a transport command is written like this:
1 0 *ID* 0 0 3 0 20 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 -128 63 0 0 0 0 0 0 0 0 0 0 0 4 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

The *ID* means the number of the command for that particular unit, starting with 0. The 3 means "Ability to Garrison" (according to AGE, a DAT editor mainly for AoK). The 20 means that the unit has the ability to garrison inside class 20 (so if you wanted, you could add a second one for building garrisoning so you don't have to make buildings class 20). Any unit that can enter a transport (like a villager) already has this command, but buildings, ships, animals, and Hero Hector do not, so they cannot enter transports.

The other part is "Ability to Unload (Boat-Like)" (the name used by AGE).

Ability to Unload in RoRd format:
1 0 *ID* 0 1 12 0 -1 -1 -1 -1 2 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

For villagers, it goes on the end of the civ_1_unit_83_command: line, and the ID would be 3. Also, change the command_count to one higher than the last command ID number.

It seems to have no effect on the villager. I think it's because the command_attribute already lets it unload, and this might just be for the right-click. It's actually the command_attribute, not the class or command, that controls the garrison amount, command icons, and the status box. I'm pretty sure that the command_attributes are hard-coded, but they could be somewhere in the unknown data.

AGE's Unit Abilities editor lists a lot more of the commands for AoK, which are the same for AoE/RoR too.

I can't figure out the problem with unloading when not on a shore, but I think it has something to do with terrain data.
posted 08-25-10 06:21 PM ET (US)     9 / 11  
Yes, I believe there is hard-coded commands. I still need to look into this in more detail, but from what I can remember the scout has hard-coded behaviour (no auto-attack).

Hopefully the unload is not hard-coded to shorelines only. Not sure on the AoEd/RoRd names, but there is a field which determines where a building/unit can be placed (I'm pretty sure that there are 2 fields, one for in game and another for the editor). If the unload terrain can be determined for each unit, then they would probably use the same values as the placement fields previously mentioned.

I would like to use the garrison feature for towers (villagers only) in my mod. I doubt that it would be possible to modify a towers attack based on its garrisoned units (as with AoK) but still, it would be a decent defensive move (tool rush counter-measure). Also, with enough micro it could also be a good attack move (imagine the possibilities for a DM game, forever hiding villies in your towers between counter attacks).
posted 08-26-10 04:42 AM ET (US)     10 / 11  
I hope you can get the buidling garrison thing right. It is an important feature of my warcamp.

I was able to make a scout that does attack. It was pretty simple. Just copy some lines from cavalry and it will attack.

Is there also some way to generate money, like with relics in aok? That would be great!
posted 08-26-10 07:02 AM ET (US)     11 / 11  
I actually had issues trying to making another unit without auto-attack (I want to create an upgrade for the scout)
Age of Empires Heaven » Forums » Scenario Design and Modding » Structure of the 'command' line in AoEd/RoRd
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Empires Heaven | HeavenGames