question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate Index/Array for SingleEntity Components

See original GitHub issue

This 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mzakscommented, Dec 15, 2016

We do throw GroupSingleEntityException when 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.

1reaction
sschmidcommented, Jan 15, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found