This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [QUESTION] VMaps on Customized Maps  (Read 10808 times)

henslock8

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 5
    • View Profile
[QUESTION] VMaps on Customized Maps
« on: June 03, 2012, 04:47:52 am »
Hello, I am having trouble getting VMaps to work on Customized Maps.

I have been fiddling with Noggit in Durotar, I placed a simple building with some .m2's around it like in the picture below:



After finishing and saving my work, I put it into an .MPQ named "patch-6" and I modified vmapexport.cpp in the source code to support Patch-6.MPQ. I recompiled, got the new Vmap extractor, ran it and let it finish, and replaced my old Vmaps in my server folder.

No errors recieved whatsoever...

So I log into the game and it turns out that Vmaps have enabled Line of Sight for ONLY the .m2's (that I added), however the .WMO has no LoS at all.

I am curious as to why this is ... I probably did something foolish but help would be appreciated  :?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
It\'s been awhile...

Soldan

  • Contributors
  • Wiki Incarnate
  • *****
  • Posts: 159
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #1 on: June 03, 2012, 12:26:06 pm »
You did re-extract the maps before making the v-maps, right?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

henslock8

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 5
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #2 on: June 03, 2012, 04:38:54 pm »
It's been awhile, the last time I worked on Noggit/PServers was about 2 years ago -- so forgive me if my memory is foggy ... I thought maps were used for discovering sections of the World of Warcraft in-game map. If so, then how do VMaps require Maps to be extracted properly? (If that's what you're getting at)

Regardless, I have already tried it and it does not work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
It\'s been awhile...

Soldan

  • Contributors
  • Wiki Incarnate
  • *****
  • Posts: 159
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #3 on: June 03, 2012, 05:01:06 pm »
Perhaps they have nothing to do with them at all, but every time I extract v-maps, I previously extract maps anyway, so it was worth a shot. (Prior to your reply, I did actually believe they had something related, but obviously not :P)

I have no idea then, maybe, even though you edited the .cpp, try renaming it to patch-4, or patch-5... Never know, it might work :S

My V-maps work on custom maps (edited blizz ones) and even on custom continents (map id 5000+ for example), so I don't know why it isn't working for you :S
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

henslock8

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 5
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #4 on: June 03, 2012, 05:04:37 pm »
Well any kind of help is appreciated, so thanks.

It seems that only WMO's are causing me trouble, the M2's are absolutely fine :S

Someone else might have an answer  hopefully.

Edit: Experimenting with other WMO's to see if I get the same issue.
Edit2: Different WMO's still give the same issue, no LoS with vmaps :(

Does anyone have any idea on why this is happening?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
It\'s been awhile...

resinate

  • Registred Member
  • Race Changer
  • *****
  • Posts: 25
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #5 on: June 06, 2012, 07:20:43 am »
what u need to understand is noggit doesnt save WMO properly. ive spent days and days trying to fix this. its not getting fixed any time soon if not never. im sorry to bust ur balls on this news. its also the same when u spawn an npc on the WMO and have it walk on it. theyll just fall thru the WMO.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Steff

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 4551
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #6 on: June 06, 2012, 07:26:54 am »
The question is.. why is there no bugtraker entry about this WMO collision problem?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Please mark as solved if solved.
Don't ask if you could ask a question... JUST ask the Question.
You can send me also offline messages. I will answer if I get online.
Skype: project.modcraft
Discord: steff#6954

henslock8

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 5
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #7 on: June 07, 2012, 05:16:48 am »
Quote from: "resinate"
its not getting fixed any time soon if not never. im sorry to bust ur balls on this news.

It's good to know I am not the only one with this issue.
Hmm... Soldan said he does not have this issue with V-maps, unless he was only referring to his M2's as well.

Quote from: "Soldan"
My V-maps work on custom maps (edited blizz ones) and even on custom continents (map id 5000+ for example), so I don't know why it isn't working for you :S
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
It\'s been awhile...

Hlkz

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 9
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #8 on: July 15, 2013, 03:20:38 pm »
I got the problem too, with vmaps3.
With vmaps4, m2 dont work neither.

bugtracker/index.php?do=details&task_id=142
for the tracker (fail project and cant edit, sorry)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #9 on: July 25, 2013, 11:15:10 pm »
I have done lots of debugging myself, using ArcEmu.

Maps, vmaps and mmaps generated fine. It all rendered without any errors and I added debug outputs to make sure my custom data was being loaded.

However it seems WMO's placed by Noggit, on Blizzlike or new maps, are completely and utterly fucked up. :)

I found some WMO's had partial to full collision when they are the only WMO on the ADT.

Other WMO's like cave's and larger objects had literally no collision.

The issue lies with the vmap generation, LoS is not found. I assume because the vmap data is incorrect that mmap data is also then not generated correctly.

In vmaplibMapTree.cpp function:

Code: [Select]
bool StaticMapTree::InitMap(const std::string & fname, VMapManager2* vm)

I found a constant crash that only occurs with this custom data.

Code: [Select]
if(success)
{
  try
{
iNTreeValues = iTree.primCount();
iTreeValues = new ModelInstance[iNTreeValues];
}
catch(...)
{
printf("FATAL ERROR CAUGHT: %s", fname.c_str());
return false;
}
}

The try and catch was put in to stop it crashing. It now just refuses to continue the function when it decides to not work. I have no idea why the two lines of code fail, primCount(); just returns object.size(); - a vector. This does not return a valid value, it crashes.

I will continue experimenting. At the moment I am hackfixing with this global catch and by having a custom flag I put on creatures that allows them to ignore pathfinding and LoS checks.

It is not what I want but this seems to be the only solution I can use until someone with more expertise in C++ can figure out why the WMO's are so broken when placed through Noggit.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #10 on: July 26, 2013, 10:45:38 am »
Value of iNTreeValues? I'd guess 0 or negative. What does the remainder of that function do?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #11 on: July 26, 2013, 04:16:04 pm »
Quote from: "schlumpf"
Value of iNTreeValues? I'd guess 0 or negative. What does the remainder of that function do?

The full function:

Code: [Select]
bool StaticMapTree::InitMap(const std::string & fname, VMapManager2* vm)
{
bool success = true;
std::string fullname = iBasePath + fname;
FILE* rf = fopen(fullname.c_str(), "rb");
if(!rf)
return false;
else
{
char chunk[8];
//general info
if(!readChunk(rf, chunk, VMAP_MAGIC, 8)) success = false;
char tiled;
if(success && fread(&tiled, sizeof(char), 1, rf) != 1) success = false;
iIsTiled = (tiled != 0);
// Nodes
if(success && !readChunk(rf, chunk, "NODE", 4)) success = false;
if(success) success = iTree.readFromFile(rf);
if(success)
{
try
{
iNTreeValues = iTree.primCount();
iTreeValues = new ModelInstance[iNTreeValues];
}
catch(...)
{
printf("Caught fatal error!!! < MapTree.cpp, fname: %sn", fname.c_str());
printf("iNTreeValues = %dn", iTree.primCount());
return false;
}
}

if(success && !readChunk(rf, chunk, "GOBJ", 4)) success = false;
// global model spawns
// only non-tiled maps have them, and if so exactly one (so far at least...)
ModelSpawn spawn;
#ifdef VMAP_DEBUG
DEBUG_LOG("Map isTiled: %u", static_cast<G3D::uint32>(iIsTiled));
#endif
if(!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
{
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
if(model)
{
// assume that global model always is the first and only tree value (could be improved...)
iTreeValues[0] = ModelInstance(spawn, model);
iLoadedSpawns[0] = 1;
}
else
success = false;
}

fclose(rf);
}
return success;
}

It is difficult to reproduce but appears to occur when creatures try to move on these WMO's placed through Noggit.

Output from this function is:




Here is a link to the 000.vmtree: https://dl.dropboxusercontent.com/u/1102355/000.vmtree
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #12 on: July 26, 2013, 04:32:24 pm »
So the exception is a std::bad_alloc? Either RAM is full, or 97987 * sizeof (ModelInstance) > numeric_limits<size_t>::max(), which would be a huge ModelInstance.
Is there a ctor of ModelInstance that may throw?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #13 on: July 26, 2013, 04:40:13 pm »
Quote from: "schlumpf"
So the exception is a std::bad_alloc? Either RAM is full, or 97987 * sizeof (ModelInstance) > numeric_limits<size_t>::max(), which would be a huge ModelInstance.
Is there a ctor of ModelInstance that may throw?

RAM is not full, there is 8GB free. It was compiled in 32bit so can't use more than 2GB RAM (?) but the server never uses more than 600-800MB RAM.

ctor = constructor?

Code: [Select]
class ModelInstance: public ModelSpawn
{
public:
ModelInstance(): iModel(0) {}
ModelInstance(const ModelSpawn & spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray & pRay, float & pMaxDist, bool pStopAtFirstHit) const;
void intersectPoint(const G3D::Vector3 & p, AreaInfo & info) const;
bool GetLocationInfo(const G3D::Vector3 & p, LocationInfo & info) const;
bool GetLiquidLevel(const G3D::Vector3 & p, LocationInfo & info, float & liqHeight) const;
protected:
G3D::Matrix3 iInvRot;
float iInvScale;
WorldModel* iModel;

#ifdef MMAP_GENERATOR
public:
WorldModel* const getWorldModel();
#endif

Note MMAP_GENERATOR is not defined.

Constructor definition:

Code: [Select]
ModelInstance::ModelInstance(const ModelSpawn & spawn, WorldModel* model): ModelSpawn(spawn), iModel(model)
{
iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi() * iRot.y / 180.f, G3D::pi() * iRot.x / 180.f, G3D::pi() * iRot.z / 180.f).inverse();
iInvScale = 1.f / iScale;
}

It shouldn't be that big - these are just normal WMO's like caves or buildings.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] VMaps on Customized Maps
« Reply #14 on: July 26, 2013, 06:38:31 pm »
May you please check the type of exception thrown?
(catch (const std::exception& e) { std::cerr <<typeid (e).name() << ":" << e.what() ; }
« Last Edit: January 01, 1970, 01:00:00 am by Admin »