TheSingularityWorkshop.FSM_Bridge.Helix 0.0.1

dotnet add package TheSingularityWorkshop.FSM_Bridge.Helix --version 0.0.1
                    
NuGet\Install-Package TheSingularityWorkshop.FSM_Bridge.Helix -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TheSingularityWorkshop.FSM_Bridge.Helix" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TheSingularityWorkshop.FSM_Bridge.Helix" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="TheSingularityWorkshop.FSM_Bridge.Helix" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TheSingularityWorkshop.FSM_Bridge.Helix --version 0.0.1
                    
#r "nuget: TheSingularityWorkshop.FSM_Bridge.Helix, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TheSingularityWorkshop.FSM_Bridge.Helix@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TheSingularityWorkshop.FSM_Bridge.Helix&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=TheSingularityWorkshop.FSM_Bridge.Helix&version=0.0.1
                    
Install as a Cake Tool

FSM_Bridge.Helix

License: MIT NuGet version NuGet downloads

Build Status Last commit Code Coverage Known Vulnerabilities

GitHub stars GitHub contributors Open Issues

๐Ÿ’– Support Us

A bridge to a structured reality.


๐Ÿ” Overview

FSM_Bridge.Helix is the first package in the new Bridge Layer of The Singularity Workshop's ecosystem. It is designed to allow developers to seamlessly integrate behaviors from the Helix Toolkit into the core FSM_API. This package acts as an adaptation layer, providing the necessary IStateContext implementations and FSM components to manage the state of 3D objects and viewports within applications built on the Helix Toolkit. Its primary purpose is to serve as a pathway for existing Helix content to be consumed within the AnyApp and MyVR environments.

Feature FSM_Bridge.Helix โœ… Traditional Logic โŒ
Engine agnostic โœ… โŒ
Runtime-modifiable definitions โœ… โŒ
Deferred mutation safety โœ… โŒ
Named FSMs & Processing Groups โœ… โŒ
Built-in diagnostics & thresholds โœ… โŒ
Pure C# with minimal external deps โœ… โŒ

๐Ÿš€ Quickstart

  1. Define a simple context (your data model): C#
public class MeshFSMContext : IStateContext
{
    public MeshGeometryModel3D Mesh { get; set; }
    public Color OriginalColor { get; set; }
    public bool IsSelected { get; set; }
    public bool IsValid => Mesh != null;
    public string Name { get; set; }
}
  1. Define and build your FSM: C#
// Define a simple condition function
private static bool OnMeshHover(IStateContext ctx)
{
    // A simplified example of checking for mouse hover
    return ((MeshFSMContext)ctx).IsSelected;
}

FSM_API.Create.CreateFiniteStateMachine("MeshSelectionFSM")
    .State("Deselected",
        onEnter: (ctx) => {
            if (ctx is MeshFSMContext c) c.Mesh.Material = new PhongMaterial(new DiffuseMaterial(c.OriginalColor));
        })
    .State("Selected",
        onEnter: (ctx) => {
            if (ctx is MeshFSMContext c) c.Mesh.Material = new PhongMaterial(new DiffuseMaterial(Colors.Yellow));
        })
    .WithInitialState("Deselected")
    // Now define the transitions between states
    .Transition("Deselected", "Selected", OnMeshHover)
    .Transition("Selected", "Deselected", (ctx) => !OnMeshHover(ctx))
    .BuildDefinition();
  1. Create an instance for your context: C#
var myMeshContext = new MeshFSMContext { Mesh = my3DModel, OriginalColor = Colors.Red };
var handle = FSM_API.Create.CreateInstance("MeshSelectionFSM", myMeshContext, "MainLoop");
  1. Tick the FSM from your application's main loop: C#
// Process all FSMs in the "MainLoop" group
FSM_API.Interaction.Update("MainLoop");

๐Ÿ”ง Core Concepts

FSMBuilder: Fluently define states, transitions, and associated OnEnter/OnExit actions.

FSMHandle: Represents a runtime instance of an FSM operating on a specific context.

IStateContext: The interface your custom data models must implement to be used by the FSM. `FSM_Bridge.Helix` provides concrete `IStateContext` implementations for Helix components, such as `MeshGeometryModel3D_FSM_Behavior.cs`.

Processing Groups: Organize and control the update cycles of multiple FSM instances.

Error Handling: Built-in thresholds and diagnostics prevent runaway logic or invalid state contexts.

Thread-Safe by Design: All modifications to FSM definitions and instances are deferred and processed safely on the main thread post-update, eliminating common concurrency issues.

๐Ÿ“ฆ Features at a Glance

Capability Description
๐Ÿ”„ Deterministic State Logic Define predictable state changes for your 3D models and viewports based on dynamic conditions or explicit triggers, ensuring your application's behavior is consistent.
๐ŸŽญ Context-Driven Behavior Your FSM logic directly operates on Helix components, enabling clean separation of concerns (logic vs. data) for your 3D scenes.
๐Ÿงช Flexible Update Control Choose how FSMs are processed: event-driven, tick-based (every N frames), or manual. This adaptability is perfect for real-time 3D simulations or complex user interactions.
๐Ÿงฏ Robust Error Escalation Benefit from per-instance and per-definition error tracking, providing immediate insights to prevent runaway logic or invalid states without crashing your application.
๐Ÿ” Runtime Redefinition FSM definitions can be redefined while actively running, enabling dynamic updates, live patching, and extreme behavioral variation without recompilation or downtime.
๐ŸŽฏ Lightweight & Performant Engineered for minimal memory allocations and optimized performance, ensuring your FSMs are efficient even in demanding simulation scenarios.
โœ… Easy to Unit Test The inherent decoupling of FSM logic from context data ensures your state machines are highly testable in isolation, leading to more robust and reliable code with simplified unit testing.
๐Ÿ’ฏ Mathematically Provable With clearly defined states and transitions, the FSM architecture lends itself to formal verification and rigorous analysis, providing a strong foundation for high-assurance systems where correctness is paramount.
๐Ÿค Collaborative Design FSMs provide a visual and structured way to define complex behaviors, fostering better communication between developers, designers, and domain experts.
๐ŸŽฎ Unity Integration Available Now preparing for submission to the Unity Asset Store.

๐Ÿ“˜ Whatโ€™s Next?

๐Ÿ“– Full Documentation & Wiki (TBD)

๐Ÿงช Unit Tests & Benchmarks (Currently Under Development)

๐Ÿ”Œ Plugins & Extension Framework (e.g., for visual editors, debugging tools)

๐Ÿค Contributing

Contributions welcome! Whether you're integrating FSM_Bridge.Helix into your enterprise application, designing new extensions, or just fixing typos, PRs and issues are appreciated.


๐Ÿ“„ License

MIT License. Use it, hack it, build amazing things with it.


๐Ÿง  Brought to you by:

The Singularity Workshop - Tools for the curious, the bold, and the systemically inclined.

<a href="https://www.patreon.com/TheSingularityWorkshop" target="_blank"> <img src="Visuals/TheSingularityWorkshop.png" alt="Support The Singularity Workshop on Patreon" height="200" style="display: block;"> </a>

Because state shouldn't be a mess.

Support the project: Donate via PayPal

Product Compatible and additional computed target framework versions.
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1 326 9/22/2025