A general system execution framework with additional layers for Application
scenarios with DI abstraction and plugin support.
This originally was a core part of EcsRx however now lives as it's own repo, but EcsRx is built on top of this.
- Simple system interfaces and implementations to use/extend
- Fully reactive architecture
- Favours composition over inheritance
- Adheres to inversion of control
- Lightweight codebase
- Built in support for events (raise your own and react to them)
- Built in Dependency Injection abstraction layer
- Built in support for plugins (wrap up your own components/systems/events and share them with others)
You have 3 system conventions out of the box, IBasicSystem
, IManualSystem
and IReactToEventSystem
. They can be mixed and matched and when added to the ISystemExecutor
they will be triggered as expected.
It is advised to look at the setup docs, this covers the 2 avenues to setup the application using it without the helper libraries, or with the helper libraries which offer you dependency injection and other benefits.
public class SayHelloSystem : IBasicSystem
{
// Triggered every time the IUpdateScheduler ticks (default 60 fps)
public void Execute(ElapsedTime elapsedTime)
{
Console.WriteLine($"System says hello @ {elapsedTime.TotalTime.ToString()}");
}
}
public class ReactToPlayerDeadEventSystem : IReactToEventSystem<PlayerDeadEvent>
{
// Triggered when the IEventSystem gets a PlayerDeadEvent
public void Process(PlayerDeadEvent eventData)
{
Console.WriteLine("Oh no the player has died");
}
}
public class StartGameManualSystem : IManualSystem
{
// Triggered when the system is first registered
public void StartSystem()
{
Console.WriteLine("Game Has Started");
}
// Triggered when the system is removed/stopped
public void StopSystem()
{
Console.WriteLine("Game Has Ended");
}
}
The architecture is layered so you can use the core parts without needing the additional layers if you want to keep things bare bones.
This is a bare bones rx implementation, it literally just contains some basic Subject
and other related rx classes, this is so that we do not have a dependencies on rx.net or unirx in the core.
This takes the barebones rx implementation and creates a basic ISystem
convention with an ISystemExecutor
and IConventionalSystemHandler
implementations to provide basic systems interfaces (As shown in quick start above).
While this can be used alone for basic systems you can build your own conventions on top of here, such as EcsRx
which adds an ECS paradigm on top of SystemsRx.
This allows you to make use of the infrastructure layer which provides a DI abstraction layer, Plugin support and some best practice classes.
The 2 main libraries here are SystemsRx and SystemsRx.Infrastructure, these only have a dependency on MicroRx
There is a book available which covers the main parts which can be found here:
This is basically just the docs folder in a fancy viewer
This can all be found within the docs here