Skip to content

v0.1 even lighter

Pre-release
Pre-release

Choose a tag to compare

@robert-wallis robert-wallis released this 03 Jul 07:19
· 10 commits to master since this release

This version simplifies ECS even further by removing events. We found that events caused us to write coupled code that was hard to debug if you disabled a system. We made a branch with systems that could be disabled and it was an even heavier ECS solution. So we decided to do the opposite, and consider why we thought we needed events. It turns out we can get Add events by checking for a missing component. But how do we get remove events? We could check for a missing component, just like add, but then we won't know what was removed? If a view is removed, the view system needs to clean up it's resources. IDisposable is for cleaning up resources. So now all removed components are checked for is IDisposable and Dispose() is called when the component is removed.

Which points out another simplification. Components no longer need to be IComponent they can be any object! It's still a good idea to abstract some objects like a Unity GameObject inside a View class because then you can run NUnit without having to start up Unity. And if you had a "Name" and "Title" component, that were both strings, then only one could exist without being wrapped in a Name type or Title type. Type safety is still good. But it also simplifies the concept behind components by not requiring inheriting from an empty interface.