Modding a unit in Rise of Nations looks more difficult than it really seems. To be honest, the only issue involved may be in creating the renders and the tedium in the coding required, but overall it is actually a very fast process, and sometimes rewarding as well.
This guide tries to go step by step in designing a model from scratch, from the creating of the graphics required for a new unit all the way to getting it to work in the game. We will first explain how graphics are created, and then go on to inserting the model into the game itself.
To work with RoN, the following are required:
- 3ds Max 5.1, with Character Studio 3.4, and the Big Huge Exporter plugin (plugin only works for Win XP, 3ds Max 5.1 works with Windows XP and Windows 7 only - issues with certificate access have been found with Windows 10) OR
- Blender (preferred version: latest) with Ryder25's BH3/BHA exporter plugin.
Unless mentioned, this tutorial will assume that the reader has chosen to install 3ds Max 5.1, for reasons that will be made clear below.
HOW DO GRAPHICS IN RISE OF NATIONS WORK?
In Rise of Nations, units consist of two elements — the graphic files which allow a unit to appear and be animated in the game world, as well as coding which allows the unit to perform its functions in the game.
WHAT FILES GOVERN A UNIT'S APPEARANCE?
This is determined by the following:
- a .bh3 model. This is the model for the sprite as it appears in your game, and will be stored in your /art folder;
- .bha files, which governs unit animation, ie how the unit moves and so forth, which goes into the /art folder too;
- a .tga file, which if not properly inserted causes the unit to appear white. This also goes into the same folder as above; and
- entries in the unit_graphics.xml file under your/data folder.
BUT HOW ON EARTH DO I GET IT TO WORK?
There are several files which govern how a unit functions:
- unitrules.xml, under your /data folder, will govern a unit's attributes, ie attack, movement speed, hitpoints, as well as graphics; and
- craftrules.xml and balance.xml will govern the abilities of your unit.
-anim_graphics.xml governs animations. Custom animations must be recorded here otherwise they won't work.
- unit_graphics.xml determines the appearance and movements of the unit, and
- typenames.xml and help.xml govern infobox data and the unit's name as it should appear in-game.
Of these, however, we must pay utmost attention when modifying any .xml files in Rise of Nations - faulty coding at the least will leave units inoperable, and at worst crash your entire game. For this reason we strongly discourage overwriting any source files in ./data or ./art unless it is necessary, and to use FirstObject XML Editor to edit any .xml files.
HOW MANY CUSTOM UNITS CAN I INSERT INTO RISE OF NATIONS?
Sadly, the answer is none, because in reality the number of units is determined by the number of entries for each unit in Rise of Nations in the unitrules.xml file (for convenience, we will call each area where you can insert data for a new unit as a "slot"). Each slot is demarcated by the tagging <UNIT>...</UNIT> with the statistics of the unit (ie name, type, tactical parameters, etc) located within this tag. You can only create new units by "cannibalising" existing slots. In theory, there are roughly about 150 available unit slots to cannibalse.
ENOUGH BABBLING! JUST SHOW ME HOW TO DO IT!
Let's use an example from Age of Darkness.
Suppose that I want to insert a new unit that I want to call "Panzerfaust", a custom infantryman which can fire rockets and is represented by two different sprites. How do I go about this? the answer is simple:
The first thing I do is to get out the graphics for two different sprites. Generally, in Rise of Nations a unit by default needs at least 1 .tga file, and 1 .bh3 file (the model itself) as well as accompanying .bha files that govern the animation. For the purposes of this tutorial, we will have 1 .bh3 file, pfaust.bh3 and 2 .tga files, d_m44.tga and d_m45.tga.
The .bh3 and .bha files for Rise of Nations can only be created if you have 3ds Max 5.1 and the Big Huge Exporter plugin produced by BHG. We will not cover this, there are many tutorials elsewhere on how to create your own 3d models using this program.
Meanwhile, on to sprites. You must be asking, why do we need to create two sets of .tga files if we are just creating only one unit? this is because although I am only creating one unit, I want this unit to have a varied appearance, hence the need for two .bh3 files - one for each sprite. The bh3 files however are not enough on their own, so I must also have .tga files which form the "skin" of the unit.
In this screenshot, you can see what the .tga files look like when opened up in GIMP2.8.1 Remember that to create unit colour areas, you need to render parts of the model semi-transparent.
Rise of Nations when in operation "wraps" the texture of the tga around the model as determined by the bh3 file. If we opened up the unit model file in 3ds Max and then used, say, d_m44.tga file as its skin, this is what it would look like:
With these files ready, I will now put the .bh3 files into the ./art folder of my project directory, ./mods/Age of Darkness/art/Inf folder.
As you can see, I now have several files in my folder in addition to pfaust.bh3, and d_m44.tga and d_m45.tga. These are:
- RPG-default.bha, RPG-idle.bha, RPG-idle2.bha and RPG-idle3.bha - governs unit animations when the unit is not doing anything, ie idle.
- RPG-walk.bha, and RPG-run.bha - governs how the unit moves, ie walks. RPG-walk.bha is for when the unit moves slowly, and RPG-run.bha is for when the unit moves quickly, ie under the influence of a General's Forced March ability, or the Bantu civilisation's movement bonus.
- RPG-fire.bha and RPG-fire - Copy.bha - governs unit attack animations, and
- VC die1.bha and VC die2.bha - governs unit animations when it dies.
I also have inserted another folder into my directory, ./mods/Age of Darkness/art/Skeletons which allows the use of custom skeletons — the bones that appear whenever a unit dies. Into this folder, I have also inserted another file, skelett.bh3 which will serve as the skeleton of this unit once it dies and decays.
The anim_graphics file
The unit_graphics file