NPBehave  by meniku

Event-driven behavior tree library for code-based AIs in Unity

Created 9 years ago
1,231 stars

Top 32.0% on SourcePulse

GitHubView on GitHub
Project Summary

NPBehave is a C# behavior tree library for Unity, designed for code-first AI development. It offers an event-driven approach, allowing behavior trees to remain in their current state and only traverse when necessary, leading to improved performance and simpler logic compared to traditional frame-by-frame traversal. The library is suitable for developers who prefer defining AI logic through code rather than visual editors.

How It Works

NPBehave utilizes an event-driven architecture where nodes only execute when triggered by an event, typically managed through a Blackboard. Blackboards act as a shared memory for AI, storing and observing data changes. Nodes like BlackboardCondition and Service interact with the Blackboard, allowing the tree to react dynamically to state changes without constant polling. This approach enhances efficiency by minimizing unnecessary computations.

Quick Start & Requirements

  • Install by dropping the NPBehave folder into your Unity project.
  • Requires Unity.
  • Examples are included for demonstration.
  • Official documentation and tutorials are available.

Highlighted Details

  • Event-driven traversal for performance and simplicity.
  • Blackboard system for AI memory and state observation.
  • Extensive node types (Composites, Decorators, Tasks) inspired by traditional and Unreal Engine behavior trees.
  • Flexible "stop rules" for controlling node execution flow based on Blackboard changes.
  • Custom node creation is supported.

Maintenance & Community

  • Maintained by Nils Kübler.
  • Games using NPBehave are listed on the GitHub page.
  • Contact information provided for submissions and inquiries.

Licensing & Compatibility

  • The README does not explicitly state a license.

Limitations & Caveats

  • No visual editor is provided; all AI logic must be coded.
  • Some advanced "IMMEDIATE_RESTART" stop rules may not always restart nodes immediately if the aborted branch leads to the parent composite succeeding.
  • The NavWalkTo node is marked as experimental.
Health Check
Last Commit

6 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
8 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.