Ply Files


Heaven’s Design Pages

 

Findings on the Play (Ply) File

by Rasher

The Basics

The aoe.ply file is found in your Age of Empires/data or /data2 folder. It is a small file, around 5KB, and here is what it does: The aoe.ply file is basically an extension of the Per file; it helps the AI use sophisticated strategy during it’s attack. The main difference between the Ply file and the Per file is that the Ply file is more complex and controls only the attack, and only one Ply file is used for the entire game, while many different Per files can be used. It seems the AI randomly selects an attack format from the Ply file, depending on it’s current situation. Next is a text file found on the AoE CD. I have included comments of my own in bold. The text in italics is the required code contained in a Ply file.

~ ~ ~
Age of Empires Sample Playbook
Friday, July 11, 1997
Version 0.3

The play system is a simple, flexible way that the computer players can utilize sophisticated strategies during attacks.

The computer player selects a target and a play. Those are passed off to a mid-level AI module that resides inside the computer player AI. This mid-level AI module acts as the group commander for the units in the play. It can make battle decisions without needing the higher-level computer player AI to be involved.

SYNTAX:

To key a play, start with the ‘Play’ keyword. Must be followed by a double-quoted playname.
Play “Simple Attack” – Pretty Basic; simply type a name

PlayType must currently be one of:
Attack – A straightforward, all-out attack – no flanking or special tactics
Annoy – The AI will attempt to annoy the player with small attacks. It’s intent is not to destroy, but to hassle and annoy
Flank – The AI will split up it’s groups and attack to flank it’s target – Much more copmlex than the normal attack
Recon – What the name implies – Simply a scouting mission
PlayType Attack

MinUnits must be at >= 1 and <= MaxUnits for the play to be available for use.
MinUnits 1 – Simply put the Minimum number of units in the play

MaxUnits must be at <= 255 and >= MaxUnits for the play to be available for use.
MaxUnits 255 – Put the Maximum number of units in the play

Power is a simple 1 to 100 rating of the play’s overall, brute strength (i.e. aggression).
Power 100 – Pretty straightforward

Overflow directs where the extra units (beyond the minimum requirements for each group) go. The available choices are:
Balance (each group is filled equally)
FirstGroup (the groups are filled in first come fashion)
Overflow Balance – Self-explanatory

Intelligence is just a simple measure of the intelligence of the play. It must be >= 1 and <= 100.
Intelligence 1 – For a more complex, strategic, and interesting attack, set this value to a higher number

DeathPercentage is a gauge of the overall loss percentage that will be incurred if this play is run as designed. It must be >= 0 and <= 100.
Death Percentage 50 – The percentage of units are are intended to be killed if the play is run correctly. So far, I can not get any part of this value to work correctly

TARGETTING:

Allows specialization of the targets this play can be used on. – Controls the target the AI is most likely to attack

TargetChar must currently be at least one of:
Any – It will choose the nearest target, or one it is being attacked by
Stationary – Self-explanatory
Moving – Self-explanatory
Slow – Example – Hoplites, Catapults
Fast – Example – Cavalry
Multiple TargetChars must be on different lines
TargetChar Any

TargetType must currently be at least one of:
Any – Basically, this does absolutely nothing
Multiple TargetTypes must be on different lines
TargetType Any

GROUPS:

The group makeup section allows subgroups to be organized within the units running this play. This is what provides the facilities for coordination and choreography in the play.

NumberGroups must be >= 1 and <= 5 for the the play to be available for use.
NumberGroups 1 – Put the number of groups of units you want involved in the play

Groups are numbered between 0 and 4, inclusive.
To specify that a group must be filled with a particular type of unit,
Use the following syntax: Group # UnitType Min – Max
Group 0 Ranged 1 – 255 – Set the group number, (0-4), the type of unit, (see list below), and the min-max group size

The currently available unit types available are:
Hand – Centurions, Axemen, etc…
Ranged – Archers, etc…
Priest – Self-Explanatory
Catapult – Self-Explanatory
Ballista – Self-Explanatory
Cavalry – Self-Explanatory
Legion – Self-Explanatory
The min and max are used to allow a range of the given unit type to appear in the group. If a unit type specialization is made within a group, the play will be invalidate if the minimum specialization requirement cannot be met.

PHASES:

The phases are a simple, state-driven system. One and only one phase is always active in any given play that is being run. There are 10 allowable phases per play. Due to the triggering system, the phases do not need to be linear other than Phase 0 being the entry point. The phase 255 is the end phase; triggering to that phase will end the play. Use the ‘Phase’ keyword followed by a number between 0 and 9 to start a phase. The appearance of any non-phase keyword signifies the end of the current phase. – Here is where the fun starts. This is the most detailed, and most complicated, part of the file. Basically, the PHASES are simple commands to be followed. They are set off at any time by triggers, which I will explain later. Once a phase is triggered, it is followed by the groups of units.
Phase 0 – Type in the phase number

To assign a command to a group, use the following syntax:
Group # Command Values – Type the group number, then a value from the list below

The available commands are:
Move X Y Z – This tells the group where to move. As of yet, I am unsure what the coordinated on the map are
Attack – Tells the group to attack immediately
Retreat – Tells the group to retreat immediately
Heal Group# – This tells one group to heal another. Type in the group to be healed after the phrase “heal group”
Attack Saved Target – Attack the last target attacked. This is useful if you want the AI to attack one target until it is gone
Wait – Simply tells the group to wait where it is
Reset Group Hit Point Tracker – ?
Reset Group Death Tracker – ?
Group 0 Move 15 0 0

To create a trigger (up to three per phase), use the following syntax: – A trigger is an event that sets off a phase. See below.
Trigger Phase#ToGoto TriggerEvent Value – Type in the number of the trigger, and the event that sets it off. All triggers must go in the same list as the Phase it is to work for.

The currently available trigger events are: – These are the events that can set off a trigger
Gather X (all units in group gathered within X tiles) – The trigger will be set off when all a group’s units are gathered within a certain area. Type a number of tiles
Death X (X% of the group’s units have died) – The trigger is set off when a certain percentage of the group’ units are killed units. Type a percentage number
HealthLost X (X% of the group’s overall health has been lost) – Self-Explanatory
DamageToGroup X (Group X took some damage) – The trigger is set off when any of the group’s units recieve ANY damage. Type the group number
DamageToAnyGroup (Any group took some damage) – Self-Explanatory
Level1EnemySighted (definition left to each game)- ?
Level2EnemySighted (definition left to each game) – ?
DeathOfGroup X (All units in Group X have died) – Self-Explanatory. Type the number of the group
HealOfGroup X (All units in Group X are at full health) – Self-Explanatory. Type the number of the group
Immediate (An immediate goto) – The trigger is set off immediately. Useful when you want the AI to move places in quick succession
Time X (X seconds have passed since last phase change) – Self Explanatory. Type a amount of time
Trigger 1 Gather 5
//Attack Phase
Phase 1
Group 0 Attack
Trigger 2 Death 50
//Retreat Phase
Phase 2
Group 0 Retreat
Trigger 255 Immediate

EndPlay must appear at the end of every play in the playbook.
EndPlay – Self Explanatory. Type Endplay at the end of every play

~ ~ ~

More Detail

I made some of my own plays and tested them, and yes, the DID work. It was very rewarding to see the AI come in with three groups of units, one made of priests. The two groups of units split up to attempt to flank my army, then attacked my fastest moving units (cavalry). After taking some damage, they retreated to a point, where they were healed by the group of priests, and then attacked again, making sure to take out the same unit they attacked last time. Quite interesting. However, there are a number of issues that need to be discussed.

Pros

This file can be used to make the AI’s attack much more complicated and strategic, as well as more speciallized. It is rather easy to work with, and using the tutorial above, most people should be able to use it.

Cons

Unfortunately, as with most things, there are a couple of cons that need to be mentioned. The first, and most serious, is the fact that the AI seems to randomly select a play from the playbook, so there is no garantee that the AI will use the play that you want, making this file unusable in scenarios, unless it is a basic random-map style scenario, where you and the enemy must both build-up to destroy the other. In this case, your play will probably be used from time to time. Other than this kind of scenario, there is no gaurantee that your play will be used at the right time.

Now, for the second con: Unlike the .per file, which you can set which computer player will use it, the .ply file works for ALL computer players, in all scenarios, and even random maps. So if you make a play that is usefull only in one scenario, it will be used in ALL aspects of the game, and could cause some extremely stupid AI attacks.

Conclusion

There are many useful aspects of the .ply file, but it is made diffucult for use in scenarios and campaigns by the cons described above. If you want some more interesting attacks in random maps, by all means go ahead, and you will probably recieve some good results. Other than that however, it does not have much use. If there was a way to select which AI player would use the play and when, this would be a very valuable tool to the Scenario Designer.

Final Conclusion

Stick to .per files.