Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how allocation/deletion works #44

Merged
10 commits merged into from Apr 22, 2016
Merged

Refactor how allocation/deletion works #44

10 commits merged into from Apr 22, 2016

Conversation

ghost
Copy link

@ghost ghost commented Apr 21, 2016

  • The DynamicEntityIter is removed
  • Allocation / Deletion can be done without a write lock
  • Add the ability to Join over the entities()

This removes the add_list/sub_list in-favour of atomic bit sets. Killing an Entity sets a bit atomically that can be looked up later during the merge. Raising a dead entity is done via an atomic bitset too. This allows systems to iterate over the entities without blocking system that need to create or delete entities.

The other big part of this change is that the functionality of the DynamicEntityIter & the EntitiyIter are now in one place. We merge the known alive entity ids, with any raised entities. The Entities can see entities that are created by systems in parallel, which might cause some unpredictable behaviour. But if you are masking with a component (that is locked upstream) it still reliably work.

struct CompFloat(f32);
impl specs::Component for CompFloat {
// HashMapStorage is better for componets that are met rarely
type Storage = specs::VecStorage<CompFloat>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment is wrong

@kvark
Copy link
Member

kvark commented Apr 21, 2016

I'm happy with the code. Is it still being updated? Please merge when finished.

@ghost
Copy link
Author

ghost commented Apr 21, 2016

@kvark I want to add some more docs and maybe another look over.

There are a few places I would like to improve since they are suboptimal (the bitset clear for example).

@ghost ghost merged commit d554372 into amethyst:master Apr 22, 2016
@kvark
Copy link
Member

kvark commented Apr 25, 2016

Warnings: performance of building the entities got affected. Need to have another look at this change.

@kvark kvark changed the title [WIP] Refactor how allocation/deletion works Refactor how allocation/deletion works Apr 25, 2016
@ghost ghost mentioned this pull request Apr 26, 2016
xMAC94x pushed a commit to xMAC94x/specs that referenced this pull request Mar 10, 2021
44: Include name of system that was not found in panic message r=torkleyy

I have run into this error many times and it's not fun to find the source using `RUST_BACKTRACE`. This should help find the cause of the error quicker and more easily.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants