Jump to content

Height Maps


Auntie Mangos

Recommended Posts

  • 39 years later...

In client files (.adt) height map stored as:

1           2           3           4           5           6           7           8           9
   10         11         12         13         14         15         16         17     
18         19         20         21         22         23         24         25         26 

But on .map generation converted in this format:

1     2      3      4      5      6      7      8      9      10     11     12     13     14     15     16
17     18     19     20     21     22     23     24     25     26     27     28     29     30     31     32

On conversion added additional data and also lost accuracy (on data interpolation)

This patch use .adt format for store height map in .map files its give:

1 - less memory usage (before for maps used 1.66 Gb, after 1Gb)

2 - Must be more correct heigh calculation (on test i get accuracy 3-4 sign after comma)

3 - Height calculation not more difficult as before (bilinear interpolation), used interpolation on triangles.

here is - fixed ad.exe for extract .map files and patch..

[added]

test maps (use .gps command and compare my Z coordinate, and Map Height)

Old maps - get +-1 mistake on some points (in hills)

My mps +-0,001 mistake in all points

Source:

       // Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid
       // +--------------> X
       // | h1-------h2     Coordinates is:
       // | | \\  1  / |     h1 0,0
       // | |  \\   /  |     h2 0,1
       // | | 2  h5 3 |     h3 1,0
       // | |  /   \\  |     h4 1,1
       // | | /  4  \\ |     h5 1/2,1/2
       // | h3-------h4
       // V Y
       // For find height need
       // 1 - detect triangle
       // 2 - solve linear equation from triangle points
       // Calculate coefficients for solve h = a*x + b*y + c
       float a,b,c;
       // Select triangle:
       if (lx+ly < 1)
       {
           if (lx > ly)
           {
               // 1 triangle (h1, h2, h5 points)
               float h1 = gmap->v9[lx_int][ly_int];
               float h2 = gmap->v9[lx_int+1][ly_int];
               float h5 = 2 * gmap->v8[lx_int][ly_int];
               a = h2-h1;
               b = h5-h1-h2;
               c = h1;
           }
           else
           {
               // 2 triangle (h1, h3, h5 points)
               float h1 = gmap->v9[lx_int][ly_int];
               float h3 = gmap->v9[lx_int][ly_int+1];
               float h5 = 2 * gmap->v8[lx_int][ly_int];
               a = h5 - h1 - h3;
               b = h3 - h1;
               c = h1;
           }
       }
       else
       {
           if (lx > ly)
           {
               // 3 triangle (h2, h4, h5 points)
               float h2 = gmap->v9[lx_int+1][ly_int];
               float h4 = gmap->v9[lx_int+1][ly_int+1];
               float h5 = 2 * gmap->v8[lx_int][ly_int];
               a = h2 + h4 - h5;
               b = h4 - h2;
               c = h5 - h4;
           }
           else
           {
               // 4 triangle (h3, h4, h5 points)
               float h3 = gmap->v9[lx_int][ly_int+1];
               float h4 = gmap->v9[lx_int+1][ly_int+1];
               float h5 = 2 * gmap->v8[lx_int][ly_int];
               a = h4 - h3;
               b = h3 + h4 - h5;
               c = h5 - h4;
           }
       }
       // Calculate height
       float _mapheight = a * lx + b * ly + c;

As you can see this method not more hard for equation (and in some cases ease than bilinear interpolation :) ), and give wondefull results on my tests

Link to comment
Share on other sites

In client files (.adt) height map stored as:

[added]

test maps (use .gps command and compare my Z coordinate, and Map Height)

Old maps - get +-1 mistake on some points (in hills)

My mps +-0,001 mistake in all points

What exactly will that change?

I love the size change (1.66Gb -> 1.00Gb)

But what impact in the game will the "mistakes" fix?

Link to comment
Share on other sites

But what impact in the game will the "mistakes" fix?

Map height - is used in most random movement generators:

in some cases you can drop under textures in Fear (if points set go under it) try fear in hills before and after.

Also used in summons (for detect ground) - try summon totem in hills before and after.

Link to comment
Share on other sites

@ DiSlord - Do you think this will have any impact on mage blink spell on hills and some areas. There has been various tests done near the road going up to Ironforge, near Ring of Trials at nagrand and other hill places. Also on orgrimmar on some parts and same for Stormwind. Sometimes mage falls under map. Just asking if by the change in accuracy maybe this can be avoided.

Link to comment
Share on other sites

There are few problems I'v noticed using those maps.

- Movement generators random/confused etc seems to be almost totally screwed.

- Blink and alike totally not usable.

Under valgring I'm getting a lot of "Conditional jump or move depends on uninitialised value(s)" related to various map related calculations.

My guess is that those maps aren't properly loaded by the server.

Take care.

Link to comment
Share on other sites

There are few problems I'v noticed using those maps.

- Movement generators random/confused etc seems to be almost totally screwed.

- Blink and alike totally not usable.

Possibel yopu use old maps that cleary not compatible

Under valgring I'm getting a lot of "Conditional jump or move depends on uninitialised value(s)" related to various map related calculations.

I see same reports for old map code at old interpolation array use.
Link to comment
Share on other sites

Possibel yopu use old maps that cleary not compatible

I see same reports for old map code at old interpolation array use.

Not like this. Adding below about 5 minutes worth of runtime on local (single client) using those maps ( extracted from 308a client ). Extractor used is one compiled locally using the provided patch.

http://pastebin.com/m3de317c4

Using the old maps I do get the warning once in a while, but clearly not like this.

I will re-extract using the extractor added in last rev. and retest, reporting the result.

Take care.

Link to comment
Share on other sites

Not like this. Adding below about 5 minutes worth of runtime on local (single client) using those maps ( extracted from 308a client ). Extractor used is one compiled locally using the provided patch.

try init variables

float a,b,c;

like

float a=0,b=0,c=0;

and test again on 7291 revision..

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use