The .MHF File explained


Intro
I will try to explain how these files are created and used by my content processor so you can add your own parameters. The mhf files have no actual data besides the map's parameters and that is why they must be located near their source data. By familiarizing yourself with these files you will be able to make quick changes to your map by just changing the required parameters in any text editor, or even in C# itself.

The Structure
I will go through the structure line by line, however certain parameters may have different lengths so I have used variables to represent the possible lengths of these parameters.

0: This line contains the current version of the map file along with some silly credits. This version is checked by the content processor to enforce the latest version and also remind you to update your content processor with your parameter changes as well.

1: The name of the map which is your content's name.

2: Original Heightmap Width (the heightmap image file)

3: Original Heightmap Height (the heightmap image file)

4: The split width specified by the map finalizer

5: The split height specified by the map finalizer

6: The number of chunks the map processor expects. (These are the many images in the maps folder.)

7: Pixel Blur Parameter

8: Triangle Scale Parameter

9: Height Modifier Parameter

10: Scale Lossless Parameter

11: Scale Lossy Parameter

12: Light direction Parameter (In format of: "x/y/z")

13: Light Intensity Parameter

14: Ambient Color Parameter (In format of: "R/G/B/A")

15: Diffuse Color Parameter (In format of: "R/G/B/A")

16: Track Laps Parameter

17: Music Cue Parameter

18: Car Position Parameter (In format of: "x/y/z")

19: Car Orientation Parameter (In format of: "x/y/z")

20: The total number of check points

21 - (21 + number of check points): Check point data (In format: "xPos/yPos/Width/Length")

(22 + number of check points): The number of textures used in the map

(23 + number of check points) - (23 + number of check points + number of textures): Texture data (In format: "R/G/B/NameofTexture")

(24 + number of check points + number of textures) - (The end of the file): The position for each of the map chunks. (For use during reassembly)

Adding Your Own Parameters

Adding a parameter is easy to do in the Map Finalizer, but you will have to remember where it occurs to retrieve it in the content processor as well. For example if you wanted to add a parameter that would store a string that described how difficult your level was, this is how you would do it:

1.) First find the function that saves your map file. It should be the button1 click event in form3 in the MapFinalizer project. You do not want to edit the preview event as the previewer does not accept additional parameters.

2.) Find where you want to add it. Adding it in the middle will be difficult as you will have to shift all your content processor code by one, so adding it to the end is the easiest option for now.

Ex. sdata = sdata + "\n" + LevelDifficultyString

3.) Change the line 0 parameter,(version), to a higher number to remind you to make the appropriate changes in the content processor.

4.) If required, add the additional code and user controls needed to get the input for your parameter.

Last edited Sep 2, 2010 at 9:38 PM by T3866, version 7

Comments

No comments yet.