UPBGE Navmesh for mazes

I am trying to make a simple game where you try to escape a maze while monsters chase you. The issue is, it seems that if I make the navmesh too complex, it stops working altogether. Even when it would be just a straight line from enemy to player, it still doesn’t even attempt to move. I tried using obstacle avoidance instead, but that also didn’t work as the enemy simply avoided a certain radius around the origin, not the actual walls of the maze.
Are there any solutions to this?

I am not very experienced in python programming, so I’ve been using logic nodes and bricks. I am working from linux, in case that makes a difference.

Here’s the .blend file for reference:
Maze_help.blend (1.6 MB)
The player is in the middle of the maze, the rat is the enemy. I have included two navmeshes, one without the maze included, that works and one that actually follows the maze, but doesn’t work.

I would be grateful for any advice!

when a ran you blend i got this on the console

Error: building NavMeshObject, can't find vertex in polygon

Error: can't build navigation mesh data for object: Navmesh

most likely another navmesh bug.

it does not, i am on Linux aswell.

I believe this same bug happened in UPBGE 0.24 and was fixed in UPBGE 0.25. Either the revert fix didn’t get merged into UPBGE 0.3 source or it’s a regression.

I’d suggest creating an issue at the UPBGE issue tracker.

Alright, guess I’ll do that. Thanks for the advice!

When you generate a navmesh using booleans you should add a subdivision simple (level 2 or 3) to the plane before to do the boolean diference with the maze.

Here is the navmesh fixed.
Maze_help_fixed.blend (1.5 MB)
And a video showing that navmesh navigation work well:

1 Like

Thanks, that works!
Additional information for people trying to solve this issue in the future:

  • The most important point here is the boolean. Instead of simply selecting the maze and the ground plane to calculate the navmesh by intersection, add a boolean modifier, select only the ground plane and calculate the navmesh by distance from edge. The subdivision surface is also important, but this is the main thing.
  • The rasterization cell size when creating the navmesh must not be too small. In my main scene this fix did not work until I set the rasterization cell size from 0.2 to 0.3
1 Like