Jump to content

InfiniteViewRange / NavMesh Issues


gamecreator
 Share

Recommended Posts

The below code works fine.  It shows a debug nav mesh.  However, if you uncomment the SetViewRange line, the nav mesh no longer shows.  I don't know if it no longer generates or if SetDebugNavigationMode just doesn't display nav meshes for InfiniteViewRange objects.  I also don't know if SetDebugNavigationMode is an official function (that's why I didn't put this in the bug forum).  It's not documented but this example uses it anyway: https://www.leadwerks.com/learn?page=Tutorials_Lua-Scripting_Introduction-to-Lua

So at least a heads up for Josh.  Maybe it's an easy fix or I'm doing something wrong.

Model *tempfloornavmesh;
tempfloornavmesh = Model::Box(50, 1, 50);
tempfloornavmesh->SetPosition(0, -0.2, 0, true);
tempfloornavmesh->SetColor(1.0, 1.0, 0.0);
//	tempfloornavmesh->SetViewRange(Entity::InfiniteViewRange);  //  Anything lower will make things disappear

Shape* shape = Shape::Box(0, 0, 0, 0, 0, 0, 50, 1, 50);
tempfloornavmesh->SetShape(shape);
shape->Release();

tempfloornavmesh->SetNavigationMode(true);

camera->SetDebugNavigationMode(true);
world->BuildNavMesh();

Spent quite a bit of time trying to figure out what was wrong.  :(

Link to comment
Share on other sites

7 minutes ago, Josh said:

Try World->SetSize() to increase size of world.

Was going to suggest this as it was available in LE2, but I didn't see it in lua or the documentation so I was unsure if it existed anymore. Can we please get this exposed to lua?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

13 minutes ago, gamecreator said:

world->SetSize(4096) worked for me though the navmesh generation is now about 30+ seconds with 1 pillar per room (for 100 rooms).  Not a problem so far with doing the generation at the start of the game.

Are you creating worlds that large? If they are about the same size as shown in your pictures then a world size of 1024x1024 should be enough.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

SetWorldSize is doing something weird.  Without it (or if I use it and specify the default 1024 size), the navmesh on the left is generated.  If I specify a larger size, it takes significantly longer and it generates a mesh that looks like the one on the right.  That's all that is changed but maybe Leadwerks is changing other factors/defaults as well internally.  I haven't tried changing the BuildNavMesh parameters yet so I'll play with that next.

macklebee, I'll give you a detailed answer with some screenshots in a few minutes but the short answer is yes an no.  ;)

navmesh.jpg

Link to comment
Share on other sites

Right now, each room is 60 units wide and 40 high to accommodate a character that's the standard 1.8 meters high.  It's not a big room and I was hoping for bigger, and for different shapes other than a rectangle.

1.thumb.jpg.65b76a68bebb605a86105048512e3728.jpg

There's a space of 20 units between rooms to the right and 40 above, just some arbitrary numbers for testing.  So every 80 right or up, there's space for a new room.  So if a 100 room dungeon is generated in a perfect square (which will never happen), that's 800x800 (10x10 grid) plus the height and width of the last room.  The plan was to make it multiplayer and a host running the simulations for each room there's a player in but the players shouldn't see any other rooms ...

3.thumb.jpg.94a1dc34e2f5de21bb35909c612aea79.jpg

... so I was gonna spread the rooms out further but I think I'm going to need to either cover up the rooms somehow with some blocker or show/hide the other rooms with players in them and everything else in them every frame.  Probably not a big deal but this would have been much easier if I could just spread out the rooms more (though people with dual or more monitor setups might still end up seeing them anyway so hiding the other rooms some way is probably for the best, if show/hide isn't too expensive).

And the reason I gave you a yes and no answer above is because for simplicity's sake I'm cheating.  The rooms generate only in the positive space and even then, I start the first room to branch off of at about 800, 800 so that rooms can branch in any direction and still stay in the positive space to be represented easier in an array.  In this I can definitely improve the program.  I can just start at 0,0 and branch in any direction from there but represent the rooms in an array with an offset.  That should help a ton.

So, some insight into the madness.  I'll keep at it but some interesting bumps along the road.  Thank you for the help.

Edit: thinking about it further, I can keep doing the array as I've been doing and just offset the model positions so that the middle of the array positions the room at 0,0,0 in global space.  Not hard at all.

Link to comment
Share on other sites

Any thoughts about why a larger world->SetSize would the increase the minimum distance from the pillar?  I've tried all sorts of BuildNavMesh numbers (maxedgelength and maxedgeerror) up and down and nothing gets closer.  I even tried to seriously reduce the shape size but that didn't help either (i.e. Shape::Box(0,0,0, 0,0,0, 0.002,2.0,0.002)).

navmesh.jpg

 

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...