MOB File Format Breakdown Thread

Discussion in 'General Modification' started by Agetian, Mar 20, 2005.

Remove all ads!
  1. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    My assistant and I have started a major statistical breakdown of the *.MOB file format which might help the modders to understand the file format better and possibly write a tool to create or edit the *.MOB Files.

    We ran a couple of pretty interesting statistical tests on certain groups of MOB files, based on different file size and different object types stored in MOB files (e.g. ammo, weapons, generic). Also, a statistical test was run which included more than 4,100 mob files that produced a log file with possible byte values for the first 103 bytes of every MOB file. More tests may be run in the future for additional information.

    So far, the following information has been uncovered via statistical tests (note that all the information is based on statistics, so it may be erraneous):

    1) The following bytes are always the same in all tested MOB files:
    0x0001 with value 119 (0x77)
    0x0005 with value 1 (0x01)
    0x001D with value 2 (0x02)

    Other bytes may differ.

    2) The minumum file size of the MOB file in the test was 103 bytes. First 103 bytes of EVERY MOB FILE TESTED, no matter its size and its type, may be represented by the following map, given that '*' represents a byte that's the same in all files,

    '.' represents a byte that may differ in different files, and '0' represents a byte which is always null (0x00):

    *000*0........00............*0......................
    .000.0.0....000.00..00........0....................


    3) Through advanced testing, meaning of the following bytes was uncovered (some of them were known before):

    0x000C (4 bytes) - proto ID of the mob

    0x0024 (16 bytes) - GUID of the mob, the same as in the file name.
    For example, a mob file named:
    G_FFD506F0_4F7A_4821_9DA9_7811D45CF849.MOB
    would have this field set to:

    F0 06 D5 FF 7A 4F 21 48
    9D A9 78 11 D4 5C F8 49

    Note that first part is reversed, while the second one is not reversed.

    0x0034 (1 byte) - type of the mob, as defined in item_effect.mes, for example:
    4 - weapon
    5 - ammo
    12 - generic item

    0x004B (4 bytes) - the "X" coordinate for a mob. Might be invalid for some mob file types? (needs further testing). Works for most files, might as well work for all files (it fits the generalized mob file map in [2]).

    0x004F (4 bytes) - the "Y" coordinate for a mob. Might be invalid for some mob file types? (needs further testing). Works for most files, might as well work for all files (it fits the generalized mob file map in [2]).

    4) Certain tests were run to uncover possible values of different bytes in mob files. A separate test was run for all 4100+ files and for 600 biggest files.

    More information MAY be uncovered via careful analysis of the achieved log files and through running additional tests. I attach the logs we have gained as a result of our tests so you're free to take a look at them as well. If you have any ideas about the meaning of certain fields in *.MOB files, please let us know by responding in this thread.

    Note that there are two types of logs. Those that start with "Possible Byte Values..." indicate the possible values of different bytes in *.MOB files. All other logs indicate identical bytes and zero fields for different categories of analyzed mob files. File maps are provided as well (similar to the one in [2]).

    If you're wondering about the statistical software we use for analysis, it's our own stuff that we would like not to release publicly because it's difficult to use and may still contain bugs because it's pretty much a beta. If you would like to help us with the MOB files and you're sure in your skills (mainly of editing files in hex mode and analyzing statistical sheets similar to the ones provided), feel free to contact me and we may cooperate.
    Any suggestions are welcome.

    EDIT: 3/20/05: Added offsets for X/Y coordinates in mob files.
    EDIT: 3/20/05: Corrected the offset of mob type (0x0034 instead of 0x0035).

    - Agetian
     

    Attached Files:

    Last edited: Mar 20, 2005
  2. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hey,
    I was just wondering if there's a brave soul out there to aid me with the MOB file format breakdown. I've been busy with this *.mob crap all these days, and I was still unable to figure out the most important parts of these files - especially the ones that deal with inventory linking. Certain parts of the files just don't make any sense at all, modifying them either does nothing or crashes the game at startup/map load. What's really bad is that ToEE just crashes to desktop without explaining the reason why that happened. That makes the work a lot harder. MOB files seem to depend on certain offsets into inventory linking block, into parameters block, etc. BUT, these offsets (if they ARE offsets) are written in a very complicated, not-so-easy-to-understand form (may as well be encoded in some way), so it's really hard to figure out the regularity in all this crap.

    It would be wonderful if someone else joined me in my effort, otherwise it might all just plain bore me and I might abandon the task (that's what I am afraid of, myself). But - 6 days all for nothing, even with helper programs like AXE, HexWorkshop, statistical tests, etc. etc. etc. - is way too much for me.

    So, I just repeat - is there anyone to try out some stuff with me? If we split our efforts, we will be at least twice as effective! If there is a person brave enough to accept the task, please reply in this thread or send me a PM, and I'll explain what I've found out so far and what needs to be done.

    - Agetian
     
    Last edited: Mar 22, 2005
  3. Morpheus

    Morpheus Mindflayer Veteran

    Joined:
    Nov 11, 2003
    Messages:
    539
    Likes Received:
    1
    I'd like to help out, but I'm swamped with work at the moment. In about 2 weeks, I should have some time to spare though.

    Someone else with 1337 h4x0r skills? Come on, guys. Finding out how those .mob files work would be a very prrrecious discovery indeed. We wants it! We needs it!
     
  4. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hey, Morpheus,
    I'm glad that you'll be able to help me out in some time. That'd be really nice of you.

    If there's anyone else willing to do some research, come on by! ;-)

    Right now I'm very close to figuring out the pattern with items linked to the chests, so stay tuned for updates. :)

    - Agetian
     
  5. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Progress update

    I wanted to inform you on the progress I've had today in breaking down the mob file format. I was quite lucky and successful today. I was able to reproduce the Tutorial Chest A item (on the tutorial map 1) entirely from scratch, with complete functionality. I did a little cleanup and refined the file, deleting the elements which at the moment seem irrelevant to game functionality.

    There is no solid theory that can be spoken of today, but at least I've figured out the basic outlines of the mob file format that allowed me to recreate one of the mob files (pretty complicated one, too) in a hex editor.

    Basically speaking, after certain clarifications that are to be made (for example, it's still unclear to me why after I add more items to the chest they all appear in the same slot - number one, that is) I'll be able to start a document which will contain a more or less complete outline of a mob file format, and possibly create a supplementary program to aid in making and linking mob files.

    I still ask for help, though. Even though today was a success, it's still a very time-consuming and tiresome job. There are still tons of unanswered questions and possible misconceptions about mob files. Moreover, I'll have to start writing my thesis paper for the University soon, so I'll have a lot less time to spare on modding again. :-( So, if there is anyone out there who's willing to help, I'll be glad to hear that.

    EDIT: I've found out the location of the item's back-reference to the container and also I've found the byte that stores the slot (location) of the item to be put to. Awesome.

    Thanks in advance for help.
    - Agetian
     
    Last edited: Mar 23, 2005
  6. Morpheus

    Morpheus Mindflayer Veteran

    Joined:
    Nov 11, 2003
    Messages:
    539
    Likes Received:
    1
    Great stuff. Maybe once we figure out the containers, the inventories of creatures and shops won't be so hard to understand anymore.

    Like I said, right now I'm quite busy with work, but I'd like to help analyse the mob files once my current project is finished (in 1-2 weeks maybe).
     
  7. lord_graywolfe

    lord_graywolfe Wolfman

    Joined:
    Apr 30, 2004
    Messages:
    739
    Likes Received:
    0
    well im new to this, working on the game, and so far my attempts have been failures but im willing to give it a try if possible to help out.

    you said all the items you put into the chest appeared in the first slot. the coins we get from any looting always do that too ive noticed. all types of coins appear in the first slot stacked on each other so maybe it needs a slightly different text to seperate everything.
     
  8. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hi,

    Well, I've got it covered with all the items appearing in the first slot. The thing is - one needs to put a correct back-reference to the container in the item mob file and then there's also a special byte that is used to differentiate the slot in which to put an item.

    Anyway, I'm glad to hear you're willing to help. The first thing that needs to be done isn't that hard, really, and it doesn't involve any hex-editing. If you could, please set up the ToEE Mod Studio on your PC and use the "MOB Analysis" tool inside to locate the *.mob files that have the type "obj_t_npc". In order to do that, unpack the "modules/ToEE.dat" file and pick the directories in the "modules/ToEE/maps" subfolder for analysis. Locate the NPC mob files inside.

    Then, it'd be nice of you if you found 10-15 smallest NPC files that exist in the game. It's essential for the breakdown. I would have done it myself, but currently I'm way too busy with my life problems. So please, if you can, locate the smallest NPC files that exist. If possible, the size should be smaller than 499 bytes (if *that* small NPC mobs exist, of course). If you do that, give me a list of those mob files, OK?

    That'd be nice if you could help with that.
    Thanks in advance.
    - Agetian
     
  9. lord_graywolfe

    lord_graywolfe Wolfman

    Joined:
    Apr 30, 2004
    Messages:
    739
    Likes Received:
    0
    ok either im doing something wrong here or there arent any mob files under the mpas subfolder. i have been through over half the file in the modules/ToEE/maps folder. using the mod studio under the mob analysis tab i select a path to these files and click analyize but so far it has found nothing. now as to the unpacking of the ToEE data file in the modules im not sure what you mean by unpacking it. i have trying opening it with several different programs but so far no luck
     
  10. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    OK, first of all you need to unpack the ToEE.dat file located in the "modules" folder. To do this you'll need to use a dat file unpacker (look for it on this site - it's got to be somewhere). Afterwards you'll get a lot of folders, and one of them will be "maps" (under "modules\ToEE"). So, you'll have to analyze the individual folders using the mod studio (for example, "Map-2-Hommlet-Exterior", "Tutorial Map 1", and so on. There will be a lot of 'em).
    Hope it helps.
    Good luck!
    - Agetian
     
  11. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,029
    Likes Received:
    42
    This from zhuge . . .

    Find it here .
     
  12. lord_graywolfe

    lord_graywolfe Wolfman

    Joined:
    Apr 30, 2004
    Messages:
    739
    Likes Received:
    0
    ok Gaear that gave me a rar. file, gives me something similar to machine code, instead of an exe file. the other links for extractors are dead got another place to pick up and extractor.exe ?

    i already have the Map-2-Hommlet-Exterior folder under maps in the module folders. this was all installed in the begining. and i check the file in that folder already for the mob files and got an error on it. i also currently have 120 files under maps and am just a little over half way through them with no mob files found as of yet
     
  13. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    I did this a few days ago, I also got a .rar file, searched microsoft for a program that could open it, got "NewzToolz" a .rar unzipper that's completely free, so a winner all round, used newztoolz to give me the exe file.
     
  14. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,029
    Likes Received:
    42
    Right, .rar is another form of zipping, basically. I got WinRAR for free for a while. That should be long enough to get you where you want to be.

    Here's a link.

    Download it, unzip it, run it!
     
  15. lord_graywolfe

    lord_graywolfe Wolfman

    Joined:
    Apr 30, 2004
    Messages:
    739
    Likes Received:
    0
    ok i got the NewToolz that Allyx meantioned last night and ran it unzipping the rar file. i tried to run the toee exe. that it gave me but it doesnt do anything at all. a brief millisecond flash of another window which is then gone and thats it. i removed and downloaded the ToEEextract a couple of times but got the same results.

    in the mean time i have checked the files that i already had under the maps folder in modules, 122 of them, and found no mobs at all
     
Our Host!