ecsrx

A reactive take on the ECS pattern for .net game developers

MIT License

Stars
520
Committers
11

Bot releases are hidden (Show)

ecsrx - SUCH RELEASE, MUCH CHANGE, WOW

Published by grofit about 6 years ago

A Quick Rundown

So this version (0.2.0) contains a lot of performance changes and improvements, as well as a lot of feature improvements and streamlining of functionality. You can go download it via nuget now.

New Stuff

This version brings in some new stuff and some streamlined old stuff.

Computeds

Computeds have been changed a bit, so now IComputed represents a singular computed value, IComputedGroup represents a pre-computed IObservableGroup (i.e a filtered group) and then IComputedCollection which represents a computed collection of data. There are docs specifically on this subject which detail it in more depth, but this at a high level allows you to define a living property and then pass it to whatever needs it, allowing you to have a living "Leaderboard" or whatever that everything can subscribe to or look at.

Observable Group improvements

Observable groups have now been changed a bit and now expose a removing event, which can be used to find out when an entity is about to leave a group but before it has been stripped of the components that would cause it to leave the group.

Component exclusions in groups

Until now a group only had the notion of required components, so you could request entities which contained any amount of components but now we can also exclude entities with components you dont want.

So for example if you had an RTS game and you wanted to select all offensive units, you could have a group that required SquadUnit components but exclude ones which contain BuilderUnit.

Nuget Packages

There are now 4 packages in nuget

  • EcsRx (Core stuff)
  • EcsRx.Systems (Conventional Systems, optional)
  • EcsRx.Views (Streamlined view separation and handling, optional)
  • EcsRx.Infrastructure (Notion of applications and DI handling, optional)

It is recommended that in most cases you will want all of the above, and for those who are using unity or monogame etc will still have engine/platform specific helper repos which will build on top of these packages.

Performance Improvements

It is A LOT faster now and uses a lot less memory for general stuff, there are more performance improvements that can be done from here but they may require altering the higher level api some main areas where performance/GC has improved

  • Getting components from entities
  • Checking if entities match a given group
  • Observable Group interactions
  • Adding/Removing multiple components (via AddComponents or RemoveComponents)
  • Collection isolation checks in ObservableGroups

BREAKING CHANGES

  • Entities ids are now int not Guid but are intelligently managed
  • Entities now batch component changes wherever possible into singular events with all changing components
  • Entity/Component/Collection related events now fire from the related object, not on the event system anymore
  • Groups now have RequiredComponents and ExcludedComponents rather than TargettingComponents
  • Conventional systems have now been taken out into their own package EcsRx.Systems (this is all systems bar IManualSystem)
  • Systems now have Process method rather than Execute
  • Teardown systems now fire before the entity is about to be removed from the group, so it still retains all its components etc
  • Lots of namespaces have changed (too many to list, if you dont have resharper or rider you may want to get them)
ecsrx - Initial Release

Published by grofit over 6 years ago

WOOP WOOP

Ok so this is the first release of the separated off EcsRx code base from the unity version, expect some things to be in flux, but generally this library should work out the box for people wanting to use this in normal .net settings with rx.net.

The existing EcsRx project has been renamed to EcsRx.Unity and will be updated shortly to use this under the hood, this being said it will mean that it will only support unity 2018.1 with .net standard 2.0 and .net 4.6 support.

Anyway it should be on nuget, but there are some problems with rx.net not having final 4.0 versions, but there is a DLL for consumption with the release anyway.