AI Libraries for Panda3D

Thank you for the reply.

I guess I will build 1.7.2 from source and make my changes to the PandaAI from inside the complete source package. I believe it should work.


ok so i just made a plane mesh to make the navmesh that is the same size as the obj i used before, that way it will still have the same paths, its on the z,x plane, same start point, still not using the eggtrans and now i get this error when trying to make the navmesh

Traceback (most recent call last):
  File "", line 297, in <module>
    app = MyApp()
  File "", line 50, in __init__
  File "", line 110, in createNewFullList
    if currentColNode.vertex[self.rightVertex] == self.oldList[i].vertex[self.lo
westVertex] and currentColNode.vertex[self.toprightVertex] == self.oldList[i].ve
AttributeError: MyApp instance has no attribute 'rightVertex'



Sorry for the delay, been swamped with stuff at work lately.

Which version of Blender are you using ?

Also, could you send me your files (Blender files), so I can test it at my end.

I too had Daocsm’s problem, even though the manual states that the blender mesh generation script assumes that your mesh is built on the X-y axis, it’s wrong.

Blender assumes X-left-right Y-forward-backward and Z-up-down, the test models provided with your script I think are technically facing along the X and Z axis.

Daocsm, rotating your model to be flat with blenders Y-facing camera will fix your problem (or at least it fixed my problem, which was the exact same error)
(by Y-facing camera I mean the num-1 camera)


Thanks for the info powerpup118.

Hi, I have a couple of questions regarding stuff I found while playing around with PandAI lib and pathfinding:

  1. It seems PandAI AIworld.update is tied to the framerate, not to the system clock. When testing on machine with approx. twice lower fps my characters move roughly twice slower. Is this true and are there any plans to change it?

  2. I have created a simple navmesh following the tutorial (create scene with some boxes, cut out parts underneath, save and generate) and it works pretty well except when my models are pathfinding around corners of boxes. It seems that they are walking over nodes which are flagged as non-traversible, and sometimes when they are there, and I change the destination (forcing path recalculation) the procedure prints “couldnt find source” and character gets stuck there. Any way this can be changed?

  3. Regarding my problem in this thread:[url]Packp3d and Pandai problem] - when packing script with packp3d I wanted to pack the generated navmesh.csv as well, but it seems that loading procedure in c++ does not see the file in Panda VFS. I have worked around it by saving the file on startup in multifileRoot dir and using absolute path to get it, but it would be nice if I could have all needed resources packed nicely into one file.

Thanks in advance on your comments!

Hi ofgnjenk,

  1. Yes, this is true. I don’t see any future changes taking place to PandAI unless I get more free time out to do it. If so, this would be the first thing I would change. You could control the update functions frequency yourself if you access the C++ code.

  2. This seems to be a bug with the navmesh creation (which is very finicky). If you were using Maya or Max and followed the tutorial steps correctly it should work. Try with a simple mesh first. Blender support was something we tacked on later but found it hard to keep up with the versioning as time did not permit. Some users as stated in the above posts have got it to work though.

  3. I am sorry, this is out of my expertise in Panda3D. Maybe post it as a separate thread and you would get more help.

Hope I helped a bit.

Hi NNair, thank you for the response.

ad1) This is really too bad, AI library is really excelent and has great potential, but this makes it usable only for showcase purposes. I understand it was a limited time effort and you guys did as much as you could and I really appreciate it. It’s been a while since I programmed in c++, I might just give it a go and try to change it myself :slight_smile:

ad2) I actually did create a very simple mesh (a straight plane and a couple of boxes) in 3ds, but I might have cut the navmesh a bit too wide under all the boxes - this is why I have dead space near the walls. I still wouldn’t expect my actors to get stuck there, as they shouldn’t be traversing this dead space anyway, however I can try editing my mesh a bit.


Wow I totally missed this post. I started having problems getting interrogate to work so I put my AI work on hold. Then life got busy; you know how it goes. The modified files are hereif you have any interest in them. My terrain engine is getting to a fairly functional state, so I do intend to get back to AI work at some point.

I’ve started a more thorough overhaul of the AI library. I totally replaced the physics. I created a new base class for all of the steering behaviors. I’ve also made a special container that can composite weighted steering objectives in a variety of ways, and is itself a steering objective so that they can nest. Its completely broken until I finish some more work, but I made my own repository for it. Anyone is welcome to peek at my changes or fork it and push some changes in.

In one day 786 lines of code added , 959 lines removed. :smiley:

Everything seems to compile now and I was ready to test a few things in my new ai system. Unfortunately interrogate fails and I haven’t a clue why.

The file couldn’t be much simpler.

#include "config_ai.cxx"
#include "aiWorld.cxx"
#include "aiCharacter.cxx"
#include "aiBehaviors.cxx"
#include "seek.cxx"
#include "flee.cxx"
#include "pursue.cxx"
#include "evade.cxx"
#include "flock.cxx"
#include "wander.cxx"
#include "pathFollow.cxx"
#include "obstacleAvoidance.cxx"
#include "pathFind.cxx"
#include "aiNode.cxx"
#include "aiPathFinder.cxx"
#include "meshNode.cxx"
#include "intercept.cxx"

Its saying the error is right at the first quotation mark of flee.cxx

That’s weird all right. Maybe something’s wrong inside seek.cxx, an unclosed brace or something, that makes everything get out of sync on the next line it encounters?


Thanks. That’s about all I could think of. I didn’t know if I was just missing the obvious. I’m messing around with the composite file and the .pp file. I’ll get it eventually.
edit: Well I added a few things and it exposed some compiler errors. :unamused:

I had the same problem as daocsm, i was able to fix with powerup118 solution, but then i got another error

Traceback (most recent call last): 
  File "C:\Users\Mateus\Desktop\BlenderMeshGen\pythonMeshGen\", line 308, in <module> 
    app = MyApp() 
  File "C:\Users\Mateus\Desktop\BlenderMeshGen\pythonMeshGen\", line 51, in __init__ 
  File "C:\Users\Mateus\Desktop\BlenderMeshGen\pythonMeshGen\", line 125, in createNewFullList 
    if currentColNode.vertex[self.rightVertex] == self.oldList[i].vertex[self.lowestVertex] and currentColNode.vertex[self.toprightVertex] == self.oldList[i].vertex[self.topVertex]: 
AttributeError: 'NoneType' object has no attribute 'vertex'

EDIT: I found out what I was doing wrong. I was exporting the plane with a cube in the middle. But now my problem is that the .csv file is only 1KB.

EDIT2: Now I’m back to the frist error, when I create the .eggs without rotating it says

MyApp instance has no attribute 'rightVertex'

and when I rotate

'NoneType' object has no attribute 'vertex'

The thing is that I can create a navmesh with your models, so I’m doing something realy wrong.

EDIT3: Ok… Using a grid I’m able to create a navmesh but when I run my code i get

couldnt find source
couldnt find destination

EDIT4: Well I kind of fixed it… I changed the nagavite values in the .cvs file, and now I think its working. Anyway if someone know why this happens tell me please :smiley:

Running the same error:

Traceback (most recent call last):
File “”, line 297, in
app = MyApp()
File “”, line 50, in init
File “”, line 110, in createNewFullList
if currentColNode.vertex[self.rightVertex] == self.oldList[i].vertex[self.lowestVertex] and currentColNode.vertex[se
= self.oldList[i].vertex[self.topVertex]:
AttributeError: ‘NoneType’ object has no attribute ‘vertex’

The scenario and the arena are translated, but not rotated… ideas?

AICharacter ( string model_name,
NodePath model_np,
double mass,
double movt_force,
double max_force

Can someone explain me what are mass and force attributes doing?

They are used to calculate the acceleration of the character. You know, a = F / m…

I started a thread with the objective of discuss about the possibility of continue the development of PandaAi, but, as rdb pointed out, it is better to beginning asking to the authors of the libraries. So, i inform here about this new thread: Continue the development of PandaAi? … 504#p93504

I imagine there’s nobody willing nor able to make some small improvments to the ai for 1.9?

My wishlist isn’t long, just a few changes to the API.

AIBehaviors.pathFindTo(target, type)
the target can be a node or a pos but the type can only be ‘addPath’ (a string).
This should be AIBehaviors.pathFindTo(target, addPath=False), True and False is all that is needed here.

There’s also one more problem with pathFindTo - if you pass a target that can’t be reached you will get a message in the console and that’s it. There’s no way to tell if this function failed to find a path, you can only ask about the ai status (but if the character was moving to another target all you can do is to check if the point where the character stoped is the point you wanted him to go to).
This function should return a list of nodes that lead to the target or an empty list if a path can’t be found.
This one change would solve 90% of the problems I have with the AI and allow to write custom movement code, evaluate movement cost, make turn based systems etc.

AIBehaviors.behaviorStatus() - this function takes a string and returns a string. It would be much better if there where some known constant ints not a set of hardcoded strings… as it is with any other p3d class.

AIWorld.update() - this would really be so much better if you could pass a delta time to scale the movement by current fps.

If I had any skills in C/C++, I’d make a patch myself, but I don’t have any :frowning:

Holy God, how much tech has advanced, I remember when I built an AI searcher for this website, I was on top of the world but now reading this thread I feel like there is a lot to learn.