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
<PackageReference Include="TheSingularityWorkshop.FSM_Bridge.Helix" Version="0.0.1" />
<PackageVersion Include="TheSingularityWorkshop.FSM_Bridge.Helix" Version="0.0.1" />
<PackageReference Include="TheSingularityWorkshop.FSM_Bridge.Helix" />
paket add TheSingularityWorkshop.FSM_Bridge.Helix --version 0.0.1
#r "nuget: TheSingularityWorkshop.FSM_Bridge.Helix, 0.0.1"
#:package TheSingularityWorkshop.FSM_Bridge.Helix@0.0.1
#addin nuget:?package=TheSingularityWorkshop.FSM_Bridge.Helix&version=0.0.1
#tool nuget:?package=TheSingularityWorkshop.FSM_Bridge.Helix&version=0.0.1
FSM_Bridge.Helix
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
- 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; }
}
- 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();
- 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");
- 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net481 is compatible. |
-
.NETFramework 4.8.1
- HelixToolkit.Wpf.SharpDX (>= 2.27.3)
- TheSingularityWorkshop.FSM_API (>= 1.0.11)
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 |