
PamukAI is an extremely lightweight AI system designed for programmers. Includes Behavior Trees, FSM, sFSM, Utility AI and Flow-like logic in a unified and consistent style.PamukAI is an extremely lightweight, low-level AI system designed for simple imperative code and maximum performance. It is not a framework, but a flexible code-first library that allows you to build AI systems using Behavior Trees, FSMs, Utility AI and Flow-like logic - in any combination and all in a unified and consistent style.PamukAI is extensible AI system focused on modular logic, clean structure, and runtime flexibility. Designed primarily for in-game AI - from NPC behavior to logistics agents — it helps you build systems that think, decide, and act in ways that are easy to reason about and control. Unlike rigid Behavior Trees or tangled FSMs, PamukAI uses a method-based approach with stateless steps, sequences, utility voting, and control flow nodes, giving you full freedom to define logic the way you think. While AI is its core focus, PamukAI is also perfect for:Cutscenes and scripted sequencesUI logic and screen flowsMission control, quest systems, and gameplay scriptingWhether you're designing reactive enemies, autonomous workers, or context-sensitive events - PamukAI gives you the tools to structure behavior declaratively and execute it with precision.⚠️Note: This is a toolkit for programmers. No GUI, no tree editors! Please do not use this if you are not ready to program :)Features:🧠 Imperative-first designWrite AI as clean, linear, imperative code. Write code naturally, using if, return, loops, and PAI.Step where needed. No visual scripting, no special macros, no domain-specific language.🪶 Ultra-lightweightAllocates only one MethodData per method. No runtime memory allocations, no GC pressure, no hidden update loops — everything is explicit.🔁 Zero-GC Coroutine-like behaviorMethods naturally support step-by-step logic via PAI.Step, PAI.Wait, PAI.DoOnce — no yield return, no IEnumerator boxing.🧩 Multi-paradigm supportCombines the strengths of Behavior Trees, FSM, Utility AI and Stack FSM in one unified system. You can mix them freely, even within the same method.🧰 No lambdas or closuresAll logic is written as named methods. This eliminates allocations, makes behavior explicit, and dramatically improves readability and debugging.🧪 Debuggable by defaultSince it's just imperative code, you can debug using breakpoints, logs, and stack traces — no opaque graphs or runtime visualizers needed.🔀 Flexible control flowWrite composite nodes like SelectorTick, ParallelTick, or MaxUtilityTick with any number of sub-methods. Supports nesting and reusability.🔧 State is automatic and transparentEach method is automatically assigned a persistent MethodData object — no need to manage state by hand.🧱 Not a framework, but a toolkitPamukAI doesn’t impose an architecture. It’s a modular library that integrates easily into your game codebase.👨💻 Programmer-focused, GUI-freeNo visual editors, inspectors, or graphs. Pure code — readable, diffable, and refactorable with your usual tools.Supported AI Paradigms:Behavior Tree (BT) Supports Sequence, Selector, and Parallel nodes as composable method groups. Methods are ticked in classic BT fashion.Finite State Machine (FSM) Each Method can act as a state. Use SwitchState() to switch and track state transitions. OnEnter / OnExit supported.Stack-based FSM (Pushdown Automaton) Built-in support for nested states with a stack (PushState, Pop, etc). Automatically handles re-entry and exit logic.Utility AI Assign Utility values to methods and execute the one with maximum score using MaxUtilityTick or fallback-style UtilitySelectorTick.Flow-based execution Each Method can encapsulate a multi-step behavior using Step logic — enabling coroutine-like flows without yield or state machines.Scheduled Methods — methods can be scheduled to run after a delay and are executed when ticked explicitly via a scheduler function.[Discord] [Documentation]✅ BT Sequence - Yes (PAI.Method is sequence itself, also via SequenceTick method)✅ BT Selector, Parallel nodes - Yes✅/⚠️ BT Condition, While, Until nodes - Yes (native C# operators, these nodes are just not needed in the PamukAI concept)✅ BT Wait and time-based nodes - Yes⚠️ Other BT decorators (like Invert) - Partially yes (but usually they are not required due to imperative code style)✅ BT tree - Yes (Method can tick selectors and sequences inside, and so on)✅ Stateless BT - Yes (native flow, w/o Steps)✅ Stateful BT - Yes (using Step operator)✅ Mixed Stateless/Stateful BT - Yes (mixing Step operator and out of steps code blocks)✅ FSM states - Yes (states are not predefined, and transitions are dynamically determined from code)✅/⚠️ FSM OnEnter - Yes (supported in a natural way as the first step of the PAI.Method). But no handlers out of state Method itself✅/⚠️ FSM OnExit - Yes (via OnExit conditional operator, inside PAI.Method). But no handlers out of state Method itself✅ FSM continuous OnEnter/OnExit (multiframe) - Yes✅ Stack FSM - Yes✅ Stack FSM with falldown - Yes (the system automatically falldown in stack if current state returned False)✅ Utility AI - Yes✅ Utility AI with falldown (Priority Selector) - Yes (Methods are called in order of priority until one of them returns True)✅ Utility AI dynamic utilities - Yes (effective sorting of Methods by utility on each frame)✅ Nested Utility AI - Yes (Method can call sub-selectors with own UtilityAI logic)✅ Scheduled Tasks - Yes✅ Blackboard - Yes (access to data is provided naturally, since the Method operates on the data of its object in which it is declared)✅ Local Blackboard (private node data) - Yes (PamukAI provides a cross-frame key-value dictionary for each Method)❌ State serialization - No out of the box, but possible in principle❌ GUI, node trees editors - No (API only)