-
Notifications
You must be signed in to change notification settings - Fork 221
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
Conversation
struct CompFloat(f32); | ||
impl specs::Component for CompFloat { | ||
// HashMapStorage is better for componets that are met rarely | ||
type Storage = specs::VecStorage<CompFloat>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment is wrong
I'm happy with the code. Is it still being updated? Please merge when finished. |
@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). |
Warnings: performance of building the entities got affected. Need to have another look at this change. |
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.
Join
over theentities()
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.