Proto* AI/prototyping framework - nestable coroutine AI (and other handy classes)

Started by
-1 comments, last by Raziel Anarki 8 years ago

Presenting a new approach to writing behavior-tree-like AI logic, using nestable coroutines analogous to behavior nodes, resulting in a runtime-dynamically-created “tree” of behavior nodes, specified more expressively trough actual coderather than abstracted node-based-trees/graphs.

This way, most of the Selector/Sequence/Loop/Inverter/Succeeder/etc nested node logic in behavior-tree DSL-land can be replaced by writing regular code consisting of if/switch/do/while/for statements inside iterators yielding subroutine nodes.

Asset store link: http://u3d.as/rAF?

Also included: simple object, and GameObject pooling solutions, and a Signals implementation of the Observable pattern as a type-safe event system, with an example scene and an in-depth manual.

Aims to be a simple, hackable and to-the-point prototyping bootstrap solution for your projects.

How it works:

- you write IEnumerable<Routine> return-typed coroutines
- which yield special Routine instructions (or nulls) between blocks of regular coroutine code
- you "invoke" child nodes using various (Routine).Run(...); -like calls
- you only need to tick the Update() function of the root node (a Routine) yourself

- a dynamic "behavior tree", with a current "active branch" will be automatically maintained trough yielding, in the background (with additional pooling and reusing of nodes for efficiency)
- use the Unity Profiler to visualize the dynamic behavior tree
?

Some of the philosophies behind- and the example scene included were inspired in part by the highly informative articles of Jean Simonet on the same subject (altough my implementation is a bit different from his as you'll see) : http://gamasutra.com/blogs/JeanSimonet/20160128/264083/Logic_Over_Time.php and http://gamasutra.com/blogs/JeanSimonet/20160310/267441/Beyond_the_State_Machine.php.

This topic is closed to new replies.

Advertisement