This is a work in progress, a C# port for a high-level entity system in Java called Artemis, which combines performance and clean separation of data, logic and view. It is a whole paradigm shift, to think of data/aspects for game features, but once you grasp the concept, you'll go "EUREKA"
I think it would be a nice addition to Ploobs, so I welcome any help here.
C# Source: https://github.com/thelinuxlich/artemis_CSharp
Java Source(so we can compare side-by-side): http://gamadu.com/svn/artemis/
Example Game(using the Java version): http://gamadu.com/svn/tankz/
WARNING: The original source mess a lot with Generics stuff and I see that it is not so trivial porting it from Java to C#(I'm not a .NET advanced programmer), the conversion was made blindly in my spare time and is broken at the moment because of these minor issues.
Quoting the author:
This framework requires different thinking when it comes to game programming. No longer are entities just self-contained objects, but consist of data/state components which are processed by systems/aspects.
Entity is an irrelevant object, it however still exists for design simplicity and convenience.
Components are attached to entities and they contain data or state for that entity. Imagine a components like Transform and Velocity.
Systems "process" certain "aspects" of entities. You can imagine one aspect being "Movement", and you would create a MovementSystem which processes all entities containing the Transform and Velocity components.
Currently there are 4 types of systems you can extend from:
- EntitySystem: the very basic raw system, which simply allows you to handle the processing loop however you want.
- EntityProcessingSystem: used to process individual entities of a certain aspect sequentially. If you always need to process all entities use this.
- IntervalEntitySystem: a very basic and raw system but is only executed at certain intervals, e.g. it runs processing every 100 ms. This way you can tune your game better for performance.
- IntervalEntityProcessingSystem: like EntityProcessingSystem but runs in intervals.
- DelayedEntitySystem and DelayedEntityProcessingSystem: executes only after a specified period.
This is a very fast system and offers a lot of flexibility, whilst keeping your code clean.
