The Singularity Workshop - FSM API (Advanced)

FSM_API-Advanced: Forge Logic Beyond the Game Loop


While our Basic FSM_API Integration Package gives you a heartbeat, our Advanced Integration gives you a brain.


This advanced package is designed for developers who need to elevate their projects from simple chaotic logic to sophisticated, scalable intelligence. It is a professional-grade solution that delivers the absolute granular control and performance optimization required for demanding and complex systems. Engineered to Perform!



Shatter the Bottleneck: Absolute Deterministic Control


Stop compromising performance with every new system. Unity's default Update() forces your AI agents, network syncs, and UI states to compete for the same millisecond, leading to unpredictable frame-rate spikes and unacceptable performance jitter in high-complexity builds.


Our Advanced FSM_API Integration completely shatters that dependency on the conventional Unity game loop. By providing a clean and intuitive way to create dynamic and custom processing groups, achieving the ultimate in control:

  • Granular Control: FSMs are assigned to process groups, which are run only when their associated Unity Message (or custom event) is stepped.
  • Optimal Performance: Run state logic at the exact frequency required (e.g., AI every 0.2s, physics state every FixedUpdate), eliminating needless over-updates for superior performance.
  • Nested Hierarchy: FSMs can be defined in a completely nested hierarchy, maintaining order and integrity across systems.


🎤 The Game-Changing Feature: Runtime Recomposition 🎤


The static definition of a Finite State Machine carries inherent tradeoffs in massive or long-running projects. We shred all theory around conventional FSMs by providing the capability to:

  • Safely Restructure, Recompose, and Redefine your FSMs and their run sequence at runtime.
  • Adaptive Systems: Implement sophisticated AI that dynamically reorganizes its own logic flow, or even load entire new behavior sets from external sources (like a .dll) and map them to appropriate states, all while the game is running.
  • This results in incredibly decoupled yet fully interoperable behaviors.

🛠️ Simplicity with Power: The 4-Step Setup


Accessing this advanced control is intentionally simple. The complexity of loop management is contained within the provided Prefab, allowing you to focus on logic using our Fluent FSM Builder.

  1. Drag Prefab into the Hierarchy.
  2. Assign a Root GameObject to your environment and assign this to the Root field of the Prefab.
  3. Define your Process Groups for each Unity Message (e.g., Update, FixedUpdate, OnPreRender, or custom events).
  4. Define your FSMs using the FSM_API's Fluent FSMBuilder.

Example: A Simple Light Switch FSM

This FSM is assigned to the Process Group named "Update":


c#:

private void Awake()

{

    // Check if the FSM definition already exists

    if (!FSM_API.Interaction.Exists("LightFSM", "Update"))

    {

        // 1. Define the FSM blueprint

        FSM_API.Create.CreateFiniteStateMachine("LightFSM", 0, "Update")

            .State("Off", OnEnterOff, null, null)

            .State("On", OnEnterOn, null, null)

            .BuildDefinition();

    }

    // 2. Create an instance of the FSM blueprint

    // 'this' is the context (data model), "Update" is the Process Group it runs in.

    Status = FSM_API.Create.CreateInstance("LightFSM", this, "Update");

}


Key Benefits Unlocked by Advanced package:


  • IIndie Developers - Cascading Scale & Future-Proofing: Solve scaling problems before they become bottlenecks. Dedicate resources to content instead of fighting game loop jitter.
  • Professional Teams Seamless Interoperability: A unified, highly decoupled architecture where AI, Physics, and UI teams can work in parallel without causing random performance spikes in other systems.
  • Emergent AI Designers True Intelligence: The ability to safely recompose FSMs at runtime allows you to model truly adaptive and emergent behaviors that static systems simply cannot achieve.
  • Competitive / Networked GamesAbsolute Determinism: Essential for complex networking, replay systems, and competitive play where predictable state execution, independent of a variable frame rate, is paramount.

In short, this paradigm changing package is absolutely for anyone wanting more complexity made easy.