Jump to content
  • Advertisement
Sign in to follow this  
Raziel Anarki

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

This topic is 955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 linkhttp://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.

 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!