Jump to content

MMaps Redux


Guest auntieMangos

Recommended Posts

Pushed big changes, read the commit note.

I will pull Lynx's vmap_rewrite updates in a while, just want to make sure mine work before adding more on top of it.

I added some linux code for getDirContents, but I don't know if it works. I don't even know if it returns relative or absolute paths.

Link to comment
Share on other sites

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

lots of generator changes:

* switch to load-per-tile, memory requirement is much much smaller

* no longer using chunky mesh (although easy to switch back)

* fix tile detection code

* less hacky way of determining map tile bounds

* some linux compatibility changes (no build option yet)

* move towards thread-safety

Great news. Is it necessary to rebuild the previously generated maps?

REPLY TO BELOW. If you won't specify the parameters, it'll build with:

skipContinents = true,

skipJunkMaps = true,

skipBattlegrounds = true,

hiResHeightmaps = false,

shredHeightmaps = true,

debugOutput = false.

Link to comment
Share on other sites

No, you won't need to rebuild the mmaps. Only need to do this in a few situations:

  • * Map data changes (client patch)
    * structure of navMesh changes (recast update) - you will get an error on mangos console if this happens
    * someone complains about a broken section of navmesh, like monsters not fitting through a door
    my current commit has this issue, need tweaks to make it not happen (for example, on map 34 some doorways are blocked)
Link to comment
Share on other sites

We won't need to rebuild mmaps even if you don't use chunky mesh anymore ?

And instead of checking if the directories are here you should create them (only for mmaps dir and meshes dir). There is a typo in your code, you check "Meshes" dir and use "meshes".

I tried to look at vmap extractor way of handling necessary/to build folders but i need further investigation. Or Lynx3d could help on that :)

I would give better help but this thing is way over my head :S

Ad source code was easier xD

void CreateDir( const std::string& Path )
{
#ifdef WIN32
   _mkdir( Path.c_str());
#else
   mkdir( Path.c_str(), 0777 );
#endif
}

bool FileExists( const char* FileName )
{
   int fp = _open(FileName, OPEN_FLAGS);
   if(fp != -1)
   {
       _close(fp);
       return true;
   }

   return false;
}

but i don't know if a folder could be check as a file is.... On linux it is the case but i have no idea on win.

Link to comment
Share on other sites

void CreateDir( const std::string& Path )
{
#ifdef WIN32
_mkdir( Path.c_str());
#else
mkdir( Path.c_str(), 0777 );
#endif
}

bool FolderExists( const char* FileName )
{
int fp = _open(FolderName, OPEN_FLAGS);
if(fp != -1)
{
_close(fp);
return true;
}

return false;
}

but i don't know if a folder could be check as a file is.... On linux it is the case but i have no idea on win.

as you can see from the minor change in your that your answer is yes on windows, it's basicly the same call just how you word it.

Link to comment
Share on other sites

Hmm, I get numerous "No vertices to build tile!" warnings with various maps. The fastest way to reproduce is to try to build maptiles for 409:

Building map 409:

We have 9 tiles.

[29,32]: No vertices to build tile!

[29,33]: No vertices to build tile!

[29,34]: No vertices to build tile!

[30,32]: No vertices to build tile!

[30,33]: No vertices to build tile!

[30,34]: No vertices to build tile!

[31,32]: No vertices to build tile!

[31,33]: No vertices to build tile!

[31,34]: No vertices to build tile!

Complete!

Link to comment
Share on other sites

Sorry about that, another wow -> recast coord conversion problem. Works now.

edit: you should still see the 'no vertices' warning on some instances. their model doesn't extend to all tiles, but we're still building correctly.

edit2: nevermind, I fixed the broken ones and broke the working ones.

Link to comment
Share on other sites

Ok, those shenanigans are fixed. But I realized that there is a problem with doing load-per-tile... the tiles heightmaps can't get sewn back together. Need to load adjacent tiles' heightmaps (maybe only partially load) so that the tiles are in contact with each other as they're built.

Generating mmaps will be a waste of time till I fix this. Sorry for the inconvenience.

Link to comment
Share on other sites

Ok, those shenanigans are fixed. But I realized that there is a problem with doing load-per-tile... the tiles heightmaps can't get sewn back together. Need to load adjacent tiles' heightmaps (maybe only partially load) so that the tiles are in contact with each other as they're built.

Generating mmaps will be a waste of time till I fix this. Sorry for the inconvenience.

thank you for your work!

Link to comment
Share on other sites

with new vmaps core sometimes stuck

(gdb) frame 8
#8  0x0000000000e713a8 in VMAP::StaticMapTree::isInLineOfSight (this=0x7ff4044022b0, pos1=..., pos2=...) at /***/src/shared/vmap/MapTree.cpp:154
154             float resultDist = getIntersectionTime(ray, maxDist, true);
(gdb) list
149             // prevent NaN values which can cause BIH intersection to enter infinite loop
150             if (maxDist < 1e-10f)
151                 return true;
152             // direction with length of 1
153             G3D::Ray ray = G3D::Ray::fromOriginAndDirection(pos1, (pos2 - pos1)/maxDist);
154             float resultDist = getIntersectionTime(ray, maxDist, true);
155             if (resultDist < maxDist)
156             {
157                 result = false;
158             }
(gdb) print pos2
$27 = (const G3D::Vector3 &) @0x7ff401ec43a0: {x = 1.35347255e+29, y = 17066.666, z = 28.2427902}
(gdb) print pos1
$28 = (const G3D::Vector3 &) @0x7ff401ec43b0: {x = 15726.6719, y = 21450.3203, z = 28.2427902}
(gdb) print pos2-pos1
$29 = {x = 1.35347255e+29, y = -4383.6543, z = 0}
(gdb) print maxDist
$30 = inf

maybe maxDist must be double instead of float?

Link to comment
Share on other sites

maybe maxDist must be double instead of float?

lol... *cough*

I mean, have you looked at the values?

Question: Where do you think you could get when you walk -err- travel 1.3*10^29 meters in one direction?

(hint: the max dimensions of a WoW map is ~3.4*10^4, one lightyear has 9.461*10^15 m)

Link to comment
Share on other sites

With non-updated vmaps, everything seems to work almost perfectly. Thanks again, Faramir.

Oh, in the unlikely case some of you didn't think of it, if you have a multicore processor, you can shorten your total building time by half if you run two or more (depending on the number of cores) instances of the generator on separate processor affinities at the same time. Just run one for --skipContinents true, and then another four for maps 0, 1, 530, and 571.

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