active-logic / activelogic-cs

Behavior Trees and Case Logic for C#7
GNU Affero General Public License v3.0
106 stars 7 forks source link
behavior-tree behaviour-trees control-flow control-systems game-ai game-development

Active Logic

Build Status codecov

Easy to use, comprehensive Behavior Tree (BT) library built from the ground up for C# programmers:

=> Quick-start guide || Unity quick-start guide || API reference || FAQ

Introduction

Active Logic seamlessly integrates with C#:

class Duelist : UTask{

    float     health = 100;
    Transform threat;

    // BT selectors and sequences via || and &&
    override public status Step()
        => Attack()
        || Defend()
        || Retreat();

    // Conditionals without 'conditional nodes'
    status Attack() => (threat && health > 25) ?
        Engage(threat) && Cooldown(1.0f)?[ Strike(threat) ]
      : fail(log && $"No threat, or low hp ({health})");

    status Defend() => ...;

    // ...

}

> Complete sample

Active logic is the first BT library providing tight integration with the host language (no DSL, no builder pattern, no lambdas or coroutines, no blackboard). This means better performance (low/no GC), cleaner syntax and the freedom to structure your code as you wish.

Installation

Engine/platform agnostic:

Unity 3D:

From source: no dependencies.

Language support

License

Where next?