Closed ghost closed 9 years ago
Don't expect to receive your entities in order of insertion, that's overall against ECS architecture. Your system should operate on certain entity or actually it's components. If you want to deal with bunch of entities at once then you should aggregate them manually.
Have a look here: https://github.com/DaanVanYperen/artemis-odb-contrib/blob/master/contrib-jam/src/main/java/net/mostlyoriginal/api/system/graphics/RenderBatchingSystem.java
It looks like the Entity Builder has a pool of IDs it uses
The framework internally recycles ids.
I'd like to have strict control over processing order with some components. Is this possible?
Systems always process entities in ascending entity.id order (results in slightly faster processing, and it enables much faster insertion/removal). You can work around this behavior by extending EntitySystem
and intercepting the entity bag received in EntitySystem#processEntities
- it's a bit clunky, but I do it from time to time.
0.10.0 - sometimes later this week - reworked the way systems subscribe to entities, making the whole process smoother.
(closing for now, but feel free to re-open)
boop
Hi there,
I'm using artemis-odb 0.9.0 and I'm noticing some confusing behavior.
I have a set of components I expect to be processed in order of insertion into the world. I build each one with the following code:
This runs in a loop which iterates over an array on
index
from 0 ton
. Based on the 0.9.0 code, it looks like all EntitySystems listen for relevant entity insertions and mark their actives to be rebuilt just before each processing loop. That part seems to work fine, in that the entities are indeed processed in ascending ID order. However, they are not processed in insertion order:As you can see, the entities with indices 2 and 1 have IDs earlier than the entity with index 0. It looks like the Entity Builder has a pool of IDs it uses, but I'd like to have strict control over processing order with some components. Is this possible?