Thanks Ukendio, this ECS is goat.
If I were to implementing a health or position component, is there a correct way of altering the value of an instance when this happens? Like the position of a part, model or health of a humanoid?
I would assume this would happen in a system right before or after calling :set to update the value, then again some entities would update a part while others would update a model or ui or pure dataā¦
Would a move system have a loop for each case like āhas Position and MoveablePartā, āhas Position and MoveableModelā?
I believe an example or demo involving updating instances would be very useful and much more practical. If I have missed it then Iām sorry. Itās actually a little frustrating that I cannot see anh documentation about it, but perhaps that just means itās up to me (or Iām blind)
Generally I have a Renderable component which is just any PV instance that can use PivotTo and then I have a specialized Assembly which is a model whose parts are unanchored and welded together. This is useful for updating or reconciling predicted transforms.
But no, thereās not really any correct way to do things but there are ways to ensure your data is well normalized, as in following basic rules of 1NF, 2NF and 3NF. To learn more about these normal forms check out this chapter of the book data oriented design by Richard Fabian. Good normalization will make for better joins (i.e. queries) and that is ultimately the goal with ensuring that your systems establish requirements or constraints for the data.
hmm, is there any way to create a āhasdamageupdatesā component, thereby filtering all entities with health but that havenāt been damaged? the issue i see with this is that i donāt know how jecs handles filtering, so it might get the data for all the other components, see that the entity doesnāt have āhasdamageupdatesā, then drop all that data
i tried avoiding inner loops but the issue i found with that is that sometimes i get a ton of hitrequests targeting the same entity, and i have to basically re-get the target entityās component data for every hitrequest
edit: oh wait do archetypes already solve this
You would probably be interested in reading some of the examples