AI Libraries for Panda3D

Return to Panda Features in Development

AI Libraries for Panda3D

Postby sorcus » Thu Aug 27, 2009 11:35 am

Currently , My team is working on making AI libraries for panda3d at Carnegie Mellon University. If we could get some input from you guys it would be highly helpful. Here is a list of stuff that we are looking at to do

-- Seek/Flee
-- Arrival/Leader Follow
-- Path Following
-- Wander
-- Queuing/Flocking
-- Obstacle Avoidance and some others

And Also we are looking at a navigation mesh/Pathfinding system as such. We would like the input of the community on this and also we want to know

-- If you have tried something in AI with panda3d, what are they?
-- Is there something you would like which is missing?
sorcus
 
Posts: 23
Joined: Thu Jun 04, 2009 1:31 pm
Location: ETC_Carnegie Mellon

Postby rdb » Thu Aug 27, 2009 11:39 am

Sounds very nice. Will it be implemented in C++ or Python?

You might also be interested to look at PandaSteer:
http://www.panda3d.org/phpbb2/viewtopic.php?t=2431
Though I'm not sure if its still being maintained.
rdb
 
Posts: 9299
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby birukoff » Thu Aug 27, 2009 12:10 pm

Indeed, PandaSteer has implemented several essential steering behaviors. But when I tried to implement my AI, that was not sufficient, and I found that for real-life use it makes more sense to implement some 'autonomous pedestrians' algorithms. As I remember, many of the geometry and trigonometry algorithms that are important for autonomous pedestrians are not yet implemented in Panda core; some of them I tried to recreate in Python (but, as you probably know, mathematics in Python is very inefficient unless you use Psyco): http://www.panda3d.org/phpbb2/viewtopic.php?t=5817
This includes: point-in-polygon tests, intersection tests, perp product (aka 2d cross product), and so on. These functions are very helpful for navmesh creation and navigation, checking whether an item is right/left/ahead/behind of another item and so on.
Pity I had no time to develop it further... :(
User avatar
birukoff
 
Posts: 424
Joined: Thu Nov 08, 2007 7:03 am
Location: Russia, Moscow

Postby sorcus » Thu Aug 27, 2009 12:16 pm

Ah, We are indeed implementing it in C++ and wrapping it up in python for the most part. And ya thanks for the link on pandasteer...
sorcus
 
Posts: 23
Joined: Thu Jun 04, 2009 1:31 pm
Location: ETC_Carnegie Mellon

Postby Hypnos » Thu Aug 27, 2009 1:10 pm

hello, that's a very interesting and deep topic, i've done some stuff in this direction and want to share my thoughts.

what i'd love to see implemented:

in my opinion a aStar with a grid or a node system would be the most important thing panda is missing. as it has already been mentioned python "sucks" at low levels, aStar makes a lot of such simple actions. if possible it should be run as thread. (something like: http://www.nouser.org/PMW/pmwiki.php/Portfolio/SparetimeAStar , if you want the code i can dig it out)

a very interesting part is pathfinding mesh generation. (http://www.ai-blog.net/archives/000152.html) , together with a good a-star this solves a lot of higher priority problems in AI.

queuing in aStar is a interesting topic as well. multiple actors navigating the same mesh without interferencing is quite hard to do afaik. (never really tried it myself)

things to consider when working on seek/flee/arrival/...:

while i've never tried it myself, i've read that "Potential Function-Based Movement" can do pretty much all of the movement styles you mentioned. The book "AI for Game Developers" from O'Reilly mentions this one after the flock algrithm.

another thing that has a big influence on the topics you want to cover is if you are going to do this in 0 grip (space game) or in earthlike motions. leader follow is quite a bit more complex (and interesting) in space then if you try following a human (you want to archive the same velocity vector, not the same position). while the "0-grip" method can easily be used for position archiving methods it's impossible the other way. i've implemented this in: http://www.nouser.org/PMW/pmwiki.php/Portfolio/BachelorEliteWars but the code may be not that good to read.

other topics:

fuzzy logic and neural networks are another big topic in ai. but neural networks dont seem to be the topic you want to cover. fuzzy logic however seems to be a possible way in behavior control of ai characters.

genetic algorithms are another interesting part, but it's quite easy to implement, it's more important to have good selection mechanisms. im using genetic algrithms in my current master project.

inverse kinematics could be viewed as some kind of pathfinding. a very interesting topic and cool if panda had this. i've seen some works that make ragdolls to behave human like (protecting the head while falling) that goes into a similar direction.

i already said this, but ai for game developers covers most of the topics you and i mentioned.
Hypnos
 
Posts: 585
Joined: Sat Sep 11, 2004 8:07 am
Location: Zürich, Switzerland

Postby sneftel » Thu Aug 27, 2009 2:07 pm

Navmesh-based pathfinding would be very, very nice, especially if the navmesh could come through the EGG pipeline.

The Boids-esque behaviors would be fun too, I suppose, but I personally would be best served in that respect by a simple 2D culling structure and neighborhood query. If you do do the Boids stuff, it'd be really nice if those were a layer over a well-exposed and documented culling structure.
sneftel
 
Posts: 28
Joined: Wed Aug 12, 2009 8:12 am

Postby zzajin » Thu Aug 27, 2009 9:17 pm

Recast and Detour are extremely impressive. They might be enough for generating navmeshes and pathfinding.

"They are both open source projects aiming to solve some path finding related problems. Recast is automatic navigation mesh generation toolkit and Detour is a runtime component which can be used to do some spatial queries and pathfinding on navmeshes. Basically you can throw any triangles mesh Recast and it will generate a mesh from that data which allows the AI to navigate in that environment using Detour.

By releasing Recast and Detour open source, I hope that people who usually do not have access to such technology can fullfill their crazy ideas as well as I hope the code can live up to high standards of other game developers and they could adopt it to be used in their games."


Blog
http://digestingduck.blogspot.com/

Google Group
http://groups.google.com/group/recastnavigation

This is the roadmap post
http://digestingduck.blogspot.com/2009/07/recast-and-detour-roadmap.html
Sounds like jump links and area annotations are next.
zzajin
 
Posts: 3
Joined: Mon Aug 24, 2009 3:17 pm

Postby jhouck » Fri Aug 28, 2009 4:07 am

My request is that no matter what you finally release, is that it's well documented... :)
User avatar
jhouck
 
Posts: 41
Joined: Sat Dec 11, 2004 2:03 pm
Location: Southern Idaho

Postby Bradamante » Thu Sep 03, 2009 12:42 pm

I would appreciate some Panda3D AI material to study. I am on a very simple level though. I've got 3D models in a space game, so zero gravity, and I don't really have an idea right now how to let AI ships move around convincingly, like let them land/attack/flee/group etc.
User avatar
Bradamante
 
Posts: 306
Joined: Tue Nov 25, 2008 10:58 am
Location: Leipzig, Germany

Postby barbeirovsk » Wed Sep 30, 2009 11:27 am

Some tool for neural network, and genetic algorithms would be nice.
barbeirovsk
 
Posts: 31
Joined: Fri Sep 19, 2008 5:36 pm
Location: São Paulo - Brasil

Postby sorcus » Thu Oct 01, 2009 12:09 pm

barbeirovsk wrote:Some tool for neural network, and genetic algorithms would be nice.


Hmm, Not sure what you mean by some tool. But neural networks and genetic algorithms are at the moment not on our plate.
sorcus
 
Posts: 23
Joined: Thu Jun 04, 2009 1:31 pm
Location: ETC_Carnegie Mellon

Postby Craig » Thu Oct 01, 2009 8:45 pm

I haven't really gotten into AI much, but I do have some thoughts about it.

Nav meshes seem like the best way to go for that kind of thing. I would love support for them. Be sure to have some way that various regions in the nav mesh can hav values assigned which can be checked against to determine which regions can be used (ex: let me set a heigh value so I can prevent tall things from going somewhere, or flag something as shallow water so some things cant go there). A set of named floats that would simply be compared to a corresponding set for the things moving around would do it. If the value on the AI element is higher than the corresponding values on the nav mesh region, the region is inaccessible.

Potentially, nav volumes could be useful, or maybe inverse volumes really (volumes you can't go to, like spheres around objects in space or what ever). Another approach to volumetric path information is a cube tree (oct tree). I'm not really sure if that would be useful though.


I have designed (but not implemented to the point of usability) an AI decision making system. I'll describe it here. You are welcome to use anything you want from my design.

The ideas is that there are abilities that the AI controls. Different urges compete for the control of the abilities through a prioritization system (a priority value is computed for each urge and scaled by a tuning weight value). Then lists of sets of compromising urges are evaluated (Ex: the flee urge can compromise with obstacle avoidance). These sets of compromising urges are basically modes or states (so I'll call them states). The sum of the priorities of all of the urges, each scaled by a corresponding weight specified in the state is evaluated, then scaled by the state weight. The mode with the highest final priority wins and becomes the dominate state, and thus the urges it contains are given control of the abilities.

I also designed my AI system to be hierarchical meaning that a squad AI would just be a normal AI that's abilities would be specifying some input values to its members which could be involved in the urge priorities and actions taken with the abilities.

I really don't see the actual priority computation and ability use code to be part of an AI framework, its more part of the game that uses the framework, and this is where neural networks and such might be useful.


I would also like to see any path finding/nav stuff pretty separate from what ever AI system get made to control NPCs and such. I would like to be able to use one without the other. For ease of use, the common RPG style case could be implemented as an example that uses both, rather than making pathfinding part of the AI, or the AI part of the pathfinding.
Craig
 
Posts: 330
Joined: Thu Jul 02, 2009 8:55 pm

Postby snaptothegrid » Sun Oct 11, 2009 10:42 am

well, nobody can make intelligent decisions without being aware of his environment, so a low level 'lines of sight' solution should be a nice thing to do i think.
snaptothegrid
 
Posts: 133
Joined: Tue Jun 03, 2008 6:14 am
Location: Tokyo Japan

Postby sorcus » Tue Nov 03, 2009 10:33 pm

Pandai v0.5 Now Available for Use!

Hello Everyone,

For the first half of our semester-long ETC project, our team has worked hard to create a collection of game A.I. steering behaviors for the Panda3D engine. We currently have developed seven steering behaviors (seek, flee, pursue, evade, arrival, wander, and flock) for this collection, all of which only require simple function calls in Python to work. Most of these behaviors can also work together simultaneously, and we have provided Python programmers with the ability to set behavior priority levels in these cases. We have packaged the seven steering behaviors along with the ability to combine them in the latest release of our framework, Pandai v0.5.

To access this latest version, please visit our TEAM WEBSITE and navigate to the “Download” page. There, you will find directions for installing Pandai v0.5 and instructions for how to use the various A.I. behaviors in your 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. 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.

Please email our team at pandai-support@googlegroups.com if you have any questions concerning Pandai v0.5 or our project in general. Also, please feel free to join our team's Google Group at http://groups.google.com/group/pandai-support in order to learn more about our project and gain access to instant updates on our progress.

We hope that you all enjoy the A.I. systems being offered in Pandai v0.5 and that they benefit your Panda3D projects! In the second half of our semester, we are working on adding a pathfinding system to this current collection of steering behaviors, so please keep an eye out for our next release. Thank you!

We would like to personally thank David and Pro-rsoft for helping out thus far!!
Last edited by sorcus on Tue Nov 03, 2009 11:06 pm, edited 3 times in total.
sorcus
 
Posts: 23
Joined: Thu Jun 04, 2009 1:31 pm
Location: ETC_Carnegie Mellon

Postby Craig » Tue Nov 03, 2009 10:42 pm

Sounds great. Now, can I have a link to this site?
Craig
 
Posts: 330
Joined: Thu Jul 02, 2009 8:55 pm

Postby MikeC » Wed Nov 04, 2009 7:31 am

The link is in the earlier message as "TEAM WEBSITE" -- spelled out, it is http://www.etc.cmu.edu/projects/pandai/. Please provide feedback to the CMU ETC Pandai team so that once Pandai 1.0 is released in December, it can be folded into Panda3D directly for the benefit of all. Thanks!
MikeC
 
Posts: 13
Joined: Tue Nov 04, 2008 9:25 am
Location: ETC, Carnegie Mellon University

Postby rdb » Wed Nov 04, 2009 8:26 am

Looks great, amazing job!

Here's a makefile for non-windows users. Simply adjust the paths at the top of the makefile, place it (with the name "Makefile") inside the "Code" directory of the source archive and hit "make install". If the compilation went well, you should be able to use it now.

Code: Select all
PANDA3D_INCDIR := /usr/include/panda3d/
PANDA3D_LIBDIR := /usr/lib/panda3d/
PANDA3D_LIBS   := -lpanda
PYTHON_VERSION := python2.6
PYTHON_INCDIR  := /usr/include/$(PYTHON_VERSION)

HEADERS := $(wildcard *.h)
OBJS := $(patsubst %.cxx, %.o, $(wildcard *.cxx)) pandaai_igate.o

all: libpandaai.so
pandaai_igate.cxx: $(HEADERS)
   interrogate -S$(PANDA3D_INCDIR)/parser-inc -I$(PANDA3D_INCDIR) -oc pandaai_igate.cxx -Dvolatile -Dmutable -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -fnames -string -refcount -assert -python-native -do-module -module libpandaai -library libpandaai $(HEADERS)
%.o: %.cxx
   g++ -c -o $@ $< -fPIC -I. -I$(PANDA3D_INCDIR) -I$(PYTHON_INCDIR)
libpandaai.so: $(OBJS)
   g++ -shared -o $@ $(OBJS) -L$(PANDA3D_LIBDIR) $(PANDA3D_LIBS)
clean:
   rm -f $(OBJS) pandaai_igate.cxx libpandaai.so
test: libpandaai.so
   $(PYTHON_VERSION) -c "import libpandaai"
install: libpandaai.so
   cp libpandaai.so /usr/local/lib/libpandaai.so
uninstall:
   rm /usr/local/lib/libpandaai.so
.PHONY: all test clean install uninstall


-- pro-rsoft
rdb
 
Posts: 9299
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby Hypnos » Wed Nov 04, 2009 1:03 pm

great, thanks for that lib, also thanks to pro-rsoft, i've managed to compile it under snow leopard using the makefile with some adations, maybe they are useful for someone else:

Code: Select all
PANDA3D_INCDIR := /Applications/Panda3d/1.7.0/include
PANDA3D_LIBDIR := /Applications/Panda3d/1.7.0/lib
PANDA3D_LIBS   := -lpanda
PYTHON_VERSION := python2.5
PYTHON_INCDIR  := /usr/include/$(PYTHON_VERSION)

HEADERS := $(wildcard *.h)
OBJS := $(patsubst %.cxx, %.o, $(wildcard *.cxx)) pandaai_igate.o

all: libpandaai.so
pandaai_igate.cxx: $(HEADERS)
   interrogate -S$(PANDA3D_INCDIR)/parser-inc -I$(PANDA3D_INCDIR) -oc pandaai_igate.cxx -Dvolatile -Dmutable -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -fnames -string -refcount -assert -python-native -do-module -module libpandaai -library libpandaai $(HEADERS)
%.o: %.cxx
   g++ -c -o $@ $< -fPIC -I. -arch i386 -I$(PANDA3D_INCDIR) -I$(PYTHON_INCDIR)
libpandaai.so: $(OBJS)
   g++ -shared -o $@ $(OBJS) -arch i386 -L$(PANDA3D_LIBDIR) $(PANDA3D_LIBS) -undefined dynamic_lookup
clean:
   rm -f $(OBJS) pandaai_igate.cxx libpandaai.so
test: libpandaai.so
   $(PYTHON_VERSION) -c "import libpandaai"
install: libpandaai.so
   cp libpandaai.so /usr/local/lib/libpandaai.so
uninstall:
   rm /usr/local/lib/libpandaai.so
.PHONY: all test clean install uninstall


i havent yet had the time to really test it.

edit: the "Seek and Flee Egg Demo" works fine
Hypnos
 
Posts: 585
Joined: Sat Sep 11, 2004 8:07 am
Location: Zürich, Switzerland

great stuff

Postby radu » Fri Nov 06, 2009 2:59 pm

great stuff people. very nice work.

For now i've just been browsing through your project pages but I will soon get to test everything.
Apart from the downloads you've already provided, it would be great if you would make available the sources used when creating all those demo movies.
Will follow on this closely and I am looking forward to the 1.0 version.
User avatar
radu
 
Posts: 150
Joined: Fri Nov 06, 2009 11:09 am
Location: Bucharest

Postby NNair » Mon Nov 09, 2009 2:40 pm

Hi radu,

We have some demo code in the Downloads page for the 0.5 version. This is the code for the EGG's seek and flee video on the Gallery page. The AI aspect of the demos have been explained in detail in the Download page.

If you are still having trouble with any of our AI, do let us know and we will provide you with assistance (via a code sample or by replying on the forum).

Cheers,
Team Pandai
Srinavin Nair
PandAI,
Entertainment Technology Center,
Carnegie Mellon
NNair
 
Posts: 126
Joined: Thu Aug 27, 2009 3:38 pm
Location: ETC - Carnegie Mellon

Postby NNair » Mon Nov 09, 2009 2:42 pm

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

http://www.etc.cmu.edu/projects/pandai/Download.html
Srinavin Nair
PandAI,
Entertainment Technology Center,
Carnegie Mellon
NNair
 
Posts: 126
Joined: Thu Aug 27, 2009 3:38 pm
Location: ETC - Carnegie Mellon

Postby wezu » Sun Nov 29, 2009 9:20 am

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

Code: Select all
C:\>BuildDLL.bat

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\jGenPyCode.py", line 74, in <module>
    from direct.ffi import DoGenPyCode
  File "C:\Panda3D-1.6.2\direct\ffi\DoGenPyCode.py", line 11, in <module>
    from direct.ffi import FFIConstants
  File "C:\Panda3D-1.6.2\direct\ffi\FFIConstants.py", line 3, in <module>
    from direct.directnotify.DirectNotifyGlobal import *
  File "C:\Panda3D-1.6.2\direct\directnotify\DirectNotifyGlobal.py", line 3, in
<module>
    import DirectNotify
  File "C:\Panda3D-1.6.2\direct\directnotify\DirectNotify.py", line 5, in <modul
e>
    import Notifier
  File "C:\Panda3D-1.6.2\direct\directnotify\Notifier.py", line 6, in <module>
    from direct.showbase import PythonUtil
  File "C:\Panda3D-1.6.2\direct\showbase\PythonUtil.py", line 47, in <module>
    import new
  File "C:\Panda3D-1.6.2\new.py", line 18, in <module>
    import direct.directbase.DirectStart
  File "C:\Panda3D-1.6.2\direct\directbase\DirectStart.py", line 3, in <module>
    from direct.showbase import ShowBase
  File "C:\Panda3D-1.6.2\direct\showbase\ShowBase.py", line 10, in <module>
    from pandac.PandaModules import *
  File "C:\Panda3D-1.6.2\pandac\PandaModules.py", line 5, in <module>
    from libp3directModules import *
  File "C:\Panda3D-1.6.2\pandac\libp3directModules.py", line 15, in <module>
    from direct.directnotify.DirectNotifyGlobal import directNotify
ImportError: cannot import name directNotify

C:\>


What am I missing?
I may be totally wrong, cause I'm a dancin' fool.

NameError: global name 'elf' is not defined
User avatar
wezu
 
Posts: 651
Joined: Tue May 19, 2009 1:03 pm

Postby NNair » Sun Nov 29, 2009 2:08 pm

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

This would probably be:

C:\Panda3D-1.6.2\bin

if you haven't moved it anywhere.

Try rerunning BuildDLL after this.
Srinavin Nair
PandAI,
Entertainment Technology Center,
Carnegie Mellon
NNair
 
Posts: 126
Joined: Thu Aug 27, 2009 3:38 pm
Location: ETC - Carnegie Mellon

Postby wezu » Mon Nov 30, 2009 6:16 am

I have them both in C:\Panda3D-1.6.2\bin and C:\Panda3D-1.6.2 is where panda is installed :cry:
I may be totally wrong, cause I'm a dancin' fool.

NameError: global name 'elf' is not defined
User avatar
wezu
 
Posts: 651
Joined: Tue May 19, 2009 1:03 pm

Postby JohnKol » Mon Nov 30, 2009 2:06 pm

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!
John Kolencheryl

Project PandAI
Entertainment Technology Center
Carnegie Mellon
JohnKol
 
Posts: 35
Joined: Thu Aug 27, 2009 3:40 pm
Location: ETC, Carnegie Mellon University

Postby NNair » Mon Nov 30, 2009 2:19 pm

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.
Srinavin Nair
PandAI,
Entertainment Technology Center,
Carnegie Mellon
NNair
 
Posts: 126
Joined: Thu Aug 27, 2009 3:38 pm
Location: ETC - Carnegie Mellon

Postby wezu » Tue Dec 01, 2009 3:45 am

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).
I may be totally wrong, cause I'm a dancin' fool.

NameError: global name 'elf' is not defined
User avatar
wezu
 
Posts: 651
Joined: Tue May 19, 2009 1:03 pm

Postby sorcus » Tue Dec 01, 2009 3:48 pm

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?
sorcus
 
Posts: 23
Joined: Thu Jun 04, 2009 1:31 pm
Location: ETC_Carnegie Mellon

Postby NNair » Wed Dec 02, 2009 12:31 am

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.
Srinavin Nair
PandAI,
Entertainment Technology Center,
Carnegie Mellon
NNair
 
Posts: 126
Joined: Thu Aug 27, 2009 3:38 pm
Location: ETC - Carnegie Mellon

Postby rdb » Wed Dec 02, 2009 1:48 am

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.
rdb
 
Posts: 9299
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Next

Return to Panda Features in Development

Who is online

Users browsing this forum: No registered users and 1 guest