Terrain.hf

From Mx Simulator
Jump to navigation Jump to search

Terrain.hf hold the information about how the game should interpret the terrain.png file. A typical terrain.hf file could look like:

9 2.000000 4.620410 42.100571

What to note here is that there are 4 values, each representing something different. All three terrain and shading files must have a 2^n+1 square aspect ratio, that goes for terrain.png, shading.ppm and shadingx2.ppm. If they aren't of this size, it'll cause errors. This should not be mixed up with decals and other textures which are supposed to have 2^n aspect ratio, squared or rectangular.

1st Value

The first value tells the game what dimensions of terrain.png, shading.ppm and shadingx2.ppm to expect. If the value is 9, it expects the files to be 1025x1025px. If it's set to 10, it expects 2049x2049px files. It's possible to go higher and lower (8 = 513x513px, 11 4097x4097px and so on), but lower will yield bad resolution or a very small map, bigger will be heavy on the computer.

2nd Value

This value scales the terrain size. Set to 1, and 1px of the image will be 1 foot in game. Set it to 2 and 1px of the image will be representing 2 feet in game, 0.5 would also then represent half a foot in game.

3rd & 4th Value

Third value is what black (lowest point) on the terrain.png represents and the fourth value is what white (highest point) on the terrain.png is. These values are modified by the game automatically (when using the editor), so unless you make tracks with photoshop, you won't really have to bother with these two.

Examples

If you want to use 1025x1025px track files and have them to be 2050ft x 2050ft, you would have:

9 2.000000 0 0

If you instead want to have a 2049x2049px track files and have them to be 2049ft x 2049ft in game, this would go:

10 1.000000 0 0

Calculating scale for replicas

If you're making replicas and use satellite imagery as an overlay, you can calculate your size to match in game. Assuming that the track files are 2049x2049px (as that is almost exclusively the sized used for tracks), you would follow this formula:

( Distance / 2049 ) x Scale

Distance is real life distance how long a side would be, scale is how much bigger (or smaller) you want it in game. If you want it 15% bigger in game to make it feel more close to real life, you'd use a scale of 1.15. Example could be:

( 1460 / 2049 ) x 1.15 = 0.819424

Here it's assumed that one side in real life is 1460 feet and it is scaled up 15% in the game.

Guide

Write a separate page, link it here.