Hex: Tutorial on mapfiles: Installment #1
Hex: Tutorial on mapfiles: Installment #1
I've started to work on a detailed discussion on the mapfile format. I will try to release a new section when I get time to write it. For now, enjoy this--
---------------------------------------------------
An explanation of Halo Map Files.
Ok, this tutorial is LONG overdue. In this tutorial, I intend to explain how the halo mapfile format works. I will try to point out the differences between Halo Xbox and HaloPC where I can. My target audience is advanced modders, but intermediate modders will get some good info out of it as well. After reading this, you should get a general idea of how the mapfile works, and a better understanding of why some things are corrupt, or why your rebuild doesn't work. Ok, so on with the info dump...
---------------------------------------------------
Table of Contents
MAPFILE ORGANIZATION
-Header
-Tag Index Header
-Scenario
-Supporting Tags
-Raw Model Data
-Raw Bitmap Data
-Raw Sound Data
-BSP(s)
THE MAPFILE HEADER
-what it does
-xbox and compression, fixed length
-header format
THE TAG INDEX HEADER
-model raw data offsets
-magic
-tag count
-base tag
-tag ids
THE SCENARIO
-header and reflexives
-scenario defines everything in the GAME, everything else is supporting
-scenario spawns
-high level tags
-scenario reference pools
-bsp data
SUPPORTING TAGS
-metadata...what it really is
-major tag types
-recursive types
-tag hierarchy
-raw data
MODEL RAW DATA
-model tags
-how the model raw data works
-submeshes and submesh headers
-LODs and variations
-differences in offsets for xbox and pc
-raw data corruption with model injection and map rebuilding
BSP
-what is a BSP
-how the bsp is found
-most difficult part of reverse engineering halo
-bsp tags having a zero offset
-collision bsp and visible meshes
---------------------------------------------------
DIFFERENCES BETWEEN HALO XBOX and HALOPC
There a great number of differences between xbox and pc maps. Of course, the version number in the header is 5 for xbox, and 7 for PC. People often say that xbox maps are fixed length, so you can't really add anything to them. This is partially correct, but mostly wrong. It is true that cache files are all the exact same size. However, all of the mapfiles in their "cache" format use garbage padding from the end of the useful halo data to the end of the cache file. When halo runs, it decompresses the map files on the original game disk onto the harddrive. The data here is usually several megabytes shorter than the cachefile length, so the rest of that "slack space" from the end of the useful data to the end of the actual cache file is garbage. The length of the decompressed file is defined by the mapfile header.
Another major difference between the PC and Xbox versions is a lot of the floating point data on the xbox version is in an encoded/compressed format. This is to save disk space and memory on the console, which is much more restrictive than on a normal PC capable of running halo. Since the PC has much more free memory, it is more efficient to use up more disk space and avoid converting all those compressed floats (this saves CPU cycles by avoiding the conversion altogether). In fact, this is the major difference between PC models and xbox models. It would probably be possible to someday convert PC models to xbox.
The biggest difference between PC and xbox is that xbox cache files contain ALL of the necessary resource to run a map. On PC, the raw data for sound and bitmaps are moved into separate .map files to save on disk space. This is the major reason that rebuilding with HMT works on PC, but not on xbox. The code to handle the raw data is not perfect, and it is still not perfectly understood.
Next Topic: MAPFILE ORGANIZATION
-Grenadiac
---------------------------------------------------
An explanation of Halo Map Files.
Ok, this tutorial is LONG overdue. In this tutorial, I intend to explain how the halo mapfile format works. I will try to point out the differences between Halo Xbox and HaloPC where I can. My target audience is advanced modders, but intermediate modders will get some good info out of it as well. After reading this, you should get a general idea of how the mapfile works, and a better understanding of why some things are corrupt, or why your rebuild doesn't work. Ok, so on with the info dump...
---------------------------------------------------
Table of Contents
MAPFILE ORGANIZATION
-Header
-Tag Index Header
-Scenario
-Supporting Tags
-Raw Model Data
-Raw Bitmap Data
-Raw Sound Data
-BSP(s)
THE MAPFILE HEADER
-what it does
-xbox and compression, fixed length
-header format
THE TAG INDEX HEADER
-model raw data offsets
-magic
-tag count
-base tag
-tag ids
THE SCENARIO
-header and reflexives
-scenario defines everything in the GAME, everything else is supporting
-scenario spawns
-high level tags
-scenario reference pools
-bsp data
SUPPORTING TAGS
-metadata...what it really is
-major tag types
-recursive types
-tag hierarchy
-raw data
MODEL RAW DATA
-model tags
-how the model raw data works
-submeshes and submesh headers
-LODs and variations
-differences in offsets for xbox and pc
-raw data corruption with model injection and map rebuilding
BSP
-what is a BSP
-how the bsp is found
-most difficult part of reverse engineering halo
-bsp tags having a zero offset
-collision bsp and visible meshes
---------------------------------------------------
DIFFERENCES BETWEEN HALO XBOX and HALOPC
There a great number of differences between xbox and pc maps. Of course, the version number in the header is 5 for xbox, and 7 for PC. People often say that xbox maps are fixed length, so you can't really add anything to them. This is partially correct, but mostly wrong. It is true that cache files are all the exact same size. However, all of the mapfiles in their "cache" format use garbage padding from the end of the useful halo data to the end of the cache file. When halo runs, it decompresses the map files on the original game disk onto the harddrive. The data here is usually several megabytes shorter than the cachefile length, so the rest of that "slack space" from the end of the useful data to the end of the actual cache file is garbage. The length of the decompressed file is defined by the mapfile header.
Another major difference between the PC and Xbox versions is a lot of the floating point data on the xbox version is in an encoded/compressed format. This is to save disk space and memory on the console, which is much more restrictive than on a normal PC capable of running halo. Since the PC has much more free memory, it is more efficient to use up more disk space and avoid converting all those compressed floats (this saves CPU cycles by avoiding the conversion altogether). In fact, this is the major difference between PC models and xbox models. It would probably be possible to someday convert PC models to xbox.
The biggest difference between PC and xbox is that xbox cache files contain ALL of the necessary resource to run a map. On PC, the raw data for sound and bitmaps are moved into separate .map files to save on disk space. This is the major reason that rebuilding with HMT works on PC, but not on xbox. The code to handle the raw data is not perfect, and it is still not perfectly understood.
Next Topic: MAPFILE ORGANIZATION
-Grenadiac
-
- Posts: 732
- Joined: Wed Nov 26, 2003 11:59 pm
- Location: Raleigh, NC, USA
That doesn't make any sense first of all. Second of all, its completely uneeded. Lately most of all your posts have ATLEAST 1 diss aimed toward newbs in general if not a specific person. Can't you find anything better to do with your time than pretend to be in some leet Anti-Newb organization and flame whenever you can. When you're not flaming newbs, or spamming to increase your post count, you're asking to be a moderator and complaining about how we aren't doing are job well enough.HunterXI wrote:*applauds Gren*... now I can just link to this in my sig as proof that most noobs are too stupid to understand...
If you can't provide positive feedback to forum users, I once AGAIN request that you DO NOT REPLY AT ALL.
Good job Gren, I was wondering when this was coming, perhaps after you're completely finished with your tutorials, someone will take your information and set up a page (similiar to pfhorslayer's page) that outlines the details of the .MAP specification.
yeah, but you haven't seen my PM box... OMFG was it bad...kaptainkommie wrote:That doesn't make any sense first of all. Second of all, its completely uneeded. Lately most of all your posts have ATLEAST 1 diss aimed toward newbs in general if not a specific person. Can't you find anything better to do with your time than pretend to be in some leet Anti-Newb organization and flame whenever you can. When you're not flaming newbs, or spamming to increase your post count, you're asking to be a moderator and complaining about how we aren't doing are job well enough.HunterXI wrote:*applauds Gren*... now I can just link to this in my sig as proof that most noobs are too stupid to understand...
If you can't provide positive feedback to forum users, I once AGAIN request that you DO NOT REPLY AT ALL.
Good job Gren, I was wondering when this was coming, perhaps after you're completely finished with your tutorials, someone will take your information and set up a page (similiar to pfhorslayer's page) that outlines the details of the .MAP specification.
and I didnt mean to spam in any way, I still agree that this is very good, and taught me several thing too
and Kaptain, wtf are you talking about mods... Ive never asked to be a mod...
and besides, you're asking me not to post if I dont have "anything nice to say"... you just flamed me, dumbass...
This post printed on 100% recycled electrons.
- MasterNeoChief
- Posts: 2431
- Joined: Tue Dec 23, 2003 9:34 am
- Location: The Netherlands
-
- Posts: 270
- Joined: Sat Jan 24, 2004 7:00 pm
- MasterNeoChief
- Posts: 2431
- Joined: Tue Dec 23, 2003 9:34 am
- Location: The Netherlands
-
- Posts: 396
- Joined: Sun Feb 22, 2004 4:07 pm
- Location: Mu Geminorum VII
Funny, that was exactly what I was planning to do after I finished HHK (server down).kaptainkommie wrote:...someone will take your information and set up a page (similiar to pfhorslayer's page) that outlines the details of the .MAP specification.
-:sigma.SB
I just wanted a little clarification on the Xbox map rebuilding problem. Corrrect me if I am wrong but you are saying xbox map rebuilding is impossible because the snd header values are not all known and so we don't know how to update them. This also goes with the bitm header but more is known about that header. This makes me think that hmt doesn't try to extract xbox snd meta or bitm meta for rebuilding. Making it impossible to rebuild the map anyways.
So once we figure out the complete header structure we should be able to map rebuild for xbox or at least get a little closer.
So once we figure out the complete header structure we should be able to map rebuild for xbox or at least get a little closer.