I spent an excellent period of time attempting to get my head round ECS however the “S” continues to be obscure to me – the farthest I went is that I do know a System is the place the magic occurs; it is the place behaviors get carried out, largely.
Nonetheless, most references I examine ECS had been fairly broad of their examples and did not go a lot past the “Motion” and “Physics” Techniques.
That mentioned, what does a system {that a} decreases well being appear to be? My area is TypeScript, however examples/snippets in any language work simply fantastic.
I believe the above is tough for me to visualise largely as a result of my present understanding of ECS is sort of as follows:
- An
Entity
is a novel ID that represents a factor, - Every
Entity
has a “assortment” of elements, that describes what theEntity
consists of and are nothing however knowledge, - All spawned entities are cached in reminiscence, often by way of a “World” object,
- An
Entity
is given aWell being
element by way of aworld.addComponent(entity, well being)
perform name, - Then, to lower the
Well being
of thisEntity
I simply spawned, I might need to…? That is the place issues get blurry and darkish for me – with out the crucial consideringwell being.decreaseBy(10)
, the System simply doesn’t “click on”.