1. ## map_heights.tga understood

When Spurius and I were thinking about the reasons for the unreachable settlements problem when placing cities in mountaineous areas, he asked me what, in my opinion, a tile in RTW and MTW2 is.
What I answered was that it's the smallest entity a game object can stand on, that is, it corresponds to one pixel in map_regions.tga
He remarked that this is 4 pixels in map_heights.tga - I agreed.
However, he then asked where the 1 pixel offset came from. After some thinking (first I thought that each tile has 4 height info pixels, but that didn't explain the offset) I came up with the following idea:
Each tile has in fact nine corresponding pixels in map_regions.tga, however most of them are shared between neighbouring tiles. To explain this, look at the following image of a 3*3 region map overlaid with a 7*7 heights grid:

From this pic, it's actually easy to understand the "offset": You have half a pixel extra on each side of the map, this means the map has to be 1px wider and 1px higher. In formula terms, you can easily deduce the total area and prove that this method yields the right size (w = map_regions width, h = map_regions height; W = map_heights width, H = map_heights height; A = area):
We know that A = W*H = (2w+1)*(2h+1) = 4wh+2w+2h+1, because W = 2w+1 and H = 2h+1
With the above method, in the interior part of the map, each tile has 4*0.5 for the edges, 4*0.25 for the corners and 1*1 for the center pixel - that is, 4 per tile.
For each tile on an edge of the map, we have to add 0.5 + 2*0.25=1 (all in all 5) to this, and for the corner tiles we have to add 2*0.25+2*0.5+0.75=2.25 (all in all 6.25)
This results in an area of:
4*(w-2)*(h-2) + 5*(2*(w-2) + 2*(h-2)) + 6.25*4 = 4wh - 8w - 8h + 16 + 10w-20 + 10h-20 + 25 = 4wh + 2w + 2h + 1

We're currently researching how this translates exactly to unreachable settlements to save time when mapping (i.e. how steep a slope can be at the max to still allow settlements to be reached). Help with that would be greatly appreciated :)

2. ## Re: map_heights.tga understood

I wonder if placing an impassable ground type on the corners will block passage. I remember that I was trying to make an extremely narrow pass (1 pixel thick in map_ground_types, and I had trouble. I wonder...

3. ## Re: map_heights.tga understood

Originally Posted by Myrddraal
I wonder if placing an impassable ground type on the corners will block passage. I remember that I was trying to make an extremely narrow pass (1 pixel thick in map_ground_types, and I had trouble. I wonder...
I think map_ground_types.tga uses the same system. So that might very well be the case. Spurius and I are currently researching what exactly makes a settlement impassable.

4. ## Re: map_heights.tga understood

I'm not sure, have you seen this?:
https://forums.totalwar.org/vb/showp...6&postcount=18

I posted it a long time ago.

I assume it is the same in M2TW.

5. ## Re: map_heights.tga understood

Ah, no I didn't see that. Anyways, that blends in nicely. The type (water or land) of the tile is determined by the center pixel on the heights map. That is to be expected.
Appears you found out how it works years before we did

6. ## Re: map_heights.tga understood

Originally Posted by alpaca
Appears you found out how it works years before we did
Sorry for that.
Ah, well, I'm itching to do some modding for M2TW. (I'm hoping it is the right phrase. )
But I'm bound to another modding project.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Single Sign On provided by vBSSO