Jump to content

Pathfinding


gamecreator
 Share

Recommended Posts

I'm working on pathfinding and my character often doesn't take direct routes to the target (shown here as a red circle), even though the floor is generated from a completely flat plane (minus the middle column).

 

 

As you can see it takes the long way around the left and right side of the middle column even though it can clearly go through those areas. This may have to do with bad path weighting but I don't know.

 

Is there a way to force the goblin to always cut the direct path?

 

This is the shape/navmesh code, if it helps:

 

 // Set ground navigation shape
shape = Shape::Box(0, 0, 0, 0, 0, 0, 28, 16, -0.1);
room->SetShape(shape);
shape->Release();
room->SetNavigationMode(true);

// Set column navigation shape
column1=Model::Load("Models/column1.mdl");
shape = Shape::Box(0, 0, 0, 0, 0, 0, 0.3, 0.3, 4);
column1->SetShape(shape);
shape->Release();
column1->SetNavigationMode(true);

world->BuildNavMesh();

Link to comment
Share on other sites

I would ask this on the Recast Google Group:

https://groups.google.com/forum/#!forum/recastnavigation

 

There are optional parameters in the navmesh build dialog, but I must confess I don't know the details of how this code works. It looks to me like maybe the AI finds a path that goes through fewer polygons, so it thinks that it the shorter route. I've always attributed this kind of behavior to them having minds of their own and not always acting the way you expect.

 

You also might want to mess with the acceleration value to stop that rubber-banding behavior.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I don't have much more control over Detour (the pathfinding library) than you do. I just use the commands it provides, and it finds the path. That's why I'm saying to ask Mikko for an explanation, he will know much better than I.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Just squares.

Thats interesting to me because your development video that shows the navmesh generation was essentially squares but when I got LE3.2, the navmeshes were like your picture above. Its like something was lost or corrupted between then and now. Also, it seems the dynamic navmesh generation was removed (or apparently only available to c++).

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

The dynamic stuff stopped being practical when world sizes got bigger.

That is understandable - if everyone that uses LE was trying to create large terrain scenes, but there are plenty of people that are making corridor shooters or small CSG maps that this would be a useful feature. Seems like that could have been left in but with a warning on usage.

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

The dynamic stuff stopped being practical when world sizes got bigger.

 

Wait, so it means there is no way to regenerate the navmesh in real time? Oh boy, I thought things like dynamic boxes and debris will obstruct enemies automatically.

 

[Edit]

 

After watching this video it feels like we moved backwards at least in terms of AI path-finding sad.png

 

 

I also like how the nav-mesh layer is semi-transparent. Easier to debug that way.

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

Wait, so it means there is no way to regenerate the navmesh in real time? Oh boy, I thought things like dynamic boxes and debris will obstruct enemies automatically.

This is a mixed bag. You can call BuildNavMesh any time but it's too slow to use on large levels. I'm not clear how obstruction works but I think anything put in the way of a character stops it (going from the gate in Rick's videos) or pushes it.

Link to comment
Share on other sites

This is a mixed bag. You can call BuildNavMesh any time but it's too slow to use on large levels. I'm not clear how obstruction works but I think anything put in the way of a character stops it (going from the gate in Rick's videos) or pushes it.

Well thats the issue - the navmesh building in the video I posted said he was using multithreading so I assume that would help remove the lag you would encounter by calling BuildNavMesh(). And there is a difference between the character not being able to move forward because something is in its way (which is what we have now) and that character finding a new path to its destination because the navmesh was dynamically rebuilt to incorporate an obstruction (which is what the video shows above).

  • Upvote 2

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

The proper way to manage this is to make a system for static and dynamic geometry. The static geometry data can be cached, so that rebuilding a tile doesn't require rebuilding the entire geometry. This will come in time, but it's not high priority right now. I only know of one game on the Workshop that's even using pathfinding right now.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The proper way to manage this is to make a system for static and dynamic geometry. The static geometry data can be cached, so that rebuilding a tile doesn't require rebuilding the entire geometry. This will come in time, but it's not high priority right now. I only know of one game on the Workshop that's even using pathfinding right now.

 

Good to know it is planned, however, is there a way to 'thumbs-down' a post? smile.png

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

2 or 3 more, none that can be played right now. I don't think not having enough pathfinding features is a big bottleneck right now.

 

The way I make decisions is to look for the thing I can do with the least effort that will result in the most amount of games being made.

 

I consider Workshop games (or published games) the most valuable because they can be played here and now today.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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...