Separate Index/Array for SingleEntity Components
See original GitHub issueThis issue is slightly related to https://github.com/sschmid/Entitas-CSharp/issues/112 An entity stores components in an array. As SingleEntity component is stored only in one entity, it is wasteful to have a space for them in Entity component array. Instead we could have separate array for SingleEntity components, which would contain the component and the reference to the entity which is associated with this component. This way we can keep the API:
e.AddResources(resources);
Internally however it would not store the resources in the entities component array.
This improvement would reduce entity memory size.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Separate Index/Array for SingleEntity Components #238
An entity stores components in an array. As SingleEntity component is stored only in one entity, it is wasteful to have a space...
Read more >Say you have an entity-component-system where ...
Each index represents an entity ID, and there is one BitArray that describes which components the entity has.
Read more >Entity component system design. Should ID of entities be ...
Another choice I can think is at component pools create a separated "index" array to keep track of entity and store all entity...
Read more >Building an ECS #2: Archetypes and Vectorization
Imagine we have an application with 3 entities that all have component A . We can store this in a single array: A...
Read more >Data oriented access to several indexed data arrays
Another way to solve this is using indexes. Every array for a component will be packed, but there are two extra arrays, one...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We do throw
GroupSingleEntityExceptionwhen we ask for single entity and find two entities in the pool. It would be much better if we would already throw when we add the component so that we know where the bug is.Hi, no, it’s not implemented. I talked to Maxim a few times, but I never felt like implementing it. There always seem to be tasks with a higher prio, so I probably will never do it, and since it’s over a year old, I just closed it. I hesitate to introduce more complexity… things like e.GetComponents() and other areas have to be updated, but I don’t think it’s a problem right now.