Recent Forum posts
The Dorian Invasion (2 replies)
Posted 3 weeks ago by Eurotool
Is it possible to rip sprites and icons ... (2 replies)
Posted 3 weeks ago by PhatFish
Championship 1v1 ROR Tournament (New)
Posted 1 month ago by Zarrr
Any players out there? (2 replies)
Posted 1 month ago by pianolarva
Livestream friendly battle VN and CN ... (3 replies)
Posted 1 month ago by pianolarva
Long time lurker (9 replies)
Posted 1 month ago by pianolarva
Porting AOE Definitive Edition Maps ... (3 replies)
Posted 2 months ago by Filthydelphia
Do ROR scenarios have triggers and everything ... (2 replies)
Posted 2 months ago by PhatFish
Original AoE1 graphics mod for Return ... (6 replies)
Posted 2 months ago by PartizanLegis
A guide to using Triggers (New)
Posted 2 months ago by PhatFish
Latest Files
Age of Empires Heaven :: Download Central
Random Screenshot
  • age_of_empires_definitive_edition_screenshot_massive_city_.png
  • History Tidbits
    Loading Quotes...
    Report on .CTY Files

    Report on .CTY Files

    by SBE


    Many people in the past have said how .cty files “DON’T WORK!!!!”, to quote Eggman on the AoEH forums. Although I can say that they “DO WORK!!!!”, they only work in a limited way. To quote ES_DeathShrimp, “To the best of my knowledge…they were a good idea that was apparently dropped halfway through its implementation. That is not to say the cty [.cty files] won’t work, but don’t kill yourself trying.” Now, ES_DeathShrimp said himself that there’s nothing to say that they don’t work, but that it’s not worth the bother to force them to work. So they must work in some way, but not fully, or as originally planned. There follows my findings on these files and their limitations.

    First of all, the format of .cty files is as follows. Each line, taken from default.cty is in this general format,

    8.000000 4.000000 0 3 3 3 -1 Any_Type.

    The first two figures represent the coordinates of the centre of the building selected from the centre of the Town Centre, which is at the origin, or (0,0). In other words, the building selected would have its centre at (8,4). The following four numbers are somewhat confusing in a way. The first figure, in this case ‘0’, to the best of my knowledge has no relevance or significance at all. It doesn’t alter the way in which buildings are constructed, rebuilt, the order in which they’re built, or indeed where they’re built. I also have no idea what it represents, or indeed what it could represent. There has been little speculation as to its possible relevance, so we can only forget it for now. The next two numbers, ‘3’ and ‘3’, represent the size of the building selected, in this case 3×3, for example, a Town Centre or Barracks or Academy and so on. If these figures were both 2, then the building selected could either be a house or Tower. If both figures were 1, then it could only represent a wall section. The fourth figure, or in the above case, the third ‘3’ in the sequence, to my knowledge has no significance. There has been speculation on the AoEH forums by Ishaul that it represents a reference point to the Town Centre. This is rubbish, as there’s already a reference to the Town Centre; that being the two figures mentioned above referring to the coordinates of the selected building! Other ideas by Ishaul included a reference to the edge or even centre of the map (again, rubbish imho), the gap size to leave between buildings (which buildings? on which side? which gap? This one’s difficult to substantiate), rebuild amounts (this is controlled by the AI file) and elevation (again, rubbish, as the two coordinates suffice for positions, whether they’re elevated with respect to the Town Centre or not), nice tries though Ishaul ;-). Ideas by myself, SBE, are whether a rebuild takes place in the same place (0 for no and 1 for yes), or whether a rebuild takes place at all (again 0 for no and 1 for yes), as opposed to how many rebuilds take place. However to the best of my knowledge the fourth figure after the coordinates in the above sequence has no significance at all, and has no effect on the game, no matter what value you put there. The fifth figure after the coordinates, in this case ‘-1’, represents the type of building selected. –1 represents any building, in other words it’s a location that the computer can use for any building that fits the relevant dimensions (either 1×1, 2×2 or 3×3). This figure could also be 109, which would reserve the location for a Town Centre (which must be selected in the relevant .ai file so that the computer knows to build one!), or 0 for an Academy, or 82 for a government centre and so on. It is not necessary to type the name of the building out on each line as it is in default.cty, in fact there’s no need to have all those zeros in the coordinates either, just the significant figures suffice. So, 

    8 4 0 3 3 3 –1

    would suffice, when,

    8.000000 4.000000 0 3 3 3 -1 Any_Type

    becomes cumbersome! The article on .cty files by Bruce Denyes (dated Feb 9, 1998, available from the Siege Workshop at AoEH) is very helpful in determining the coordinates of each building and also on the mistakes in default.cty. There are other mistakes however which he failed to mention for whatever reason:

    • The dimensions for the Town Centre are shown as 2×2, when they clearly should be 3×3. The correct line should therefore read: 

      0.000000 0.000000 0 3 3 3 109 Town_Centre1

    • The dimensions for the wall sections are shown as 0x0 (clearly impossible lol), when they should be 1×1, however Bruce Denyes found that .cty files cannot determine the placement of walls and Towers, rendering this mistake irrelevant. I must admit that I’ve not yet had any success with wall and Tower placement through use of .cty files, even with cooperation of a .per file, which alone is sufficient to build a perimeter wall. A .per file will only build a square perimeter wall however, whereas with the use of a .cty file, it could be possible to build a non-square perimeter wall. As always, I’m optimistic that it’s possible, and I will type further if and when I gain success in this case. For the record, an example of a correct line should read: 

      -11.000000 -11.000000 0 1 1 1 72 Wall_Small

    • Lastly, it’s not so much a problem, but a highly stupid move by the computer to wall itself in. And it will do this if it follows the wall placements in default.cty! There should be provision, for ‘gates’ on each side, for example, of the square perimeter wall surrounding the ‘city’.
    • Errors found by Bruce Denyes include text errors on line 26 and 37, no provision for a wonder, the (x,y) coordinate system that .cty files use and finally an error with the building code for watch Towers on lines 2-9.

    What now follows is a general discussion on .cty files as I tested them painstakingly. The dimensions must be correct for a building to be constructed in the relevant position, which may seem obvious, but hey, nothing is obvious with these files. The Town Centre will generally not be rebuilt in the location set in the .cty file. If destroyed it will almost always in my experience be rebuilt about 5-10 units away from the original position. This poses the problem, “what if the Town Centre is destroyed and building is still taking place? Does the computer continue to take the original position of the Town Centre as the origin, or does it use the new Town Centre as the origin, from which to construct further buildings?” Further testing is necessary for this. I found time and time again that the computer would construct buildings that aren’t in the .cty file, or sometimes ones that are in the .cty file, but in positions not specified in the .cty file. This doesn’t surprise me. And this must be one of the flaws in the .cty files that ES_DeathShrimp warned us gamers not to kill ourselves trying to solve. This means that it may be impossible to get the computer to build a ‘city’ just as you want it. However, again, I’m being optimistic in saying that it may be possible to make the computer build a ‘city’ for a scenario, one which is unique to that scenario, but it may not be possible to have the computer generate powerful, and good-looking ‘cities’ for use in random maps or death matches for example. It would be far too difficult to arrive at a situation where you could force the computer to generate a top-notch city from scratch for use in a random map. One reason for this is that the general map layout would be different for each random map, and along with this, the original position of the Town Centre for computer players would render any ‘general’ .cty file worthless. With the aid of higher resource levels and open spaces reserved for specific buildings, it may be possible to use .cty files successfully in scenarios though. It will certainly be easier to do so with the cooperation of .ai and .per files also. Sometimes, say, a farm will be built in a position not specified in the .cty file for a farm or for a 3×3 “Any_Type” building, even when there is a space available for it! Again, this must be one of the flaws that are not worth figuring out. It had been speculated on AoEH forums by Eggman that, “The main problem is, once the cpu [computer] puts a single building out of place, the whole plan is permanently scrapped. Almost anything can ruin the file, from a stray gazelle running across the build area to one of the cpu’s [computers] own Villagers standing in the wrong spot at the second it decides to try and place a building there.” I’m unsure as to whether this argument holds any water, however I do know that it would take immense testing to prove this, something that I’m not prepared to do. The computer doesn’t appear to take notice of any order of building, determined by the .cty file. For example it will not always take the first available position in the relevant .cty file, except in the case of houses. In my experience the computer, strangely and almost laughably, always took the first available position for houses and built them according to the .cty I used. WEIRD! I’m not sure that this holds in every case but it certainly did in the testing that I did. One thing for sure though is that the computer will always, and without fail, build exactly the same ‘city’ each time you run the game with the use of relevant, sound .cty, .ai and .per files. I ran the same set of files at least 10 times one day, and the computer built exactly the same city, and even constructed the exact same economy, with the same number of units and the same actions each time! So, if you can get a .cty to work once then you can be guaranteed that it will work indefinitely, according to my findings.

    In conclusion, I would give you all the following advice: Give .cty files a chance in any campaigns or scenarios that you make; however if it doesn’t work after a couple of attempts then forget it! And don’t bother to try and get them to work perfectly, or even desirably, as the above report is pretty final. It is unlikely, even highly unlikely, that Ensemble Studios will bring out a patch to fix the problems with .cty files, or any kind of new patch for that matter. So I fear we must be content with the great game as it is in the foreseeable future. The problems with .cty files do not detract from the addictiveness of the game however, and should not stop further creation of quality campaigns and scenarios.


    SBE – Leicester, UK – 27-06-01

    Comments will be replied to where possible and/or worthwhile.

    © HeavenGames. All Rights Reserved. Please read our Disclaimer & Privacy Statement. © Microsoft Age of Empires.