Pc & Xbox: Advanced- Tutorial on mapfiles: Installment

This is where the Admins will put tutorials submitted by users.
Post Reply
Grenadiac




Socialist Golden Age Magic Era Eureka
Tsunami Scorched Earth Articulatist 250

Posts: 390
Joined: Fri Sep 05, 2003 1:36 pm
Location: Tucson, AZ USA
Contact:

Pc & Xbox: Advanced- Tutorial on mapfiles: Installment

Post by Grenadiac »

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
Post Reply