AI Libraries for Panda3D

Also, for anyone interested, the C++ source code for Pandai version 0.5 is also available at:

I’m having some problems building the library. Downloaded, unziped, run BuildDLL.bat, and this is what I got:


C:\>genpycode libpandaai
DirectStart: Starting the game.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Panda3D-1.6.2\direct\ffi\", line 74, in <module>
    from direct.ffi import DoGenPyCode
  File "C:\Panda3D-1.6.2\direct\ffi\", line 11, in <module>
    from direct.ffi import FFIConstants
  File "C:\Panda3D-1.6.2\direct\ffi\", line 3, in <module>
    from direct.directnotify.DirectNotifyGlobal import *
  File "C:\Panda3D-1.6.2\direct\directnotify\", line 3, in
    import DirectNotify
  File "C:\Panda3D-1.6.2\direct\directnotify\", line 5, in <modul
    import Notifier
  File "C:\Panda3D-1.6.2\direct\directnotify\", line 6, in <module>
    from direct.showbase import PythonUtil
  File "C:\Panda3D-1.6.2\direct\showbase\", line 47, in <module>
    import new
  File "C:\Panda3D-1.6.2\", line 18, in <module>
    import direct.directbase.DirectStart
  File "C:\Panda3D-1.6.2\direct\directbase\", line 3, in <module>
    from direct.showbase import ShowBase
  File "C:\Panda3D-1.6.2\direct\showbase\", line 10, in <module>
    from pandac.PandaModules import *
  File "C:\Panda3D-1.6.2\pandac\", line 5, in <module>
    from libp3directModules import *
  File "C:\Panda3D-1.6.2\pandac\", line 15, in <module>
    from direct.directnotify.DirectNotifyGlobal import directNotify
ImportError: cannot import name directNotify


What am I missing?

Did you put the libpandaai.dll and BuildDLL in your \bin folder in your copy of Panda3D?

This would probably be:


if you haven’t moved it anywhere.

Try rerunning BuildDLL after this.

I have them both in C:\Panda3D-1.6.2\bin and C:\Panda3D-1.6.2 is where panda is installed :cry:

Hmmm…do you have any other versions of Panda3d installed? Also if you could give information about the environment (eg: OS, Python version, system config etc.) you are running Panda3d in, it would be helpful. Thanks!

Also, do you have Maya installed in your machine? I know sometimes there is a cg.dll conflict which messed things up during the building of the dll.

I don’t have any other version of panda installed, I’m running on Windows XP Home SP3 (2002 edition), Python 2.5.2 (shipped with panda). I don’t have Maya (I did have the PLE edition at some point on this machine, but it’s un-installed now).

Hmm, The best solution at the moment is to uninstall Panda3d and related and then re-install 1.6.2. If it’s not too much trouble can you do that and let us know?

We will try and replicate your error on our machines and see if we can figure it out. We have tested this on multiple machines and this is the first time we have noticed a failure in genpycode by our code.

Could you also try: genpycode libpanda and see if that gives any error.

On a sidenote, is the genpycode call really necessary? It will only allow you to import pandaai modules from pandac.PandaModules.

If you rename libpandaai.dll into libpandaai.pyd you should be able to
import it directly like “import libpandaai”, without having to invoke genpycode.

Yes. That should work. We were only using the BuildDLL step just to make it easier for the user(to avoid the renaming step). Try this method too and let us know if it works.

I think there must be something wrong with my installation, I’ll do a un-install-re-install.

genpycode libpanda gave me this:

renaming libpandaai.dll into libpandaai.pyd gave me this when trying to run the Flee demo:

That seems to be a Python version conflict. Try running with ppython instead of python. (and remove libpandaai.pyc)

ppython is python 2.5 - this was the problem before, was it?

No, Python 2.5 is right.


I don’t know what is the difference between python and ppython but it doesn’t make a difference…

Reinstalling did solve my problem.

[size=150]Pandai v1.0 is Now Available![/size]

This final release represents the culmination of our semester-long project, aimed at creating a collection of game A.I. systems for the Panda3D engine. It includes the following nine steering behaviors along with a pathfinding system:

1- Seek
2- Flee
3- Pursue
4- Evade
5- Arrival
6- Wander
7- Flock
8- Obstacle Avoidance
9- Path Follow
• Navigation-mesh-generation tool and Pathfinding system

To access this final version, please visit our TEAM WEBSITE and navigate to the “Download” page, where you will find directions for installing Pandai v1.0 and instructions for how to use the various A.I. functions in your own code. If you would like to read descriptions about each of the steering behaviors and view some simple demonstrations, please navigate to the “AI Types” page. If you would like to learn about pathfinding and navigation mesh creation, please go to the “Pathfinding” page. Finally, if you want to see examples of some of the A.I. behaviors from this collection working in Panda3D projects, please visit our site’s “Gallery” page.

We hope that all of your Panda3D projects will benefit from this collection of A.I. behaviors! Please post to this forum if you have any questions concerning Pandai v1.0, and someone from our team will provide an answer as soon as possible. Thank you!

Also, our source code is going into the Panda3D CVS trunk, so we are happy to announce that this A.I. collection is expected to be integrated into Panda3D with the release of v1.7.

We would like to personally thank David and rdb for helping us out with this project!!

I haven’t tried the code yet, but I want to give many thanks to all involved in this project. It will definitely make my development life easier.

Just a few questions.

Looking at the videos I’ve heard that the resulting navigation mesh is actually 2d, because there’s no height for the nodes. So my question is, is it possible with this system to make a character navigate through multiple floors connected with, for example, stairs?

Another question comes out of curiosity and is about Recast and Detour. As far as I can see, this system is not based on those solutions, even though I remember you were going to do research on them. Why have you decided to develop your own system instead of using those?

Thanks again guys for your work. :slight_smile:

Cool. Thanks.

Yes the navigation mesh is 2d for now. It is possible to make a character refer multiple meshes by switching from one mesh to another. For example: Have a different navigation mesh for each plane. Stairs is a harder problem which we didn’t have time to implement and I guess it would need the nodes to keep track of height. You might be able to do it through scripting but we haven’t tried it yet.

Recast and Detour:

We did research Recast and Detour but since this was a semester project where we had to implement both steering behaviors and path finding, we had to opt for the more simplistic solution of navigation mesh creation by the artist. Our aim was to get a working path finding system integrated into Panda3D by then end of our project. Also, in order to integrate Recast and Detour into Panda3D, we would have had to thoroughly understand the intricacies of his code and the challenge of wrapping his code base into python. This would have been time consuming.

We are glad you like the work we have done and please feel free to contact us if you have any doubts about our framework.