

AGE OF EMPIRES CAMPAIGN FILES FORMAT DESCRIPTION

Written by Stoyan Ratchev, sratchev@mail.techno-link.com
Posted to AoE Heaven, http://age.gamestats.com/age/

Age of Empires a game by Microsoft & Ensemble Studios.
All trademarks are property of their respective owners.

************************************************************************

Upon posting the CPNBUILD utility I received several letters
asking me about the .CPN files format. I don't consider
this format to be any secret, in fact it's very simple.
I discovered it myself and I have not consulted anybody 
about it, so I can't be completely sure that I have not 
overlooked something. Still my CPNBUILD utility uses this 
format specification and works OK, so I believe the format 
is also OK.

Please note that this description comes with ABSOLUTELY NO
WARRANTY of any kind, so use it at your own risk. 

Microsoft (MS) and Age of Empires (AoE) are trademarks of 
Microsoft Corporation. All other trademarks are property of 
their respective owners.


The campaign (.CPN) files are basically nothing but compiled 
scenario (.SCN) files. Each campaign can contain one or more 
scenarios. The format of the campaign files consists of:

1. Header - contains the version, the campaign name and the
number of scenarios included in the campaign.

2. Scenario descriptions - for each scenario file there is a 
description which contains: the size of the scenario file, 
the offset of the file in the campaign file, the name of the 
scenario and the filename (path) of the scenario file.

3. Scenario files - the exact binary contents of all scenario 
files. The version of the scenario is in the first 4 bytes
of the scenario file.

In the table below are given the offsets and lengths of all 
fields. N is the number of scenarios, S1 and O1 are the size
and offset of the first scenario, Sn and On are the size and
offset of the N-th scenario.


-----------------------------------------------------------------------
Offset          Length  Description             Contents/Type
-----------------------------------------------------------------------
0               4       Campaign version        1.00    |
4               256     Campaign name           text    | Header
260             4       Number of scenarios     (N)     |
-----------------------------------------------------------------------
264             4       Scenario #1 size        (S1)    |
268             4       Scenario #1 offset      (O1)    |
272             255 	Scenario #1 name        text    |
527             257     Scenario #1 filename	filename|
...                                                     | Scenario 
264+(N-1)*520	4       Scenario #N size        (Sn)    | descriptions
268+(N-1)*520	4       Scenario #N offset      (On)    | 
272+(N-1)*520	255     Scenario #N name        text    |
527+(N-1)*520	257     Scenario #N filename    filename|
------------------------------------------------------------------------
(O1)            (S1)    Scenario #1 file        binary  |
...                                                     | Scenario
(On)            (Sn)    Scenario #N file        binary  | files
------------------------------------------------------------------------


That's it. You can use this format specification to edit
campaign files in a hex-editor or make your own campaign
builder utility. 

************************************************************************
Copyright (C) 1997 Stoyan Ratchev. All rights reserved.
Last updated on 12 Nov 1997.


