Results 1 to 20 of 21

Thread: battle_models.modeldb help....

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Icon1 battle_models.modeldb help....

    ok so to make this nice and easy i added the mounted longbowmen to my mod from the british isles campaign and of course i had to edit this darn file ...my goal was to give them the look of the halbbruders but with the attachments of the mounted longbowmen...not sure if it will work or not....either thats causing me to crash or its a freaking spacing error or some other crap with this dreaded file....attached is the modeldb file...edits are from line 7938 - 8015....if someone could please help me figure it out i would greatly appreciate it...and maybe help me figure out the format for it cause i never seem to get it right....

  2. #2

    Default Re: battle_models.modeldb help....

    Were the mounted longbowmen already in the KGCM EDU, or have you added them?

    I assume the KGCM EDU is at the hardcoded max of 500units! If you have added them to the KGCM EDU, then you may need to remove an entry that was already there. This gives you two options, either count all the entries in the EDU, or contact the KGCM forum for EDU info.

    I've run your model.db through the syntax checker, for some reason my checker isn't reading it. Other causes of your ctd could be either EDU error or entries missing from the other folders in the unit_models folder.
    If you are certain that you've not excedded the 500 limit, then you must make sure all the textures, meshes etc, for the mounted longbowmen are present in the KGCM _unit folders etc.


  3. #3

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by dannyxx30 View Post
    Were the mounted longbowmen already in the KGCM EDU, or have you added them?

    I assume the KGCM EDU is at the hardcoded max of 500units! If you have added them to the KGCM EDU, then you may need to remove an entry that was already there. This gives you two options, either count all the entries in the EDU, or contact the KGCM forum for EDU info.

    I've run your model.db through the syntax checker, for some reason my checker isn't reading it. Other causes of your ctd could be either EDU error or entries missing from the other folders in the unit_models folder.
    If you are certain that you've not excedded the 500 limit, then you must make sure all the textures, meshes etc, for the mounted longbowmen are present in the KGCM _unit folders etc.
    I replaced an existing unit to add them in cause i wasn't sure how many units were in the EDU...also i took all the mesh files & sprites from the british isles campaign game and copied them over to KGCM folder.... i typed the modelsdb file while looking at the british isles entry for the mounted longbowmen and when i got the idea to give them a halbbruder look i copied the texture entries for halbbruders into the mounted longbowmen section....figured it would be fine since texture are different from the attachments right? anyway i thought i had it all right but first try it CTD....thanks for suggestions... i've added the other files & folders where i made changes to add them for further review....thanks a bunch for the any help that can be provided....

  4. #4
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: battle_models.modeldb help....

    Run Gracul's sweeper, it's great.

  5. #5
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: battle_models.modeldb help....

    Replacing the textures doesn't give a new unit, then you would need to edit the model.
    Just use the normal mounted longbowmen

  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: battle_models.modeldb help....

    killersmurf is right, and run Gracul's battle_models sweeper (I say again ).

  7. #7
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by Taiji View Post
    killersmurf is right, and run Gracul's battle_models sweeper (I say again ).
    Yeah Gracul's sweeper is very good, I think it's the best modelbd checker

  8. #8

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by killersmurf View Post
    Yeah Gracul's sweeper is very good, I think it's the best modelbd checker
    I ran the sweeper nut nothing came up for missing files, no errors, no unneeded files either....so basically your saying i cant just put any texture over any units mesh and create new looks for units?????

  9. #9

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by valvegas1 View Post
    so basically your saying i cant just put any texture over any units mesh and create new looks for units?????
    No you can't, every model has a set of textures with a unique pattern, so you can't use one texture on different 3D models because the UV mapping varies from one model to another.

    What is UV mapping you will say? UV mapping is the 3D modeling process of making a 2D image representation of a 3D model.
    Like this for example:
    Spoiler Alert, click show to read: 

    ^The mesh of the 3D model is right on the intended location of the 2D texture so another texture pattern won't work on this 3D model.

    And you should read this BMDB explanation if you don't know properly about it.
    Thorough Explanation of BMDB Now something about this BMDB file read this old post of mine it will tell just what the hell is this BMDB file and it's role in M2TW.
    BMDB Basics explained(Click to Open).

    Quote Originally Posted by Ishan View Post
    First thing is you need to understand the modeldb file that is the key file of the game.

    Lets take an example of armored swordsmen entry in the BMDB or modeldb file:-
    Code:
    17 armored_swordsmen
    The first line is the name of the unit and is the one that is written in the armor_ug line in the EDU. This name is 17 characters big (including the “_”). This number is shown before the name. This format is repeated throughout the file: first the length of the line, then the line itself. If the written number is different from the amount of characters in a line then the game will crash at start up. Using the modeldb checker in this case helps.

    Code:
    1 3  
    62 unit_models/_Units/EN_Pplate_Plate/armored_swordsmen_lod0.mesh 121  
    62 unit_models/_Units/EN_Pplate_Plate/armored_swordsmen_lod1.mesh 1225  
    62 unit_models/_Units/EN_Pplate_Plate/armored_swordsmen_lod2.mesh 6400
    The first line in the above code stats that a 1 character string is about to come. Things string (“3”) tells the game how many model lines there are to come. In this example there are 3 model lines. If we take a closer look at the first model line we see that it is 62 characters big, and that it points to a .mesh file. The number 121 represents the distance at which the model is last shown. The game takes the square-root of 121 (or whatever number there is) to calculate the distance. So here the distance in meters is 11 in game meters. Notice that the distance number is not counted with the 62 characters. When you zoom out in the game, it goes to the next model at a distance of 121 which continues to be shown till a distance of 1225, and so on. The reason for this is that the game, like many other games, uses a LoD system. LoD stands for “Level of Detail”: the lower the lod number (lod0) the more faces, or polygons, the model contain. The reason for this system is to optimise the performance. After a distance of 6400 the games does no longer show 3d models, but 2d representations called Sprites which are very light in comparison laying stress on your GPU.

    Code:
    2  
    7 england  
    74 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_EN_Pplate_england.texture  
    73 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_EN_Pplate_normal.texture  
    49 unit_sprites/england_Armored_Swordsmen_sprite.spr  
    5 slave  
    73 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_EN_Pplate_rebels.texture  
    73 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_EN_Pplate_normal.texture  
    47 unit_sprites/slave_Armored_Swordsmen_sprite.spr
    The first number tells us that now comes two faction entries for the unit’s main textures. The two factions are England and the slaves (rebels). Each of these faction names, as always, have a number in front of them with the length of the string. The texture entries consist of 3 lines:
    • The first line is the “diffuse map”, or simple the ordinary textures.
    • Next up is the normal map.
    • Lastly is the link to the sprites.

    Code:
    2  
    7 england  
    60 unit_models/AttachmentSets/Final Heater_england_diff.texture  
    60 unit_models/AttachmentSets/Final Heater_england_norm.texture 0   
    5 slave  
    58 unit_models/AttachmentSets/Final Heater_slave_diff.texture  
    58 unit_models/AttachmentSets/Final Heater_slave_norm.texture 0
    The next entries concern the attachmentsets. These are textures used mainly for weapons and shields. The lines are built up pretty much the same way as the main texture entries, with a diffuse and a normal map.
    Code:
    1  
    4 None  
    19 MTW2_Slow_Swordsman 0   
    2  
    18 MTW2_Sword_Primary  
    14 fs_test_shield 0  
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    These are the animations used by the unit. They are probably the hardest part of the ModelDB to read. The “4 none” states that the unit doesn’t now use a mount. Next up it says that he uses the slow swordsman animationset and the “fs_test_shield” line says that he uses a shield animation for his off hand.


    Now you are interested in changing textures of this unit so see the red and blue highlighted part red part is the texture faction wise for the figure of the unit while blue about attachments that is sword, shield etc etc.
    So you have to edit those textures types to make a difference. Also you will find that this file is used by many units so if you change the texture it will affect say 5-6 units. To skip this from happening you will save the texture with a different name and then put the info in the modeldb, how?
    Say you changed
    Code:
    74 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_EN_Pplate_england.texture
    After that rename the file to something else like "mtw2_EN_Pplate_england.texture" to "mtw2_TWC_Pplate_england.texture"
    Now you can see i increased the characters by one and the file name is changed so put them back and increase the count by 1.
    Code:
    75 unit_models/_Units/EN_Pplate_Plate/textures/mtw2_TWC_Pplate_england.texture
    So that's the max i can tell you and if you still don't get it then let me go to Sahara desert first and do this


  10. #10

    Default Re: battle_models.modeldb help....

    ok thanks thats pretty much what i needed...one small question though...does the spacing matter?? cause i noticed that some lines have two blank spaces at the end and some have one...and if you don't have proper spacing will it cause a ctd?

  11. #11
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: battle_models.modeldb help....

    The texture just gives the skin of the unit, the look is mainly defined by the model

  12. #12
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: battle_models.modeldb help....

    Glad to help, but give Gracul that +rep, he deserves loads for that tool

  13. #13

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by Taiji View Post
    Glad to help, but give Gracul that +rep, he deserves loads for that tool
    will do for sure....

  14. #14

    Default Re: battle_models.modeldb help....

    hmmmm What are you talking about? What tool? I only know one tool ane it calls notepad

  15. #15

    Default Re: battle_models.modeldb help....

    Quote Originally Posted by attyla View Post
    hmmmm What are you talking about? What tool? I only know one tool ane it calls notepad
    BMDB sweeper....runs checks on the BMDB file for syntax errors, unused entries, and missing entries...when its done it writes a text file with proper syntax code...just copy and paste into BMDB and all syntax errors are fixed...just found out about it myself but its a great tool...

    Edit: forgot to mention you put the files in your unit_models folder and run from there to run the sweeper...
    Last edited by valvegas1; December 02, 2011 at 12:07 AM.

  16. #16

    Default Re: battle_models.modeldb help....

    Here you go attyla, this is the tool we were talking about.
    battle_models.modeldb sweeper

  17. #17

    Default Re: battle_models.modeldb help....

    it's interesting. I need to try it Thanx for info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •