pygame is
Simple DirectMedia Layer is
Site Swing

pyGOAP - .3

Leif Theden (bitcraft)



goap is: Goal Oriented Action Planning

goap tries to make virtual character come alive through planning. behaviors are programmed, but they don't have to be explicitly linked. action planning is done at run time using the a*star pathfinding algorithm.

A more useful introduction

pyGOAP v.4

The main concept of GOAP is that AI is not a static table or set of states. Rather, GOAP uses a A* like search to find solutions to goals at runtime. This frees the designer of setting up complex behavior trees.

There is a test called It more-or-less test/demos the GOAP library. You should be able to run the pirate demo and watch how he satisfies his goal: getting drunk.

Check out the source comments and also the tutorial.



New Version!

New changes bring new possibilities.  Actions and goals can now be generated and modified at runtime.  Because of this, the planner is much more flexible and able to handle more situations.

This is a simple map that shows where the objects are in the environment, although there needs a lot of work to get it to be more meaningful.

I am releasing this now, although it is not finished.  Planning works pretty well, but the actions are not complete.  If you are interested in this project, please send me an email at leif.theden [at]

Feel free to run the simulation and read the output.  Many of the modules can output more debugging information by changing DEBUG to 1 at the top of the module.


Home Page:


click to view original size


pyGOAP - .4 - Apr 23, 2013
pyGOAP - .3 - Jan 19, 2012
pyGOAP - .2 - Jun 7, 2011
pyGOAP - .1 - Feb 11, 2010 account Comments

If you wish to leave a comment with your account, please sign in first.

December 21, 2011 12:27pm - Leif Theden - nickname: (bitcraft)
@saluk that is an interesting test case. the ability to repeat actions over and over, like dancing for money, is a new feature i've added. i can tell why the agent chooses to dance first, because it is fewer steps than going to get loot, which can take many steps. it is obviously not weighing the time spent doing one action over and over again. <br><br>i made some comments in the source about heuristics in the tree search that said that they are not used during the search. it wouldn't be a difficult thing to add, but i've got some ideas about the tree search that would require a rewrite of the actions.csv file and i've just put that off until i get the rest of it together. i will take that into consideration as on the next release. it's a small pet project, and i don't work on it often. thanks for the interest and the feedback; it means a lot!
June 21, 2011 3:14am - patrick mullen - nickname: (saluk)
Why can the pirate not seem to go do the third thing a pirate does, get loot? If I make dancing give him a small amount, and looting give a high amount, he dances a whole bunch and never goes looting. I can't seem to change any of the values to make him go looting instead of dancing. If I take away the dance, he figures he can't drink or get laid so idles the whole time. Is there more to the example than just the actions.csv? Seems like a pirate should be more interested in sailing for phat lewt than dancing for chump change :)
June 8, 2011 7:36am - Ken Lauer - nickname: (kne)
I like the concept a lot. Good job.
February 11, 2010 10:05pm - Nathan Franck - nickname: (font)
It'd be cool to see some sort of graphical simulation... I'd be up for that!

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
May 29, 2016

May 27, 2016

May 21, 2016

May 18, 2016

May 1, 2016

Mar 27, 2016

Mar 26, 2016

Mar 22, 2016

Mar 19, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)