Per Files


Heaven’s Design Pages

 

MY EXPERIENCES WITH .PER FILES

By Phill Phree.

To download the Acrobat version of this file, click here or on the logo. 

Introduction

OK, let’s start simple. There may be some who don’t know this, so if you do don’t feel patronised. I make no assumptions about people’s knowledge in this article and hope there will be something here that all can find useful.

Two files are used to control a Computer Player (CP), the AI and the PER. Despite its name, the AI is not the artificial intelligence file and doesnot control how the computer player behaves. The AI file simply contains the list of buildings, units and technologies you wish the CP to make or research. See the AI files article here. How the CP uses the things it has made and researched, and how it behaves towards other players, is governed by the PER (Personality) file.

Before I continue I must state the following – THESE ARE GUIDELINES ONLY. They represent my experience from making campaigns for over a year now, and 3 months study on the files themselves, so I hope they are informed, but many aspects of PERs remain a mystery as parts of them have never been fully documented. Also, it is not my intention to display the meanings of all the numbers in the PER file here, that has been done before – note, however, that the Ensemble Studios / Microsoft documentation is vague, incomplete and almost utterly worthless as a reference. The best reference I have found is PerEdit by Martin Sturm, which can be found in the Granary in the Utilities section. It contains descriptions for the numbers (as far as they are known) and allows you to create your own PERs by selecting the traits you want from drop-down lists, but I find it quicker and easier to create the PER files in Notepad and just use PerEdit as a reference. The purpose of this document is to try and go one step further and attempt to help you create PERs that are customised to your needs, by pointing out some of the personality traits that I have found particularly useful (and not so useful).

So, with that said, let’s get down to it.

Getting started

The PER file contains all the personality traits you wish the CP to display, and does so by the use of Strategic Numbers (SNs). In Appendix 1 are the numbers themselves so you can copy and paste the traits you want into a new file for your personal use; there is also a text version for download. In Appendix 2 are the values accepted for each SN.

Each SN is a number pair i.e. the first number represents the trait, the second represents how strongly or otherwise that trait is implemented. An example is below (// denotes a comment for clarity – should you create and edit your own PERs you must put // in front of any comments, failure to do so may crash the game);

170 500 //SNMinimumFood

This means the computer will try and keep 500 food on hand at all times. The 500 can be changed to anything you wish in this case.

Other SNs accept a range of values where each value causes a variation in the basic behaviour, for instance;

49 1 //SNRetreatAfterTargetDestroyed

This can take 4 values – 1 means retreat if no other targets are in range, 2 means always retreat and 3 means seek out and destroy new targets (or extermination mode as it is called). 0 means never retreat and regroup at the current point. So although the basic behaviour is retreating, each value allows specialised forms of it.

There are also SNs that accept a value of 1 to turn them on or 0 to disable them, e.g.

196 //SNCoopShareAttacking

Set to 1, this allows CPs to attack to defend each other. Set to 0 it’s every CP for himself and is useful for when you want CPs to be allied but not to help each other against the player’s attacks. 

Some numbers depend on other numbers being implemented first, e.g.

103 //SNAttackIntelligence

This is 1 for on and 0 for off, and decides whether or not to use the intelligent attack system, whatever that means. It is a vague description that really says very little, and is typical of the documentation for these files. But we do know that it can be used with another SN, as follows;

103 1 //SNAttackIntelligence

47 //SNAttackCoordination

With the Attack Intelligence ‘switched on’, the Attack Coordination makes the CP smarter still when attacking you. If SN47 is set to 0 (or the SN is simply omitted from the PER file) then the attacks are not coordinated, but should still be relatively intelligent (for a CP). Set to 1, it allows the CP to attack with 1 coordinated group. Set to 2, it allows the CP to attack with multiple groups, and can therefore allow the CP to use multi-front attacks. This is the option I use pretty much all the time.

Of course you must make sure you have told the CP to have enough attack groups to do this with i.e. at least 2. Another point I would make here is to ensure, in your AI file, that you are making enough units to cover this, i.e. if you want 3 groups of at least 4 soldiers you must make a minimum of 12 in the AI. I know this seems obvious but in my experience the obvious is often overlooked. PER files take long enough without trying to fix a problem that is actually in the AI file.

Some Useful Numbers

I could easily turn this section into a dissertation so I’ll just give a few examples here. Hopefully it will give you some idea of the things you can do to help guide your CP along the route to becoming an efficient and clever enemy, within the constraints of the game.

 

How aggressive?

You may want the CP to keep attacking with no regard for its soldiers, perhaps because you have given the CP plenty of resources and that’s the nature of the enemy. Or you may want it to hit and pull back, to simulate raiding. The following numbers help to decide how aggressive or defensive a CP can be;

30 //SNPercentHealthRetreat

31 //SNPercentDeathRetreat

91 //SNPercentUnitHealthRetreat

The lower the values the more defensive. Higher values make good aggressive troops, and make great suicide squads. However, just because they are aggressive doesn’t mean they have to be stupid. They can still be pretty smart if they retreat after destroying targets, have attack intelligence, attack on more than one front etc. And consider numbers such as;

75 2 //SNGroupCommanderSelectionMethod

121 1 //SNDefendImportantGroupLeaders

I set these options for a CP who was Egyptian, resulting in a group of Scythe Chariots with Priests at the back. A tough group to beat, especially with the awesome range those guys have.

 

The Autobuild Set

Sometimes you don’t need to specifically tell the AI file to build. The Autobuild numbers in the PER are all very easy to use, they are simply 1 or 0. Here they are;

180 //SNAutoBuildHouses

205 //SNAutoBuildDropsites

206 //SNAutoBuildFarms

207 //SNAutoBuildTowers

208 //SNAutoBuildDocks

209 //SNAutoBuildFishingBoats

210 //SNAutoBuildTransports

223 //SNAutoBuildWarships

I never got the last one to work, so I always make warships in the AI instead. But the others have all worked well for me. This brings up an issue in itself. I remember Ingo saying once that he hated the way the CP made houses and spoilt his maps. When maps are made by a genius such as Ingo the frustration is not hard to see. Simply give SN180 a value of 0 to stop it happening. There are times when what you deliberately restrict the CP from doing is just as important as what you specifically tell it to do.

 

Tribute (and Diplomacy)

Lots of designers like playing with the tribute numbers because it’s the only way to get the CP to ‘speak’. But they have other uses too. For example, in a scenario I designed I did not want the player to tribute the CP because the story relies on them being destroyed, so to ensure the gameplay did not conflict with the campaign story I simply did the following;

217 0 //SNAllowDiplomacyChangeOnTribute

So no matter how much you give the CP it will still consider you an enemy. This is a diplomacy number, not a tribute number, but this value ties diplomacy and tribute together so it is very handy. Of course setting it to 1 can create interesting situations when there is more than one CP in the scenario, allowing you to possibly ally with one CP against another and get some help if you are having a hard time – I say possibly because the other CP(s) may try and tribute them too. For the record, when CPs tribute each other they often tribute a CP with a higher technology score, so alliances can be sometimes guessed from the achievements screen. Peter, however, has discovered several cases where this is not true, so don’t count on it.

Another very useful number is;

215 0 //SNAllowDiplomacyChangeOnAllyAttack

In The Glory of Amon Ra, in the last scenario, the player had a CP ally and fought against another CP. Just in case you hit your allies with e.g. a catapult stone by accident, it stopped them turning on you.

 

Getting resources

86 //SNStoragePitMaxDistance

87 //SNGranaryMaxDistance

These values are very useful if you don’t want your CP making drop sites miles away from the resource they are getting.

204 //SNMinimumElephantHuntGroupSize

In RoR the CP villagers don’t seem inclined to hunt elephants anyway, but if they do there is no point in them being suicidal, so make this around 4.

4 //SNCapCivilianBuilders

5 //SNCapCivilianGatherers

Sometimes the CP may be keener on resource gathering or building than attacking, so use these numbers to define the maximum number of villagers it can use for these tasks to stop it building endless peons.

Problems

Sometimes no matter what you do the CP just sits there with its army and won’t attack unless you go to them first. Other times you tell it to be defensive and it throws troops at you like terminally depressed lemmings. Consider the following SN;

20 //SNEnemySightedResponseDistance

This value should decide the range within which the CP will attack once it has spotted you. However, the maximum value, according to the documentation, is 144 tiles. When RoR came out it introduced Gigantic Maps but the PER values were never updated to accommodate this, so if you are at one end of the map and the CP is at the other, they may just sit there and do nothing. Ironically I have had them attack when they are on an island and so am I, on a Gigantic Map at opposite ends, and they have dropped transports full of troops on me, so you can never tell. But it may explain why sometimes they are static. Or not, who knows?

Another problem is that even on high path finding and hardest difficulty level, both of which bring out the best in PERs, if you have created a scenario with limited routes to the enemy the CP may not be very efficient with its attacks. Troops getting stuck in trees, or not being able to find you, or trying to send a big group through a small area and the CP ‘giving up’, all these have happened to me in scenarios I have designed and are incredibly frustrating. The only thing you can do in these cases is change the map a little to provide slightly better access and possibly play around with the SNs that govern exploring. Also, changes to a map can dramatically change the CP behaviour, so be aware of that, even placing or deleting a few trees can make a difference depending on the situation.

The bottom line here is TEST, TEST, TEST. My philosophy on this is that if I am not sick of the sight of it then I have not tested it enough. If you can find people willing to help you playtest (not usually a problem) so much the better; despite the fact that we all run and play the same game, effects on other peoples’ machines sometimes differ from your own. I had a scenario where the CP sat there and did nothing, only to be told by one of my playtesters that he found them very aggressive and quick to attack. I have no idea why, maybe it has something to do with the patches people have installed for the game, but having others try your stuff may save you from unnecessary time and effort trying to fix something that isn’t broken.

There is a very useful utility, the Speed Editor, again from the Granary, which allows you to speed up the whole game, and it works with both AoE and RoR. The highest speed you can set in the game itself is ‘very fast’, which is a speed of 20 in the Speed Editor. Run the Speed Editor before running the game, you must be out of the game to change the speed. Usually when testing I set it to about 50, this allows me to quickly see the effects of small adjustments to PER files without having to wait for hours, and, with PerEdit, gives me the best possible set of tools for working with these files. Why spend days testing your stuff when you can do it in hours? Be aware though that if you set the speed too high the game will be unplayable, and what you see will not necessarily be representative of what you have changed. A speed of 40-60 is about right, depending on the size of the map. It is also very useful for checking that your AI files are working correctly i.e. building what you want them to, in the right order etc. Playtest your scenarios with ‘reveal map’ and ‘no fog’ with a speed of 40-60 and you will quickly be able to monitor and adjust the PER and AI files as necessary.

And good luck. Anyone who has good results, bad results, questions, corrections or additions, please feel free to mail me at pphree@ntlworld.com

For all the SNs and their ranges, click on Page 1 or 2:

Pages: 1 2 3