Results 1 to 6 of 6

Thread: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

  1. #1

    Default Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    This issue gave our team some headaches and it doesn't seem to have been covered before, so here's a small tutorial on how to solve it. I tried to make it as exhaustive as possible and took baby steps.


    The Problem: GOAT does not convert .mesh files from the Steam version of Medieval 2 Total War.

    The Solution: change those files' serialization number.

    EDIT: this problem was already solved by Hex35 in another older thread. He provides you with a nice python script that does the job for you (by automatically fixing the model's header). The process described in my post below is a little more involved.


    Say I want to convert the mesh file for the mexican priest from the Americas expansion of M2TW: Kingdoms (mexican_priest_lod0) into a MS3D file, so that I can edit it in either Milkshape or some other 3d editor.
    Spoiler Alert, click show to read: 


    If I own the CD version of the game I can just open GOAT, click on the MeshToMS3D button, choose the file I want to convert and GOAT will convert it fine.
    Spoiler Alert, click show to read: 


    If instead I happen to own the Steam version of the game then GOAT will throw a bunch of errors at me. There are at least a couple observations to be made here.


    Observations Observation 1

    If we compare the two files in their Windows properties Tab we notice that they are NOT the same size. Specifically, the CD version is 4 bytes bigger than its Steam counterpart.
    Spoiler Alert, click show to read: 

    Observation 2

    If we compare the output GOAT gives us when trying to convert the mesh files, we notice that the CD version mesh "is regular" whereas the Steam version "is variant (siege engine)". This doesn't make any sense, since the mexican priest is definitely not a siege weapon.
    Spoiler Alert, click show to read: 

    If we take a look into GOAT's Python files (specifically GameObjectApplicationLibrary_v1_0) those two attributes, "is regular" and "is variant", are mirrored by 2 arrays of numbers, "regularheader" and "variantheader", respectively. The two are similar yet have a few differences: there are 4 missing numbers and a couple numbers a different.
    Spoiler Alert, click show to read: 

    We could also use the MeshToText function of GOAT to take a look inside the CD version.
    Spoiler Alert, click show to read: 

    The highlighted number after "serialization::archive" is exactly the same number for "regularheader" from GOAT's file.
    Spoiler Alert, click show to read: 

    Unfortunately, the Steam version will give you an error if you try to convert it to a text file, and you cannot turn a text file into a MS3D file anyway. Therefore, you cannot simply edit the serialization number in the text file.

    The solution here is to use an HeX Editor. I used HxD - Hexeditor but you can use any editor you like. For instance HexEd is free and you can use it directly from your browser.
    HexEditing
    By comparing the two versions you can clearly see the missing bytes in the Steam version in the first tab.
    Spoiler Alert, click show to read: 

    Just add 4 bytes (01 00 00 00) after the first 01 00 00 00 sequence and change the 00 into a 01 and the 01 into a 02 so that the sequence looks identical to the CD version's in the second tab.
    Spoiler Alert, click show to read: 

    Now, when you try to convert the Steam version it'll work like a charm.
    Spoiler Alert, click show to read: 
    Last edited by MagicTrinkets; March 13, 2018 at 03:33 PM. Reason: Adding Hex35's info + link

  2. #2
    paleologos's Avatar You need burrito love!!
    Join Date
    Feb 2011
    Location
    Variable
    Posts
    8,496

    Default Re: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    Well done to you and the other members of your team and many thanks for sharing this with the community!

  3. #3

    Default Re: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    Thanks! Much appreciated!

  4. #4
    Metal.Pigeon's Avatar Decanus
    Join Date
    May 2015
    Location
    Ecruteak City (Florida, United States)
    Posts
    557

    Default Re: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    Nice find, glad to see that us Steam modders have one less thing to worry about!

    Mod leader of One Ruler on Earth | Unit modeler for Colonies & Empires

  5. #5
    Hexdragon's Avatar Libertus
    Join Date
    Nov 2005
    Location
    South America / Peru / Lima City
    Posts
    81

    Default Re: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    Good job on finding it.

    Discussed a roughly similar topic on GOAT and GOAL's thread some time ago

    On below linked post you will find, attached, a script that makes the fix on the header for you.

    http://www.twcenter.net/forums/showthread.php?190197-GOAT-and-GOAL-A-collection-of-modelling-and-animation-utilities&p=14077590&highlight=#post14077590


    Hope it helps.

  6. #6

    Default Re: Mesh to MS3D Conversion for Steam Version of M2TW: Kingdoms

    Quote Originally Posted by Hex35 View Post
    Good job on finding it.

    Discussed a roughly similar topic on GOAT and GOAL's thread some time ago

    On below linked post you will find, attached, a script that makes the fix on the header for you.

    http://www.twcenter.net/forums/showthread.php?190197-GOAT-and-GOAL-A-collection-of-modelling-and-animation-utilities&p=14077590&highlight=#post14077590


    Hope it helps.
    First of all, thank you Hex35 and please forgive the eons it took me to reply to your post.
    Second, I'm going to add your info to my post. I know that it's a matter of scrolling down a few posts but, admittedly, the very thread you've linked me to doesn't feature your explanation in its OP. This is unfortunate because you tackled and solved exactly the same issue I encountered and it would have saved me a lot of time if I'd seen it before. I would imagine that many more useful contributions ended up getting lost in the depths of that thread and many others in this forum.
    Last edited by MagicTrinkets; March 13, 2018 at 03:35 PM. Reason: funny syntax is funny

Posting Permissions

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