1. Tutorial - Adding new buildings to the game

Title: Krn3ll Guide to add brand new buildings to RTW 1.5
Posted by: Seth Krn3ll
Modding area: Buildings (strategic - battle map)
Required software: Notepad (or other text editor), 3dmax, graphic editor like photoshop or GIMP
Summary: This tutorial explains how to add totally new buildings to the gameplay, both in strategic and battle map modes.

PREMISE:
Just to be clear: I will NOT explain HOW to model buildings here, just how to add them to the gameplay. Specifically, I will explain step to step how to:
Add new buildings in the building tree of the game
Add their 3d models to the building DB so that they will appear in game

Before starting, keep in mind there are different type of buildings you can add to the game.

Ambient Buildings are the simpler ones. They need much less steps then the others. They can’t have recruiting capabilities, they can’t have bonus capabilities, they do not affect campaign game and in battles they are merely obstacles for troops or scenario decorations. I will not discuss them in this tutorial.

Special buildings are walls and towers and they are somehow more complicated to manage due to their multiple features. I will not discuss them in this tutorial.

Game Buildings are the ones buildable by the players during the game in the settlements. They affect both campaign and battle game, and they are the ones I will discuss in this tutorial.

PREPARATION:
First thing, BACKUP all the files involved. I suggest to backup a copy of the folders, so to be sure you can get back to start if things goes wrong.

Here is the list of files involved in the process:

Data\export_descr_buildings.txt
This file lists all the buildings that can be built during the game, specifying which cultures can build them, the costs and times, features, bonuses and recruitments capabilities.

Data\text\export_buildings.txt
here all buildings are given a text description which will appears in game.

Data\text\building_battle.txt
here all buildings are given a text description which will NOT appears in game. Its needed to the game.

Data\settlement_plans\descr_settlement_plan.txt
Here are listed the primary buildings, and you’ll have to add your new ones there. Are also set the city plans, and all the slots that can be called from the single settlement plan files.

Data\settlement_plans\[culturetype_settlementtype].txt
where " settlementtype " stands for each type of settlement in the game, forts and camps included. There you define all building models to be shown in each kind of settlement. You can specify coords and type for all kinda objects, including walls. It can list only models already listed in descr_settlement_plan, so if you want to customize settlements a lot you will have to work on descr_settlement_plan too.

Data\descr_items.txt
This file enlist all buildings the game will manage. You need to add here all the new buildings you want to appear in the game. You can also include subfiles there, to keep them separated for culture, for example.

Data\descr_items.db
This file is generated by the game when you start it. If there is already a descr_items.db the game will not generate a new one.

Data\descr_settlement_plan
this one defines the single elements to be used in every city shown ingame. There are set association with every culture settlement single plans, groups of various building models to be shown in settlements and culture variations.

Data\descr_building_battle\dbb.*.txt
Those files enlist all 3d building models to the game. Here are specified the health stats, the different cas models to refer to and some other things.

PROCESS

a) ADDING A NEW BUILDING TO THE GAME
Lets say you want to add a new building named “MONOLITH”, buildable by Romans and Britons, with two levels named monolith1 and monolith2, which gives a some happiness to settlement population.

1. Open export_descr-building.txt, scroll to the end of it and add the new building tree. It will look like that:

Code:
building monolith
{
levels monolith1 monolith2
{
monolith1 requires factions { romans, britons }
{
capability
{
happiness_bonus bonus 1
}
construction 1
cost 400
settlement_min town
{
monolith2
}
}
monolith2 requires factions { romans, britons }
{
capability
{
happiness_bonus bonus 2
}
construction 3
cost 800
settlement_min large_town
{
}
}
}
plugins
{
}
}
2. Open export_buildings.txt and add the description lines for the levels of your new building:
Code:
{monolith1} The wonderful lunar Monolith!
{monolith1_desc} The lunar Monolith helps people read at night, so they love it. People is very happy to have it in the settlement.
{monolith1 _desc_short} The lunar Monolith makes people happy.
{monolith2} The Unbearable solar Monolith!
{monolith2_desc} The solar Monolith gives all people a nice tan and makes all them say “Wohooo!”. People is very happy to have it in the settlement and they will love you for building it.
{monolith2 _desc_short} The solar Monolith makes people happy.
Add also a line to the name string at the end of the file:
Code:
{monolith_name} Wonderful Big Stones – Makes people happy
3. Add some nice pictures to be seen in your building queue ingame.
To do so you need to be able to use a graphic editor, like GIMP or Photoshop or something else. Find a nice picture you like and save it as your Building Card Picture with the name
#roman_monolith1_constructed.tga
In
data\ui\roman\buildings
Then resize to 78x62 pixels. If you are good with graphics add the alpha channel, if you dunno what is it, just forget it. Save that picture as
#roman_monolith1.tga
in
data\ui\roman\buildings
then make a copy, resize it to 64x51 pixels and save it with the same name in data\ui\roman\buildings\construction

Do the same in barbarian building folders (as Britons are barbarian) and of course, name them
#barbarian_etc etc

At this point you can start the game and if you play as romans or as Britons you’ll find your new building available to be built in your settlements. You can play and benefit all the features of the monolith, but if you enter the settlement in tactical view, you will not see anything like a monolith. To have the monolith around in your battles, you’ll need to create and then add the 3d model to the models db, and that’s what I’m gonna explain now.

b) ADDING THE 3D MODEL OF THE NEW BUILDING
If adding a new building to the game was pretty easy, adding a 3d model is all BUT easy. There are two ways I know to go for it, one is complicated, the other is utterly complicated.

b.1) – Using existing models
The complicated way is to use an existing building of the game, which means you will somehow rename an existing building. To do so first thing you have to pick the existing building you want to be your monolith. Lets say you chose the barbarian bardic circle.

1. Open descr_settlement_plan.txt and first of all add monolith1 and monolith2 to the primary building list.
Then chose a slot to settle your new building. Slots are prefixed areas in the settlement plans where specific buildings may be built. Given you want the monolith to be buildable in roman and (barbarian) britons settlements, you must pick a slot that is present in both those culture settlements files. You also have to pick slots with adequate dimensions, which means you have to open in 3dmax the bardic_circle and see the dimensions it occupies, or at least check it in descr_settlement_plan.txt. Remember that if you use a slot for that building, you will not be able to build another building in that slot – so if you decide to use lets say the slot_160x128_missiles slot, then you will not be able to build the missile building if you build your monolith.

Best way is to create a brand new slot for your new building, something like a slot_monolith with the right dimensions. But you’ll have then to find the correct coordinates in romans and barbarian settlements to set your new slot. If you put it on a road, soldiers will run against it and get stuck there.
So if you go to create your own slot, then you’ll have to add it to all the settlement files you want the monolith to be buildable in.

2. Once found the right slot for your monolith, add a variant line to it. It will look like that:
Code:

variant
{
cultures
{
roman
barbarian
}
buildings
{
Monolith monolith1
}
bardic_circle_barbarian, 		0, 	0, 	0, 	0
}
variant
{
cultures
{
roman
barbarian
}
buildings
{
monolith monolith2
}
bardic_circle_barbarian, 		0, 	0, 	0, 	0
}
Consider that this way the 3d models shown ingame will be the bardic circle for both levels of your monolith, and for both romans and Britons. Of course you can use different models for cultures and levels if you want, but pay attention to dimensions of the models: if you use a model bigger then the slot you put it in, it may collide with other buildings or block roads.

In descr_settlement_plan.txt file you can also set the models for the building time of your monolith, or what to show if its not at all built. Here I try to stay at the basics.

3. Once you added your monolith to a slot and the slot is available in the settlement plans, you have to declare it in data/text/ building_battle.txt
Easy step here: just add a line like:
Code:
{monolith1} My Monolith
{monolith2} Again my Monolith
Those lines never appears in game, ir at least I never saw them. But they are needed to have the building working.

4. Now you have to include your new building to the models db of the game. To do so, first thing open
descr_building_battle.txt
and add the monolith entry like that:

Code:
monolith1
{
stat_cat large_stone
localised_name monolith1
level
{
min_health 1
battle_stats
item bardic_circle_barbarian
physical_info	bardic_circle_barbarian_info.CAS
}
transition default_large_stone
level
{
min_health 0
battle_stats
item		roman_rubble_112x64
physical_info	info_roman_rubble_112x64.cas
}
}

monolith2
{
stat_cat large_stone
localised_name monolith2
level
{
min_health 1
battle_stats
item bardic_circle_barbarian
physical_info	bardic_circle_barbarian_info.CAS
}
transition default_large_stone
level
{
min_health 0
battle_stats
item		roman_rubble_112x64
physical_info	info_roman_rubble_112x64.cas
}
}
At this point, given you used an existing model, there is nothing else you have to do with files. But you have to delete the existing descr_items.db (which you have already backupped, haven’t you?) and then run the game.
You’ll have some errors, just ctrl-atl-canc and stop the program. If you have made no mistakes, the program creates the new descr_items.db including your monolith.
Restart the game, and this time there should be no errors. If you play as romans or Britons you’ll be able not just to build the monolith but also to go and see it in your cities in tactical view. O well, you’ll see the bardic_circle, of course, but the cursor will say “Monolith” and you will be happy like the people in your settlement are.

Ok this was the complicated way, which is not that much because, as I just outlined, you’ll see the same old models in your game. So lets go to see how to add a completely new model to your new building. And, well, it will be not that easy.

b.2) – Using brand new models

1. To add a brand new model for your monolith, first thing you have to do is to create that model. You can do so by importing an original item form the game that have similar dimensions to the one you want to create and this also keep its own collision INFO file – or go on and create your new model with its own INFO file.

If you keep and existent INFO file as reference for your new building, just import in 3dsMax the vanilla model and then start to create your own building keeping it within the dimensions of the original item. Once you created your new model, remove the original item and all its textures, add your own textures and finally export it as
monolith1_high.cas
Put it in
Data\MODELS_BUILDING
Data\MODELS_BUILDING\TEXTURES

If you want to make a new building with its own INFO file, after you create the .cas for your new building you have to create the INFO file for it.
To know how to do so, lets first explain what are INFO files and how they work. INFO files tell the game some functionalities of the model they refer to. Including their walkable/non walkable areas, if and where the camera will go around them or get through them, and some more complicated features like tunnels, platforms, siege points and the like.
Here I will explain just the two basic ones needed to create functional INFO files for simple buildings, which are “collision” and “collision_3d” issues.
- Collisions are simple squares, made on ONE SINGLE element (even better one single polygon) with no holes inside. They define the areas where troops or peasants will NOT be able to walk. If the building is just a cube, the basic collision file is a square a little bigger then the cube base. The units will walk into it and stop. If you don’t put working collision files in the INFO file, units will walk up on your buildings. If you need to add more then one collision area, you have to name them “collision_01”, “collision_02”, etc.
- collision_3d is the general shape of your building in 3d. It mainly have two functions: telling the game that the camera will have to go around the building and not through it and blocking projectiles. Given so, it may be used to create fake roofs to some areas where the camera will be able to pass into, or invisible fences to protect troops from arrow attacks. Staying at the basics, the collision_3d is just a shape of the same size of your building, and that’s all. A good modeler will usually simplify it a lot, to make easier the job of the game engine.
If you’re lazy, you can do it in the easy way by just keeping the model as it is, collapsing all its part in one object and naming it “collision_3d” then exporting it as
monolith1_INFO.cas
and
monolith2_INFO.cas
Put it in
Data\MODELS_BUILDING\INFO
Given the game engine will have to deal with all the polys of all the objects around, its strongly advised you simplify the object in the INFO file.

I strongly suggest you to create your own slot for your own building.

4. Once found the right slot for your monolith, add a variant line to it. It will look like that:
Code:
	variant
{
cultures
{
roman
barbarian
}
buildings
{
monolith monolith1
}
monolith1, 		0, 	0, 	0, 	0
}
variant
{
cultures
{
roman
barbarian
}
buildings
{
monolith monolith2
}
monolith2, 		0, 	0, 	0, 	0
}
5. Follow step 3. of complicated way:
Code:
 data/text/ building_battle.txt
{monolith1} My Monolith
{monolith2} Again my Monolith
descr_building_battle.txt
but no need to use the item “bardic_circle_barbarian” because you’re gonna use your brand new item “monolith1” and “monolith2”.
Here it is:

Code:
monolith1
{
stat_cat large_stone
localised_name monolith1
level
{
min_health 1
battle_stats
item monolith1
physical_info	monolith1_INFO.cas
}
transition default_large_stone
level
{
min_health 0
battle_stats
item		roman_rubble_112x64
physical_info	info_roman_rubble_112x64.cas
}
}

monolith2
{
stat_cat large_stone
localised_name monolith2
level
{
min_health 1
battle_stats
item monolith2
physical_info	monolith2_INFO.cas
}
transition default_large_stone
level
{
min_health 0
battle_stats
item		roman_rubble_112x64
physical_info	info_roman_rubble_112x64.cas
}
}
Note that you keep using roman_rubble_112x64 as default transition item. If you are good, you’ll probably create some more ambient objects to fit the building stage / destroyed stage of your own building. Either, try to use some default item which have similar dimensions.

7. Now you need to have the game creating the monolith items. To do so, you’ll need one more step then the complicated way. Open data\descr_items.txt and add your monolith entry as:
Code:
type		monolith1
lod
max_distance	4000.0
model_rigid	monolith1_high.cas

type		monolith2
lod
max_distance	4000.0
model_rigid	monolith2_high.cas
This is the simplified version. You should actually have two or three cas files, high, med and low, to be used at different distances. That means you have to create three or more .cas files for each new building you create.
But well, for now lets work with just the high one.

8. Now again you have to get rid of the descr_items.db (backup, backup!) and start the game. Game shows errors, ctrl-alt-canc, kill it, restart it. You should have your buildings in the game.

Now, there are about 1 million chances you’ll get errors. Trying to write a troubleshooting on this process is simply ridiculous, but let me share a few recurring problems:

a) Game just does not load, no error messages – something is wrong in descr_settlement_plan.txt usually a not closed bracket or something similar.
Game loads, you enter the campaign, no traces of your buildings in game – something wrong written in descr_items.txt or in descr_building_battle.txt
Check if the game created the monolith1 and 2 items in data\items\ folder.
c) All works, but your buildings are missing sides or show weird colors – 50% chances that the exporting procedure did not worked very well. It happens, export them again – no need to rebuild the db. The other 50% chances are – let me be rude – that you are a poor modeler.

***

Have fun.
Seth Krn3ll

2. Re: Tutorial - Adding new buildings to the game

Excellent work so glad you did it
Ties a lot of loose ends together and explains things very well, I'll add it to the database whilst I remember.

One bit it might be worth pointing out as Wundai discovered recently
descr_items.txt is very sensitive to formatting errors (like extra line space) and problems in that will result in error less CTD with no new db file generated.

Other query when you added your items to descr_items.txt did you do it on vanilla one which seems to refer to some sub di_... files that aren't present - or did you add them to Alpaca's extracted version - if it needs the extracted version it would be worth having a link to the above thread.

3. Re: Tutorial - Adding new buildings to the game

Very nice, indeed, lots of useful stuff gathered in one document. Thanks, will be useful!

4. AW: Tutorial - Adding new buildings to the game

Originally Posted by Seth Krn3ll
2. Open export_buildings.txt and add the description lines for the levels of your new building:
Code:
{monolith1} The wonderful lunar Monolith!
{monolith1_desc} The lunar Monolith helps people read at night, so they love it. People is very happy to have it in the settlement.
{monolith1_short_desc} The lunar Monolith makes people happy.
It is:

{monolith1_desc_short}

5. Re: Tutorial - Adding new buildings to the game

wow, thanks so much.

6. Re: Tutorial - Adding new buildings to the game

Hi, I hope there are still some modders here who might help me. I have done everything what you did, but I have some errors.

First of all, I work in a modfolder. I have done every step, I have included anything etc.
I copied the descr_items.txt from the vanilla game, and added my include.
But there is one error when I start the game for making the descr_items.db :

When I wanted to solve it, I missed the di_*_.txt files from the vanilla descr_items folder. So the game can't find this includes.

[PROBLEM 2]
I searched in my lotrtw folder, and unpacked the descr_items.txt. That file seems to be full of all buildings. I pasted it in my modfolder, included my own buildings, and started the game. It creates the descr_items.db now, but when I try to view the settlements, I got tons of error. Only my own buildings are shown now, but all vanilla buildings are missing.

The game gives the error that it can't find the .cas building model. Yes i don't have those building models in my modfolder, but the game needs to load it from the vanilla data folder...

I am very confused now :(

Note: There seems to be a DB editor from vercingetorix. But I can't find that tool anymore because the download links are down. Can someone send me the tool please?

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Single Sign On provided by vBSSO