When iterating over an IEnumerable with foreach it should not matter if an entity has been added or removed from the collection. Users should have simplicity in mind and rely on real time rather than having to iterate over a collection backwards to avoid any issues. This can be found by doing the following:
When an entity is added or removed from an Entity World it should be stored in cache (ie; entitiesToRemove). Before any Entity Systems are processed the cached entities will be added/removed from the Entity World and any Entity Systems that matches their aspect.
Another issue is that if we create a common TagComponent we need a way to match entities on their respective tags. Right now the implementation below doesn't support that:
Simply update the IReadOnlyEntity to include a string? Tag property that will return the tag of the entity. Furthermore, it might just be a better idea to add a Tag property directly to Entity, rather than creating a TagComponent.
We need common components implemented such as:
TagComponent.
TransformComponent
SpriteComponent
etc
Along with the above we should also implement common Entity Systems such as SpriteRenderSystem.
IWindow
We should have the ability to add icons to the Window.
Viewport
To access the viewport, we currently have to use IWindow, we should add support to IRenderDevice to get the viewport.
Simple Physics Support
We need a simple physics engine (not brute force, but have it be an option I guess? - look at coding train)
Think of something like FarseerPhysics or roll your own and suss out something like Coding Train.
A few notes:
I should remove GameContainer and just rely on some sort of binding module that can be referenced. For example "CoreModule" would contain ECS, Input, IO, Resources and Utilities. Then it would just be as simply as resolving a class that simply runs an IGame interface?
EntitySystemBase
When iterating over an
IEnumerable
withforeach
it should not matter if an entity has been added or removed from the collection. Users should have simplicity in mind and rely on real time rather than having to iterate over a collection backwards to avoid any issues. This can be found by doing the following:When an entity is added or removed from an Entity World it should be stored in cache (ie;
entitiesToRemove
). Before any Entity Systems are processed the cached entities will be added/removed from the Entity World and any Entity Systems that matches their aspect.Another issue is that if we create a common
TagComponent
we need a way to match entities on their respective tags. Right now the implementation below doesn't support that:A solution to this would be the following:
IReadOnlyEntity
to include astring? Tag
property that will return the tag of the entity. Furthermore, it might just be a better idea to add aTag
property directly toEntity
, rather than creating aTagComponent
.We need common components implemented such as:
TagComponent
.TransformComponent
SpriteComponent
Along with the above we should also implement common Entity Systems such as
SpriteRenderSystem
.IWindow
We should have the ability to add icons to the Window.
Viewport
To access the viewport, we currently have to use
IWindow
, we should add support toIRenderDevice
to get the viewport.Simple Physics Support
A few notes:
GameContainer
and just rely on some sort of binding module that can be referenced. For example "CoreModule" would contain ECS, Input, IO, Resources and Utilities. Then it would just be as simply as resolving a class that simply runs anIGame
interface?