PandAi , Blender , Navmesh , and Pathfinding

I am part of an open source team that is using Panda3D and Blender to develop an RPG game. I am heading the Ai part of the game and we are only in the earliest stages of development (more so planning and figuring out Panda3D!)

I have been swimming through these forums for the past week or so trying to find some solid info on how to use the built in PandAi library. I have found both good and bad information scattered throughout about it . I was hoping to start up a discussion that involves people who have really gotten to know PandAi and maybe even extended it with third-party solutions.

I plan on posting my code as soon as I clean it up and document it a little better.

My biggest problem right now, is that I have yet to successfully create a navmesh.csv. I am trying to figure out how I can plug Roaming-Ralph’s world into the navmesh generator. I am having difficulty discerning what exactly is the difference between a fullmesh and a collmesh.

Things I would like to discuss:

  • Creating a navmesh from an environment created in Blender
  • Methods of combining pathfinding and steering behaviors
  • Sharing examples of any work that uses PandAi succesfully
  • Possibly extending PandAi with third-party programs such as Recast and Detour

Where I am at right now with it:

  • I have an NPC class that creates an “NPC” and contains state switching functions

  • All of my NPC’s are capable of traversing uneven terrain

  • I have a Mob class that creates N amount of N type of NPC’s and has a groupLogic loop that loops through checking various conditions to switch all “Mob Members” behaviors accordingly

  • I have the flock function working, but by no means mastered.

  • I have the behavior switching figured out enough to “Pause” and “Resume” behaviors dependent on a number of variables such as Agent’s distance from “Hero” (Hero being user controlled character) and Agent’s distance from spawn point.

  • I have yet to successfully create a navmesh.csv file. So I have been unable to do any actual pathfinding yet. I am completely new to blender!

  • I have downloaded Recast/Detour and am in the process of trying to figure out how to use those in conjunction with Blender and Panda3D to generate a navmesh etc…

Are you using the Navmesh generator linked in the Manual for Blender? That one is broken. It doesn’t even work if your navmesh object is on the x,y grid (which it should be). You have to rotate your object to the x,z grid (unless your world is sideways, that’s wrong).

Then there’s an error that says, trouble reading csv file when running your app.

@markjacksonguy So should I use only the 3ds max exporter?

What is the correct way of using pathfinding?

Thanks :slight_smile:

Hi guys I figured out how to combine Blender and BlenderMeshGen.py to have a working path finding using PandaAI. BlenderMeshGen.py obtained from the Panda3D manual comes with example blender files of a navmesh. On the other hand, I downloaded the example code from the Static Obstacles section in the PathFinding section of the manual. This one was shipped with a navmesh.py and the example works. When I try to implement BlenderMeshGen, it threw out the couple of complaints “Corrupt data” and “source|destiny not found”. Exploring Panda3D c++ sources I came out with a (hope so) solution. BlenderMeshGen renders a navmesh with NULL nodes in the form: “1,0,0,0,…” which throws the “Corrupted data” error because that’s not an expected pattern; It should be “1,1,…” (BlenderMeshGen.py:161,192). The other error “source|destiny not found” is thrown because the fields in navmesh regarding Witdh and Length are negative! The vertices order are different between the navmeshes in one of the mentioned codes and the other. I just abs()'ed the operation and dissapeared (BlenderMeshGen.py:180,182,203,205). It works now.
My proj: github.com/fnadalt/run4life. There’s the modified BlendepMeshGen.py.

I am new to all of this but while researching I found this old tutorial on how to use Blender to find objects (nodes) on a field using logic bricks in Blender. I know that a lot of AI in games uses such path nodes to avoid getting stuck. Other AI use algorithms for path-finding, such as Dijkstra’s algorithm.

Doing any maze a simple “Karel the Robot” style program can be made to keep left through out the maze, but they can and do get stuck just clinging on the walls. Nodes don’t need to be seen by the player just the AI, so there is no 3D model needed to support a node. Without path nodes on corners, games like GTA would have the pedestrians trying to walk through buildings and other solid objects to reach a sidewalk.

However you devise the robot, it can still fail due to lack of human concepts.