pygame is
Simple DirectMedia Layer is
Site Swing

owyl - 0.3.0

David Eyk (eykd)



You have Pyglet. You've got Rabbyt. But who do your sprites go to for advice? Owyl, of course.


The goal of Owyl: provide a fast and flexible Behavior Tree framework implemented in python. Owyl trees use nested generators to iterate through your behaviors. The root of the tree always works just like a normal python iterator. If you know how to work with iterators, you know how to work with an Owyl tree. Because Owyl is small and behavior trees are easy to grasp, it's easy to control and extend your AI behaviors.

Trees as Iterators

Trees as iterators give you total control over how a behavior tree integrates with your code: use a for loop, a list comprehension, a generator expression, or manual calls to Run the tree one step, five, or fifty with every frame.


Writing new behaviors is simple and easy (and soon to be documented!). Any object that corresponds to python's iterator interface and a few simple rules for yielded values will work. Owyl's core behaviors are written as simple generator functions.

More Information

  • Owyl does not depend on any particular framework. You can use it with PyGame, pyglet, PyOpenGL, Panda3D, OGRE, TurboGears, Django, urwid, wxPython, PyQT, and probably 50 million other frameworks, as long as you have Python.
  • Owyl has been tested on python 2.5. It will probably work on 2.6. It most likely won't work on 2.4 (not without some jiggering). Please let me know if you have any trouble with it.
  • For more information on Behavior Trees, see these articles. Remember: AI isn't about math, it's about getting things done.
  • For more information on python generators, see this introduction to generators.

Questions? Comments?

Drop a line below, or bring your questions and comments to the Owyl discussion group.


Many improvements, enough to warrant version 0.3.

  • Working(!) boids example.
  • Child handling has now been pushed into parent behaviors.
    • Previously, children were only run once, and then re-instantiated on the next iteration (oops!).
    • Parent must call children before yielding them.
    • visit will call the root task of its tree.
  • Non-working decorators now work.
  • I think parallel is really working correctly now.
  • Tracebacks are totally not helpful right now.
    • Debugging is a pain in the neck.
    • This needs to be improved upon.
    • I have no idea how. Tracebacks seem to ignore time spent inside of generators.
    • Some sort of value-added generator-ified traceback may be in order.


Home Page:


click to view original size


owyl - 0.3.0 - Jan 15, 2009
owyl - 0.2.2 - Jan 8, 2009
owyl - 0.2.1 - Jan 5, 2009 account Comments

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

January 18, 2009 8:33pm - David Eyk - nickname: (eykd)
Chandler, thanks for the feedback. Owyl is still pretty young, and the example is very new, so I don't doubt it has some ways to go. I've checked in a new version of with more extensive documentation (read it at I'll probably make an 0.3.1 release soon, if I can put together a second example soon. Please visit the discussion group at if you have more questions or comments.
January 17, 2009 10:27pm - Chandler Armstrong - nickname: (omnirizon)
Hi there. this looks like nice work and a needed module. I have a concern however.

your example is buried beneath a ton of dependencies and minutia that many game authors may not be familiar with. they look into your module for a solution to a problem: AI. they go to your example for some insight, expecting just to see some bare minimum insight from which they feel they can get jump started. all they want is a simple hotdog to start digesting. your hotdog is simple enough, OK. however you've poured on a ton of fixins that they just can't quite stomach. savvy?

(PS. from xxx import xxx helps not at all either because that makes it even more difficult to see what is your module and what is some other dependency of your program that they are totally unconcerned with)

well that's all. I had some questions about the visitor pattern to vs. another strategy (hint), but i'm not all too familiar with any of it yet to be sure.
January 17, 2009 7:08pm - David Eyk - nickname: (eykd)
Adam, you can run the "Boids" flocking demo in examples/ There's not much else to run right now--it's a framework for developing game AI, not a game in itself.
January 16, 2009 2:24am - Adam Halley-Prinable - nickname: (magicaxis)
i cant figure out how to get this working! theres no "run" or 'start" or anything. halp!
January 12, 2009 5:32pm - David Eyk - nickname: (eykd)
Sorry for the confusion. Owyl is not dependent on any framework, and will work great with PyGame. The name is just from Rabbyt author Matthew Marshall's suggestion that python needs more game libraries following "A.A. Mylne" naming conventions. ;)
January 12, 2009 3:54am - Rene Dudfield - nickname: (illume)
cool :) I've always been interested in these... but never tried them out in a game.

ps. it's definitely ok for any python game or multimedia related stuff to be on the website. It'll be a todo item to make it more explicit that it's ok for everything.
January 10, 2009 2:07pm - Claudio Canepa - nickname: (claxo)
And, at the last two pyweeks there where pygame maintainers telling that pygame site is open for all python game related code, not only those using the pygame lib.
January 9, 2009 5:45pm - Joey Marshall - nickname: (joey101)
I don't think it is dependent on either pyglet or pygame. But if it were there is one possible explanation: there isn't anywhere else to publicize it :P
January 9, 2009 10:18am - pymike - nickname: (pymike)
I have to ask, if this is for pyglet, why is it on the pygame homepage?

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

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