The Guide to the BMDB (battle_models.modeldb) for absolute beginners and non-English speakers.
بسم الله الرحمن الرحيم
Hello, this is my third tutorial (read: guide), and in it, i'm going to be explain the contents of the troublesome battle_models.modeldb file, more commonly known as the BMDB. Hopefully it will be much easier for beginners to understand the file and it's uses once they have read through this simple guide.
First, I would like to give all credit to Ishan for his hard work explaining the file and it's contents in his Doctoring of Medieval 2 units tutorial. If you want a quick and thorough explanation of the BMDB, head over to his tutorial and read his guide. Actually, I want you to read his guide first before this. You might find your answer there first..
====REQUIREMENTS====
Didn't I tell you to read his guide to the BMDB first? Well, if you did or didn't, you only require one file:
I would like to recommend Notepad++ for scripting roles. Mainly because it has many good features over the regular Notepad, like row numbers on the side, better Ctrl+F, and most of all: TABS!
Extract the BMDB, and overwrite the default one in your mod folder. Now let's get started...
====THE GUIDE====
First of all, the BMDB is simply a database listing battle_models. And battle_models are the models for the soldiers that are used in battles.
As soon as you open up the file, you may notice that the first line looks rather different from everything else. Namely, this line:
Code:
22 serialization::archive 3 0 0 0 0 701 0 0
Doesn't make sense at all. Lucky for us, we don't have to tamper with it except for the number I have put in bold (and purple). You see, this number is the total number of battle_models entries in the BMDB. Meaning that there is 701 battle_models listed in the BMDB. Should you make a new battle_model, you add +1 to the total.. Thus making it 702. Always add +1 to the total when you make a new battle_model. That is all.
Next up, are the mounts.. The horses, camels, and elephants that the soldiers ride on. Yes, even mounts are included here. I will return the that (very) soon.
Let us move to a very basic unit. Let's use a 'peasants' entry. Like this:
Spoiler Alert, click show to read:
Code:
8 peasants
1 4
55 unit_models/_Units/EN_Peasant_Padded/peasants_lod0.mesh 121
55 unit_models/_Units/EN_Peasant_Padded/peasants_lod1.mesh 900
55 unit_models/_Units/EN_Peasant_Padded/peasants_lod2.mesh 2500
55 unit_models/_Units/EN_Peasant_Padded/peasants_lod3.mesh 6400
12
7 england
79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
49 unit_sprites/england_Dummy_EN_Spearmen_sprite.spr
6 france
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_france.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
48 unit_sprites/france_Dummy_EN_Spearmen_sprite.spr
3 hre
75 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_hre.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
45 unit_sprites/hre_Dummy_EN_Spearmen_sprite.spr
7 denmark
79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_denmark.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
49 unit_sprites/denmark_Dummy_EN_Spearmen_sprite.spr
5 spain
77 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_spain.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
47 unit_sprites/spain_Dummy_EN_Spearmen_sprite.spr
8 portugal
80 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_portugal.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
50 unit_sprites/portugal_Dummy_EN_Spearmen_sprite.spr
5 milan
77 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_milan.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
47 unit_sprites/milan_Dummy_EN_Spearmen_sprite.spr
6 venice
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_venice.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
48 unit_sprites/venice_Dummy_EN_Spearmen_sprite.spr
12 papal_states
84 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_papal_states.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
54 unit_sprites/papal_states_Dummy_EN_Spearmen_sprite.spr
5 slave
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
47 unit_sprites/slave_Dummy_EN_Spearmen_sprite.spr
7 normans
79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
49 unit_sprites/normans_Dummy_EN_Spearmen_sprite.spr
6 saxons
75 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_hre.texture
78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
48 unit_sprites/saxons_Dummy_EN_Spearmen_sprite.spr
12
7 england
68 unit_models/AttachmentSets/Final European Light_england_diff.texture
68 unit_models/AttachmentSets/Final European Light_england_norm.texture 0
6 france
67 unit_models/AttachmentSets/Final European Light_france_diff.texture
67 unit_models/AttachmentSets/Final European Light_france_norm.texture 0
3 hre
64 unit_models/AttachmentSets/Final European Light_hre_diff.texture
64 unit_models/AttachmentSets/Final European Light_hre_norm.texture 0
7 denmark
68 unit_models/AttachmentSets/Final European Light_denmark_diff.texture
68 unit_models/AttachmentSets/Final European Light_denmark_norm.texture 0
5 spain
66 unit_models/AttachmentSets/Final European Light_spain_diff.texture
66 unit_models/AttachmentSets/Final European Light_spain_norm.texture 0
8 portugal
69 unit_models/AttachmentSets/Final European Light_portugal_diff.texture
69 unit_models/AttachmentSets/Final European Light_portugal_norm.texture 0
5 milan
66 unit_models/AttachmentSets/Final European Light_milan_diff.texture
66 unit_models/AttachmentSets/Final European Light_milan_norm.texture 0
6 venice
67 unit_models/AttachmentSets/Final European Light_venice_diff.texture
67 unit_models/AttachmentSets/Final European Light_venice_norm.texture 0
12 papal_states
73 unit_models/AttachmentSets/Final European Light_papal_states_diff.texture
73 unit_models/AttachmentSets/Final European Light_papal_states_norm.texture 0
5 slave
66 unit_models/AttachmentSets/Final European Light_slave_diff.texture
66 unit_models/AttachmentSets/Final European Light_slave_norm.texture 0
7 normans
68 unit_models/AttachmentSets/Final European Light_normans_diff.texture
68 unit_models/AttachmentSets/Final European Light_normans_norm.texture 0
6 saxons
67 unit_models/AttachmentSets/Final European Light_saxons_diff.texture
67 unit_models/AttachmentSets/Final European Light_saxons_norm.texture 0
1
4 None
10 MTW2_Spear 0
1
18 MTW2_Spear_primary 0
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
A terrifying start, aye?
It's a little too big for such a simple unit, don't you think?
Don't worry, I will break it down into smaller pieces for easy explanation. If you haven't noticed yet, there are numbers on the left side of the names/words/directories.. Those are the numbers of letters in the words infront of them. Like "8 peasants", p-e-a-s-a-n-t-s = 8 letters. derp. But those numbers must be an exact count or there will be an unpleasant CTD.
So while we're still at it. That "peasants" is the entry title. That is the title that will be used by other files to display the model ingame.
You may have noticed also that I colored in some numbers blue. Those are special numbers, and we are going to talk about those numbers now.. Starting from the number 4 at the early lines of the entry.
The number of models (and their directories) is always referenced right after the entry name. And in vanilla files, it is almost always 4 models. Some models have only 3 or even less.. With some mods using only 1 model. It happens to be that peasants use 4 models. The numbers on the right of the model name/directory are the lod distances. They define what lod (level of detail) model will be used at the distance your camera is away from the individual soldier. For example, if the camera is about 2500 "blocks" away from a soldier, the soldier will use the _lod2 model. The _lod0 model is the most detailed and the most "beautiful" (and the most laggiest), the _lod3 model is the opposite. That is why it is used from afar. However, there is no restriction against you using the _lod0 model the entire time.
The lod distance numbers are not counted. But still: ALWAYS double check and count the number of letters to prevent a CTD.
On to the next blue number!
---Textures, normals, sprites and their respective directories---
Right after the models (and their directories) comes the number of factions that use the model, and each faction's textures, normals, and sprites. Please note that this is the model's FIGURE textures and normals, not the ATTACHMENTS (Sprites are not related, silly). As always, everything is counted. This section of a battle_model's entry is also good part to find out what factions are using the battle_model without having to open up the EDU and searching through the eras. This section is pretty straightforward.
And again: ALWAYS double check and count the number of letters to prevent a CTD.
Advance!
---Attachment's textures, normals and their respective directories---
Code:
12 7 england 68 unit_models/AttachmentSets/Final European Light_england_diff.texture 68 unit_models/AttachmentSets/Final European Light_england_norm.texture 0 6 france 67 unit_models/AttachmentSets/Final European Light_france_diff.texture 67 unit_models/AttachmentSets/Final European Light_france_norm.texture 0 3 hre 64 unit_models/AttachmentSets/Final European Light_hre_diff.texture 64 unit_models/AttachmentSets/Final European Light_hre_norm.texture 0 7 denmark 68 unit_models/AttachmentSets/Final European Light_denmark_diff.texture 68 unit_models/AttachmentSets/Final European Light_denmark_norm.texture 0 5 spain 66 unit_models/AttachmentSets/Final European Light_spain_diff.texture 66 unit_models/AttachmentSets/Final European Light_spain_norm.texture 0 8 portugal 69 unit_models/AttachmentSets/Final European Light_portugal_diff.texture 69 unit_models/AttachmentSets/Final European Light_portugal_norm.texture 0 5 milan 66 unit_models/AttachmentSets/Final European Light_milan_diff.texture 66 unit_models/AttachmentSets/Final European Light_milan_norm.texture 0 6 venice 67 unit_models/AttachmentSets/Final European Light_venice_diff.texture 67 unit_models/AttachmentSets/Final European Light_venice_norm.texture 0 12 papal_states 73 unit_models/AttachmentSets/Final European Light_papal_states_diff.texture 73 unit_models/AttachmentSets/Final European Light_papal_states_norm.texture 0 5 slave 66 unit_models/AttachmentSets/Final European Light_slave_diff.texture 66 unit_models/AttachmentSets/Final European Light_slave_norm.texture 0 7 normans 68 unit_models/AttachmentSets/Final European Light_normans_diff.texture 68 unit_models/AttachmentSets/Final European Light_normans_norm.texture 0 6 saxons 67 unit_models/AttachmentSets/Final European Light_saxons_diff.texture 67 unit_models/AttachmentSets/Final European Light_saxons_norm.texture 0
Right after the textures, normals, and sprites (and their directories) comes the number of factions (again) that use the model's ATTACHMENT textures and normals. Unlike earlier, which deals with the model's FIGURE textures, normals, and sprites. Still, it's simple to understand. If you don't know what are these for, the Attachments are the weapons.
Everything is counted here except for the zero that comes after the attachment's normals directory.
*sigh* Again: ALWAYS double check and count the number of letters to prevent a CTD. I cannot emphasize this enough, people still make mistakes related to counting.
Aw man! The final part!
---Mount; primary and secondary/off-hand; weapon animations, and "positioning"(?)---
To be honest with you, this is the most difficult part in the BMDB (atleast for me). This section deals with the animations, which if messed up, makes a big booboo.
Lucky for us, peasants have simple animations. Let me run through this area quickly: 1 = Animation section header. It is always a 1 for normal units. (It is a 4 for generals and captains). 4 None = Mount definer. It is 4 for None (aka. No mount) *phew* I haven't studied mounts thoroughly yet, so pardon me. 10 MTW2_Spear = This defines the animation set. The animations are found in the animations folder (If you downloaded Caliban's pack), and a list of them is found in descr_skeleton. (I will make a tutorial about this soon). This part is the most fun too. 1 = Since this unit has only 1 main weapon, this space is just left as a '1'. It will be an animation set name when a secondary weapon is used (we'll return to this later). But I haven't studied if there is a shield, sorry for that. 18 MTW2_Spear_primary 0 = The weapon animations. This part is the most fuzzy for me. If there is more than 1 weapon, and on a horse, and has a shield, then something complex should be here. But just totally ignore all that. Just don't give a damn about this and leave it alone. (The zero isn't counted) 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002 = This is the positioning I think. Don't change this, just leave this alone. If you are wondering how is the 16 counted, then I will highlight the counted values for you: -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
Then again, just don't touch this part. Just leave it alone.
WELL! That just sums up about all you need to know about the average battle_model entry. Let's have a look at how it is like with all the colors:
Spoiler Alert, click show to read:
Code:
8 peasants1 4 55 unit_models/_Units/EN_Peasant_Padded/peasants_lod0.mesh 121 55 unit_models/_Units/EN_Peasant_Padded/peasants_lod1.mesh 900 55 unit_models/_Units/EN_Peasant_Padded/peasants_lod2.mesh 2500 55 unit_models/_Units/EN_Peasant_Padded/peasants_lod3.mesh 640012 7 england 79unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 49 unit_sprites/england_Dummy_EN_Spearmen_sprite.spr 6 france 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_france.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 48 unit_sprites/france_Dummy_EN_Spearmen_sprite.spr 3 hre 75 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_hre.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 45 unit_sprites/hre_Dummy_EN_Spearmen_sprite.spr7 denmark 79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_denmark.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 49 unit_sprites/denmark_Dummy_EN_Spearmen_sprite.spr 5 spain 77 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_spain.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 47 unit_sprites/spain_Dummy_EN_Spearmen_sprite.spr 8 portugal 80 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_portugal.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 50 unit_sprites/portugal_Dummy_EN_Spearmen_sprite.spr 5 milan 77 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_milan.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 47 unit_sprites/milan_Dummy_EN_Spearmen_sprite.spr 6 venice 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_venice.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 48 unit_sprites/venice_Dummy_EN_Spearmen_sprite.spr 12 papal_states 84 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_papal_states.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 54 unit_sprites/papal_states_Dummy_EN_Spearmen_sprite.spr 5 slave 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 47 unit_sprites/slave_Dummy_EN_Spearmen_sprite.spr 7 normans 79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 49 unit_sprites/normans_Dummy_EN_Spearmen_sprite.spr 6 saxons 75 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_hre.texture 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture 48 unit_sprites/saxons_Dummy_EN_Spearmen_sprite.spr12 7 england 68 unit_models/AttachmentSets/Final European Light_england_diff.texture 68 unit_models/AttachmentSets/Final European Light_england_norm.texture 0 6 france 67 unit_models/AttachmentSets/Final European Light_france_diff.texture 67 unit_models/AttachmentSets/Final European Light_france_norm.texture 0 3 hre 64 unit_models/AttachmentSets/Final European Light_hre_diff.texture 64 unit_models/AttachmentSets/Final European Light_hre_norm.texture 0 7 denmark 68 unit_models/AttachmentSets/Final European Light_denmark_diff.texture 68 unit_models/AttachmentSets/Final European Light_denmark_norm.texture 0 5 spain 66 unit_models/AttachmentSets/Final European Light_spain_diff.texture 66 unit_models/AttachmentSets/Final European Light_spain_norm.texture 0 8 portugal 69 unit_models/AttachmentSets/Final European Light_portugal_diff.texture 69 unit_models/AttachmentSets/Final European Light_portugal_norm.texture 0 5 milan 66 unit_models/AttachmentSets/Final European Light_milan_diff.texture 66 unit_models/AttachmentSets/Final European Light_milan_norm.texture 0 6 venice 67 unit_models/AttachmentSets/Final European Light_venice_diff.texture 67 unit_models/AttachmentSets/Final European Light_venice_norm.texture 0 12 papal_states 73 unit_models/AttachmentSets/Final European Light_papal_states_diff.texture 73 unit_models/AttachmentSets/Final European Light_papal_states_norm.texture 0 5 slave 66 unit_models/AttachmentSets/Final European Light_slave_diff.texture 66 unit_models/AttachmentSets/Final European Light_slave_norm.texture 0 7 normans 68 unit_models/AttachmentSets/Final European Light_normans_diff.texture 68 unit_models/AttachmentSets/Final European Light_normans_norm.texture 0 6 saxons 67 unit_models/AttachmentSets/Final European Light_saxons_diff.texture 67 unit_models/AttachmentSets/Final European Light_saxons_norm.texture 0 1 4 None 10 MTW2_Spear 0 1 18 MTW2_Spear_primary 0 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
Letter numbers
Battle_model entry title
Number of directory entries
Models (and their directories)
Level of detail distances
User Factions' names
FIGURE texture directory
FIGURE normals directory
Sprite directory
ATTACHMENT texture directory
ATTACHMENT normals directory
Mount type
Animation set name
Weapon Animation set name
Positioning
This applies to every regular infantry unit.
End of guide. Thank you for reading this, I hope you found it very helpful.
Last edited by BM309K58SMERCH; December 27, 2012 at 08:08 AM.
Re: The Guide to the BMDB (battle_models.modeldb) for absolute beginners and non-English speakers.
Hi, about this string
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
Is the information of torch used by soldier. The 16 is the 16th bones, if you open a cas animation you can noticed that match with bone_lhand.
The others numbers can be offset position, quaternion rotation or bounding sphere... I never test them
Re: The Guide to the BMDB (battle_models.modeldb) for absolute beginners and non-English speakers.
For the OP thanks very much - very clear.
Johnwhile - thanks , but you mention too many things that most people new to modding will not know anything about - to be honest i don't understand a word of what you wrote there. Would it be safe just to copy and paste those numbers from a similar unit when making new units for people who don't understand them?
Re: The Guide to the BMDB (battle_models.modeldb) for absolute beginners and non-English speakers.
Originally Posted by Dunadd
For the OP thanks very much - very clear.
Johnwhile - thanks , but you mention too many things that most people new to modding will not know anything about - to be honest i don't understand a word of what you wrote there. Would it be safe just to copy and paste those numbers from a similar unit when making new units for people who don't understand them?
As far as I know, these numbers are same for all infantry units. You can simply copy the string from any infantry unit. General advice is to find a similar unit and copy its entire MDB entry. Then you change the names, model and texture file locations, factions, animations (if needed). Also make sure you increase the model counter on top of the file by 1 (i.e. something like 0 0 0 0 702 0 -> 0 0 0 0 703 0).
Originally Posted by Dunadd
Do you need to also edit the mdb.txt file with the same changes at the same place in the file?
Re: The Guide to the BMDB (battle_models.modeldb) for absolute beginners and non-English speakers.
thanjs - i found out the mdb.txt in some mods is one created when you run the bmdb checker (which not all mods have) and is meant to be a corrected version of the text for the battlemodeldb file which you can copy and paste into it to replace the original text (though best making a backup of the original first in case the checker got something wrong)