Setup

EcsR3 is a framework built on top of R3 which provides an ECS paradigm for managing entities and executing logic on them based on systems and groups. It also makes use of the underlying SystemsR3 library for common infrastructure that is not ECS specific but is used here.

Setup

If you are using Monogame, Unity or Godot you can just go and get the platform specific helpers which will out the box provide you most of the infrastructure and setup required to get going, so go look there.


If you are not using an existing engine/framework and want to pioneer into a new territory then it's just a case of setting up the bits that are needed for the core parts of the system to run.

Pre build infrastructure or not?

Out the box EcsR3 comes with a load of infrastructure classes which simplify setup, if you are happy to use that as a basis for setup then your job becomes a bit simpler.

There is also a whole section in these docs around the infrastructure and how to use the application and other classes within there in common scenarios.

YES I WANT ALL THE INFRASTRUCTURE PLX PLX

A wise choice so to start with its advised that you take:

  • EcsR3

  • EcsR3.Infrastructure

  • EcsR3.Plugins.Views

This will provide the basic classes for you to extend, however one fundamental problem is that the infrastructure expects you to be using a DI framework. It doesn't really care which DI framework as it provides an interface for you to implement and then consume that in your own EcsR3Application implementation.

So here are the main bits you need:

  • Implement IDependencyRegistry and IDependencyResolver for your DI framework of choice. Here is a Ninject one from examples

  • Implement your own EcsR3Application class, giving it an IDependencyRegistry implementation to use. Here is one from examples

  • Extend your custom EcsR3Application implementation for each logical app you need to make, as shown in the EcsR3 console examples

There are pre-made DI implementations for Ninject, Microsoft, DryIoc, AutoFac and finally Zenject so if you can use one of those on your platform GREAT! if not then just pick a DI framework of choice and implement your own handler for it (using the ninject one as an example to base it off).

So if you dont know what DI (Dependency Injection) is I recommend you go read this and this which will give you a quick overview on what IoC (Inversion of Control) and DI is and how you use it.

It is worth noting here that this is EXACTLY how the examples work in this project so its worth cracking them open to see how its all done, but the same principals can be applied to your own applications.

NOOOPE! I dont care for your design patterns sir, just let me get going

Ok captain, if you just want to get things going with minimum effort then I would just get the core lib and manually instantiate everything that is needed.

This is like the most bare bones setup I would advise:

Then all you need to do is go:

HUZZAH! you are now up and running and you can make your own conventions or design patterns around this.

Last updated