LogicBlocks
LogicBlocks copied to clipboard
feat: logic blocks v5 (serialization, optional diagram generation, boxless input queing, allocation-free hot path, type registry, etc)
- Reduces abstractions and eliminates a number of generics and nested classes.
- Automatically infer OnEnter/OnExit type correctly via capturing generics from extension methods. No more bugs because you specified the wrong type! Only change is that you need to call
this.OnEnter((State? previous) => ...)
instead ofOnEnter<StateType>((previous) => )
. There's also overloads that don't require you accept the previous/next state if you don't need it (99% of use cases). - Updates the diagram generator to support syntax changes.
-
[StateMachine]
is now[LogicBlock(typeof(ConcreteState), Diagram = true)]
. - Refactors the example to demonstrate a conventional logic block state structure.
- Eliminates the complex
Use
selector binding that I never actually used in practice. If you were using it, sorry! I needed to eliminate the dependency onMicrosoft.CSharp
, and the features it was using withdynamic
required that package. From what I learned, those bindings wouldn't be AOT-friendly, and all Chickensoft packages need to be AOT-friendly. - Eliminates boxing inputs and outputs altogether, even in the bindings system. This means that the single input handler execution hot path is allocation-free!
- A single input never hits the heap now! An input is only queued if another input is already being processed.
- Pass all inputs and outputs by reference via
in
- Updates start/stop logic to be more correct.
- No more lambda allocations when executing enter/exit or attach/detach callbacks.
- Introduces a new source Introspection generator that registers all visible types and generates additional metadata information about types tagged with the
[Introspective]
attribute. - Adds a Serialization package that provides a type resolver for introspective types which supports polymorphic deserialization with 0 configuration.
- Adds a
LogicBlockConverter
that can serialize and deserialize logic blocks and their blackboards.