Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: logic blocks v5 (serialization, optional diagram generation, boxless input queing, allocation-free hot path, type registry, etc) #34

Merged
merged 68 commits into from
Jun 8, 2024

Conversation

definitelyokay
Copy link
Member

@definitelyokay definitelyokay commented Mar 6, 2024

  • 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 of OnEnter<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)].
  • New logic block analyzer to warn you if you forget the [LogicBlock] attribute.
  • 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 on Microsoft.CSharp, and the features it was using with dynamic 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 [Meta] attribute.
  • Adds a Serialization package that provides a type resolver for introspective types which supports polymorphic deserialization with 0 configuration.
  • Source generated System.Text.Json contexts can be used alongside the Chickensoft serialization system.
  • Serializable types can be versioned and marked as outdated. Upgrade logic is invoked during deserialization so that outdated models are never presented to production code.
  • Support serializable type upgrade dependencies
  • Support abstract introspective and serializable types
  • Support serializable type inheritance.
  • Allow user code and libraries to register custom metadata with the introspection type graph for types whose metadata cannot be automatically generated (i.e., types outside the user code assembly)
  • Serialize collections (list, hashset, dictionary)
  • Support init properties on serializable types, including required properties.
  • Validate type graph after types are registered in the module initializer to warn or throw when user code attempts to do something invalid or not recommended.
  • Introspection generator diagnostics to improve user friendliness
  • Introspection mixin system to deprecate https://github.com/chickensoft-games/SuperNodes

Testing

  • 100% test coverage on logic blocks
  • 100% test coverage on serialization
  • 100% test coverage on introspection
  • serialization integration tests
  • introspection generator use case tests
  • diagram generator use case tests

Documentation

  • Logic blocks documentation
  • Introspection documentation
  • Serialization documentation

Deployment

  • Publish introspection
  • Publish introspection generator
  • Publish serialization
  • Publish serialization generator
  • Publish diagram generator
  • Deprecate LogicBlocks.Generator (old diagram generator)

feat: prevent boxing inputs and outputs in bindings altogether
fix: pass inputs and outputs by reference everywhere
feat: do not box inputs or outputs in bindings
feat: do not box inputs or outputs when listened to directly
refactor: rename generics for clarity
refactor: remove unneeded code
refactor: consolidate fake context
refactor: eliminate all dynamic types in codebase
…propagate logic block exceptions, add force reset capability, update tests
…ation generator, revert error handling to always pass through HandleError and not throw by default
… cached introspection, allow fake contexts to spin up states as needed for testing, allow non-serializable but introspective logic blocks, rename attribute to just meta, fix nameof() usage for identifiers.
…enerated code, improve partial and top-level checking in the type generator, diagram generation
@definitelyokay definitelyokay marked this pull request as ready for review June 8, 2024 19:13
@definitelyokay definitelyokay merged commit 6c0a20f into main Jun 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant