Page 1 of 45 123456789101126 ... LastLast
Results 1 to 20 of 885

Thread: Be a Modder: Doctoring of Medieval 2 units.

  1. #1

    Default Be a Modder: Doctoring of Medieval 2 units.

    Edit by paleologos:
    The image hosting site has deleted the images in this post but you can view them all in the pdf form of this tutorial: Be a modder-Doctoring of Medieval 2 Units.7z







    Well for the past few months i have been seeing that a lot of users that come in the mod workshop asking for swapping shields and other stuff from one unit to another although this is fairly easy but it can be a pain for newbies so i decided to write a tutorial on it.

    Basic Setup & Understanding
    So lets get to the point. I'll taking an example now where i'll be making a 2 handed swordsmen into a regular swordsmen with a sword and shield removing the Zweihander sword from it.

    So lets take 2 units that are of those types. For 2-handed lets take "Highland Nobles" and for regular swordsmen lets take "Dismounted feudal knights" both of them are vanilla units.
    Goal



    Requirements For this task one needs the following things:-



    First thing is that one should be familizied with one file that is essential and is responsible of handling or putting this new unit in game. The file is battle_models.modeldb aka BMDB or modeldb which is found in data\unit_models folder.
    The defualt vanilla one is not formatted and looks messy something like this:-
    Spoiler for Unformatted BMDB


    But you can download the formatted version from here.
    Note:-Using a Formatted Version is essential it will make you life easier.

    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




    Step-I
    Ok now that we have learned the basics on BMDB we can continue the task at hand.

    First job is to locate the the .mesh files of Highland Nobles so go open the BMDB file and find this unit entry it will be:-
    Code:
    15 highland_nobles 
    1 4 
    58 unit_models/_Units/EN_Highlander/highland_nobles_lod0.mesh 121 
    58 unit_models/_Units/EN_Highlander/highland_nobles_lod1.mesh 900 
    58 unit_models/_Units/EN_Highlander/highland_nobles_lod2.mesh 2500 
    58 unit_models/_Units/EN_Highlander/highland_nobles_lod3.mesh 6400 
    1 
    8 scotland 
    72 unit_models/_Units/EN_Highlander/textures/en_highlander_scotland.texture 
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_normal.texture 
    48 unit_sprites/scotland_Highland_Nobles_sprite.spr 
    1 
    8 scotland 
    70 unit_models/AttachmentSets/Final European Archer_scotland_diff.texture 
    70 unit_models/AttachmentSets/Final European Archer_scotland_norm.texture 0  
    1 
    4 None 
    16 MTW2_2HSwordsman 0  
    1 
    24 MTW2_2HSwordsman_Primary 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    The lines in red are the location for the mesh files so copy the 4 mesh files and put them in some folder.

    Now open your first mesh file that is highland_nobles_lod0.mesh with GOM and it should be something like this and convert them into .ms3d so that we can edit it in milkshape.
    Spoiler for Pic 1

    After that you will see the conversion completed box and then you can leave it there and open the highland_nobles_lod0.ms3d file in milkshape(whatever you named it when converting and wherever you stored in your new folder).


    Step-II
    Upon opening in milkshape you will see something like this:-
    Spoiler for Pic 2


    Now we have to see which group we have to delete it's pretty simple to detect (just double click to know which group is which and it will be highlighted in model) in this case the groups are:-
    • claymore_65
    • claymore_66

    Notice that these groups have <Mat: Attachments> thingy while other groups have <Mat: Figure> it's pretty elementary coz every model has two types of materials (on RHS of groups tab) one is figure and other is attachments. Attachments contains all the weapons a unit has while the figure has well all the figure parts.
    This is done because a model uses 2 textures one for the body and other for weapons if you read my old post given in the content box above^ you will get it.

    Now delete these 2 groups by pressing the delete button given below and now you will have something like this:-
    Spoiler for Pic 3

    Now this model is done save it and then close it.


    Step-III

    Now Open the mesh file for dismounted feudal knights, same drill convert it to .ms3d via GOM and then open this .ms3d file in milkshape but here what we have to do is delete all the groups except the sword and shield.
    So after deleting all the groups from this ms3d file we will have something like this:-
    Spoiler for Pic 4.1 & 4.2



    Now save this as well and we are all set to merge.
    You may wonder that why there where different groups for these same weapon types labelled as "_81", "_82" etc well the thing is these are same but they are added in the model to give different textures to these same weapons as you have seen in game that the same unit many times have different textures on their shields etc so that's why and now you know.


    Step-IV
    Now comes the merging all you guys have to do is open first the highland noble model the one without the claymore in GOM and then use the merge option and merge it with the dismounted feudal knights one, the one having only the sword & shield.
    We will have something like this:-
    Spoiler for Pic 5



    Step-V
    If you use DXTbmp and convert these two textures into .tga type:-
    • en_highlander_scotland.texture to en_highlander_scotland.tga
    • Final Heater_scotland_diff.texture to Final Heater_scotland_diff.tga


    Now one can check this new unit(ms3d) file in milkshape and use these textures to check whether they are displayed or assigned properly or not.
    Like:-
    Spoiler for Pic 6

    Seems perfect to me.

    So we are done here now you can test this baby in game how to add new units in game i have linked the tutorial for that below.


    Step-VI
    Ok reading the tutorial will guide on how to put it but there are some things in it not explained so i will explain them here with the case in hand.
    Now we have the new model in .mesh format. As you can see we did this mixing & merging with only lod0.mesh files so you can carry this procedure similarly on the rest of lod files.

    Now after we get all the new mesh files in order we have to place them in game there are tutorials to add other units in game so reading this tutorial will help.

    And i'm going to call it "Highland Swordsmen" entry in modeldb or BMDB file.
    We will be using the new .mesh files(that we created by merging), figure textures from the highland nobles and attachments textures from Dismounted feudal knights so it look something like this:-

    Spoiler for BMDB entry for Highland Swordsmen
    Code:
    18 highland_swordsmen 
    1 4 
    61 unit_models/_Units/EN_Highlander/highland_swordsmen_lod0.mesh 121 
    61 unit_models/_Units/EN_Highlander/highland_swordsmen_lod1.mesh 900 
    61 unit_models/_Units/EN_Highlander/highland_swordsmen_lod2.mesh 2500 
    61 unit_models/_Units/EN_Highlander/highland_swordsmen_lod3.mesh 6400 
    1 
    8 scotland 
    72 unit_models/_Units/EN_Highlander/textures/en_highlander_scotland.texture 
    70 unit_models/_Units/EN_Highlander/textures/en_highlander_normal.texture 
    51 unit_sprites/scotland_Highland_Swordsmen_sprite.spr 
    1 
    8 scotland 
    61 unit_models/AttachmentSets/Final Heater_scotland_diff.texture 
    61 unit_models/AttachmentSets/Final Heater_scotland_norm.texture 0  
    1 
    4 none 
    14 MTW2_Swordsman 0  
    2 
    18 MTW2_Sword_Primary 
    14 fs_test_shield 0 
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002 


    ^As you an see i'm using the figure textures of highland nobles and attachment textures of DFKs also using the animation that DFKs use that is a regular swordsmen not the animation from 2-handed guys.


    Special Cases
    However there are 2 misc cases when a person might get stuck
    1. When textures are not assigned properly.
    2. When he wants say a secondary weapon of some unit to be the primary weapon of the first.

    Case 1 In Milkshape he\she can do\fix it via going in the texture co-ordinate editor panel (Hot-Key Ctrl+T). And then while the proper texture selected already (through the materials tab) he then can assign them to their right places some thing like this:-
    Spoiler for Pic 7

    Lastly an old post here by me that will explain on it a bit more where such an error existed for some user.


    Case 2 In these case we have to set the comments right before we merge those units and create a new unit. Comments can be easily changed, say we want the secondary weapon (Maul) for longbowmen to be the primary of some unit(that we want to create). So change the comment like this:-
    Spoiler for Pic 8


    Final Stages
    So i think that is all there is to now you can create your own custom units from different existing units that you have.

    There is one more small thing that may be noticeable by graphics freaks like me is that when merging these models with GOM it creates a line on the face that looks kinda ugly even though we didn't do anything but there is a easy solution to this:-

    Basically GOM doesn't do that, that is after merging it creates a stupid line in the middle of the faces it is because of the auto smooth option being checked in milkshape so before opening your merged finish model make sure auto smooth is turned off or unchecked that is. Auto smooth check box is located at the bottom of the groups tab.


    At the end we get what we wanted Highland Swordsmen unit made from Highland Nobles and DFKs:-


    Hope you find this tutorial useful.
    Last edited by paleologos; April 26, 2018 at 01:14 PM.

  2. #2
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,309
    Blog Entries
    24

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Nicely done, should make things easier to understand for the beginner.



  3. #3

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    well done, especially for guys who dont want to start 3D because they think its really complicated
    Leader of Colonialism Total War
    Thread with first Preview
    First Youtube Trailer


  4. #4

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Thankyou guys it means a lot to me and hopefully i'll post more helpful tutorials if i have spare time.

  5. #5
    Jaguar Paw's Avatar Senator
    Join Date
    Jan 2008
    Location
    Maryland, USA
    Posts
    1,294

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Excellent job Ishan, a really good tutorial for the total noob (like we all were at one time ). I still have tons to learn about 3d modelling.
    Member: The Frontier. Researcher, Skinner, and Modeler.












    Member: The Frontier Researcher

  6. #6
    Huene's Avatar Aimless Wanderer
    Join Date
    Feb 2009
    Location
    Homer, Alaska
    Posts
    1,494

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    well done! as a GOAT user i didnt know that you could preview a model using GOM's converter. much easier than the trial and error approach i typically use.

  7. #7
    Pvt. Parts's Avatar Ordinarius
    Join Date
    Dec 2008
    Location
    Australia
    Posts
    744

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Great tutorial, very thorough and newbie-friendly.

    Thanks!

  8. #8

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Yeah thanks for the tutorial and another contribution to the modding community

    Narnia TW forum here

  9. #9
    AnthoniusII's Avatar XXI ARMORED BRIGADE
    Join Date
    Feb 2007
    Location
    Thessalonike Greece
    Posts
    21,731

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Very helpfull my friend.
    Please add the -after merge- comment detail.
    After merging parts of diferend models with GOM every part continues to have its original model's comments.
    So before you save your final model ,open the main comments box save the 1st group of comments ,then delete all the rest and save.
    Spoiler Alert, click show to read: 


    If you forget to remove the extra comments you may have a ctd.
    Exelent tutorial my friend!

    I call "doctoring" "Frankenstein" technic...
    Last edited by Ishan; December 23, 2010 at 11:46 AM. Reason: added spoiler
    There are moments (in history), in which a nation owes,
    if it wants to be considered as a great one, to be able to fight.
    Even without hope of winning. Just because it has to.
    Greek War motto.
    XXI Armored Brigade. Proud that served in that unit in 1996!
    "Spartans do not ask how many (enemies are) but where they are"!
    XXI Armored Brigade's motto.
    The Greek Secret (or why they will fight again if it will be necessary or why they do not sell their history).


  10. #10

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Quote Originally Posted by AnthoniusII View Post
    Very helpfull my friend.
    Please add the -after merge- comment detail.
    After merging parts of diferend models with GOM every part continues to have its original model's comments.
    So before you save your final model ,open the main comments box save the 1st group of comments ,then delete all the rest and save.
    Spoiler Alert, click show to read: 


    If you forget to remove the extra comments you may have a ctd.
    Exelent tutorial my friend!

    I call "doctoring" "Frankenstein" technic...
    Thankyou Sir Anthony i forgot that part and i do this when i edit the secondary model so that after merging the double comment don't show up it's basically same as you said.
    And i have checked this many times it doesn't seem to give us a CTD but it's better to stick with the rules.
    Anyways pic added Step-III Pic 4.2.

  11. #11

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Thanks for this excellent tutorial.
    The superior man acquaints himself with many sayings of antiquity and many deeds of the past, in order to strengthen his character thereby. -John Milton

  12. #12
    Nefarious's Avatar Tiro
    Join Date
    Sep 2010
    Location
    New Orleans
    Posts
    293

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    I, for one, was having difficulty removing that damnable line from faces and legs. I had read the fix in another thread, toiled unsuccessfully, then re-read this entire tutorial. With that seam being such a distraction in both faces and legs, I regrettably contemplated army compositions without certain glitched units. A shame of a compromise, actually. I was following the tutorials step by step, yet the units remained glitched.

    But then, this evening...success!!
    It wasn't me, afterall. I was trying to mod already-modded meshes and had no starting point of reference. And there were only lod0 and lod1 files. Using this tutorial I have now rebuilt the troubling units from scratch utilizing vanilla meshes and textures; a first, for me. I then merged the meshes, removed the seams, modified the textures, and...
    THANK YOU, Ishan! And a hearty thanks to all you other modders who continue to contribute to the community.

    Hobbies should be enjoyable, not frustrating. It's tutorials like this one that increase the first whilst lessening the latter. Again, thank you.
    -Nef
    Every time I venture from New Orleans,
    I get the sensation of leaving Oz and landing on Kansas.

    -------
    You want to know what? Really?? My political profile? Are you sure? Alright, then...

  13. #13
    Finlander's Avatar ★Absolutely Fin-bulous★
    Moderator Emeritus Content Emeritus

    Join Date
    Jun 2009
    Location
    In the North
    Posts
    4,875

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Great tutorial, Ishan. Thank you for sharing your tips and knowledge.


    • Son of MasterBigAb; • Father of St. PolycarpeKahvipannuRadboudMhaedrosGeMiNi][SaNDy
    FlinnUndyingNephalimKAM 2150
    Charerg








  14. #14

    Default

    Ishan THANK YOU VERY MUCH. Can't wa8 to go through with it all!

    Hey I went through everything and got my fresh unit on the field. I have one terrible problem though in milkshape the texture and look is awesome, but in the game on the battlefield and the units explode! :S check it out, it also happens to the mesh on its own - btw this is a body from one mesh and a weapon from another... PLEASE PLEASE HELP!
    Spoiler Alert, click show to read: 

    Spoiler Alert, click show to read: 

    Spoiler Alert, click show to read: 


    btw i found this for anyone who sees my post and has the same problem...
    http://www.twcenter.net/forums/showt...kshape+problem
    Last edited by Ishan; January 08, 2011 at 11:14 PM. Reason: double post

  15. #15

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    You must have messed up the comments or are using an old converter.

  16. #16
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,309
    Blog Entries
    24

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    I think he is on the right track (refering to milkshape 1.8.5 beta):

    Quote Originally Posted by RollingWave View Post
    hmmm, i seem to be figuring it out... it seems that it has something to do with me installing the "ut bone" something that came with the milkeshape install... once i reinstall with only milkshape core files it seem to be working again... i'll try again to make sure...

    edit: yep that's the problem ... ugggh can't believe I wasted nearly half a day due to this



  17. #17

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Ok guys i did figure it out and now it works like magic... !THE PROBLEM IS WITH 185 BETA! I got 1.8.4 (i suppose earlier versions would also do) and now it works fine (i also unticked the UT Bones box at milkshape intalation just to be safe). The thing is that 1.8.5. beta is not compatible with GOM converter... don't update your milkshape if you wanna keep doing things this way... CHEERS FOR THE QUICK RESPONSE GUYS!

    PS - even when I did remove ut bones when installing 185 beta the problem still occurred.
    Last edited by MasterBaggins; January 11, 2011 at 04:41 PM.

  18. #18
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    47,309
    Blog Entries
    24

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Man, I am good....



  19. #19
    wolfslayer's Avatar Senator
    Join Date
    Oct 2007
    Location
    Lexington, South Carolina
    Posts
    1,170

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Great tutorial, Ishan. Bookmarked.

    Once when editing a very large SS6 BMDB (I'm pretty good with "on the fly" editing of this file in notepad) I had backed up, but added the rebels to 10 or more units + their upgrades without backing up.

    OOOPS, crashed on game launch! What to do but start from scratch? After scouring through the file over and over for almost 30 minutes, pretty much remembering which units I had changed, but with no luck finding the error:

    I then figured out a way to find the exact character # the BMDB had crashed on using the MS utility
    FileMon v7.04

    and any text editor that will give you a character count of a selection to find the crash point (In my case Ultra edit, but there are others that work also. It took 3-4 minutes but using this method on a COPY of my bad file I found and fixed 1 character length error I had made. Presto, game started first try .This method I could make into it's own tutorial, it's a huge time saver, and I'm always looking for error free shortcuts, that save time and aggravation.
    Last edited by wolfslayer; January 13, 2011 at 08:34 PM. Reason: added link to filemonitor
    ______________________________________________________________


    Viewing and editing MTW2 textures with MWthumb and DXTbmp









  20. #20
    Lü Bu's Avatar "Mightyest Man Alive"
    Join Date
    May 2008
    Location
    Split,Croatia
    Posts
    5,423

    Default Re: Be a Modder: Doctoring of Medieval 2 units.

    Thanks for your contribution
    Proud patron of Wlesmana
    Assyria Total War
    Check update thread for new HQ models
    My Workshop™


Page 1 of 45 123456789101126 ... LastLast

Tags for this Thread

Posting Permissions

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