Code Monkey home page Code Monkey logo

owyl's Introduction

=================
 Welcome to Owyl!
=================

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


Goals
=====

The goal of Owyl: provide a fast and flexible Behavior Tree library
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 tree.next(). Run the tree one
step, five, or fifty with every frame.


Extending
=========

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
================

For more information on Behavior Trees, see
[http://aigamedev.com/hierarchical-logic these articles]. Remember: AI
isn't about math, it's about getting things done.

Owyl has been tested on python 2.5. It will probably work on 2.6. It
definitely WILL NOT work on 2.4 without adaptation. Please let me know
if you have any trouble with it.

David Eyk
[email protected]


Installation
============

See INSTALL.


Documentation
=============

API documentation can be found at <http://worlds.eykd.net/owyl/api/>.

For more information about Owyl, please visit the project site at
<http://code.google.com/p/owyl/>.


Problems? Questions?
====================

If you run into trouble, or have a question, visit the discussion
group at <http://groups.google.com/group/owyl-discuss/>.


owyl's People

Contributors

linas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

owyl's Issues

AsyncIO compatibility

Running an Owyl tree and something else concurrently in the same application is only possible with threading right now.

There is a safer and more modern alternative - asyncio, which is in the standard library. Lots of libraries are already compatible with it. This can also be a good time to upgrade Owyl to Python3.

It helps a lot that Asyncio's code patterns are very similar to Owyl's:

@owyl.parent_task
def sequence(*children, **kwargs):
    final_value = True
    for child in children:
        result = yield child(**kwargs)
        if not result and result is not None:
            final_value = False
            break
    yield final_value

@asyncio.coroutine
def sequence(*children, **kwargs):
    for coroutine in children:
        result = yield from coroutine(**kwargs)
        if not result:
            return False
    return True

Sequences and selectors leak child values

The #2 PR appears to have dredged up a bunch of problems. In mucking around with parallel I've realized that sequence and selector leak child return values:

        tree = owyl.sequence(owyl.succeed(),
                             owyl.succeed(),
                             owyl.fail(),
                             owyl.succeed())
        v = owyl.visit(tree)

        results = [x for x in v if x is not None]
        self.assertEqual(results, [True, True, False, False])

See how the succeed()/succeed()/fail() leaks out to the results? The first three results are from the sequence children, while the 4th result is the sequence itself failing.

It's been a few years since I designed this library, but I can't think for the life of me why they would do that. Do any of you using owyl depend on this behavior?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.