Adding User Interface For New Civilizations

Article written by TriRem
Published on 12-23-2016; updated on 03-20-2017
Tags: , , ,

If like me you have always wanted to add THAT civilization you felt was missing from the game, you may have tried to do so thaks to the UserPatch following this guide, but you will then realize that when trying ingame, the civilization lacks the User Interface. In this article we will look at how to add new UI.

Preparation

You must have the UserPatch installed for this to work, and have followed LmScar13’s guide on how to add new civilizations.

This guide explains how to add UI to new civs for The Conquerors, but adding to mods such as Forgotten Empires follows the exact same process.

Adding new civilization to the HD edition is NOT possible at the moment this article is written.

Section 1 — Where to store UI

User Interfaces are stored in the interfac.drs in the DATA folder. There are three UI for each civ, small, medium and large. They are stored at very specific IDs in the .drs file :

-Interface 800×600 : 51100 + ID + civ ID
-Interface 1024×768 : 51100 + 20 + civ ID
-Interface 1280×1024: 51100 + 40 + civ ID

Section 2 — Adding UI

In the XML file you edited to add your new civilization, the first lines are these :


<?xml version="1.0" encoding="utf-8"?>
<configuration game="age2_x1">
	<name>Age of Empires II: The Conquerors Expansion 2</name>
	<path>The Conquerors</path>
	<civilizations langId="10230" descId="20150" aiNameOffset="140" uiBaseId="51100" uiStride="20" uiOffset="2">

uiBaseId

specifies the first civilization UI slp in

interfac.drs

.

uiStride

specifies the total number of civ UIs. This can be greater than the number of civilization.

uiOffset

specifies the gap between the last UI of one resolution and the first UI of the next largest resolution.

Set

uiOffset

to 0, there is no use of having a gap between IDs as we will use these IDs.

To add a new UI for a new civ we just extract the 3 UI of an existing civ from the interfac.drs using Turtle Pack, and add them to the gamedata_x1_p1.drs. Then we rename them accordingly to the civ ID we want to link them to.

As an example the IDs for the 19th civ would be 51119, 51139 and 51159.

The civ ID is the ID we find in the age2_x1.xml or in AGE.

But what if we have more than 20 civilizations ? We wouldn’t have enough space to store the UI since some ID would overlap. Fortunately the UserPatch provides us with a solution allowing to expand well beyond 20 civilization.

Section 3 — Expanding the number of civilization

Onto the problem, we have to increase the

uiStride

number to a greater one, let’s say 30.

This way the interfaces ID will work this way :

-Interface 800×600 : 51100 + ID + civ ID
-Interface 1024×768 : 51100 + 30 + civ ID
-Interface 1280×1024: 51100 + 60 + civ ID

Very important : By doing so we have to adjust the existing UI to match the new ID the executable read them. The Interface 1024×768 will have to be moved 10 ID up, and the Interface 1280×1024 20 ID up to make up for that change.

The IDs for the 19th civ would then be 51119, 51149 and 51179.

Once this is done, we now have 30 UI slots, that’s enough for 12 new civilizations over The Conquerors, and we can always extend it if we need more.


Do you want to comment on this article? Thank the author? Tribute resources for its improvement? Raze it to the ground?

Come by and visit its thread in the University Forum!