Conversation
crates/bevy_ecs/src/world/mod.rs
Outdated
| .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |val| { | ||
| val.checked_add(1) | ||
| }) | ||
| .expect("More bevy `World`s have been created than is supported. Please tell us what you were doing, because frankly I'm impressed."); |
There was a problem hiding this comment.
I thought I'd removed this second sentence before committing. I'm happy to keep it as-is though 😆
alice-i-cecile
left a comment
There was a problem hiding this comment.
Once the error message is cleaned up this LGTM.
I don't have strong feelings about u32 vs u64 for world ids. u32 is probably slightly more reasonable as there's effectively no way to break those limits without going OOM elsewhere. But on the other hand, there's no real cost to storing more data here 🤔
| Self { | ||
| ran: false, | ||
| system_id: SystemId::new(), | ||
|
|
There was a problem hiding this comment.
Unnecessary whitespace, I'm surprised rustfmt doesn't check for that
|
Regarding As @alice-i-cecile said, it is unlikely to break the limit of Whereas portability and platform support is an actual problem with actual consequences. Let's not needlessly limit the kinds of devices that bevy can run on. |
|
Hmm, I hadn't considered that - I wonder if there should be a clippy lint for that (beyond just using the more general disallowed function) We should use |
|
I dig these changes. I do think that ultimately we might need a unique SystemId for "manually triggered systems" and "reactions", but I'm happy to just re-add that if/when its actually needed. SystemId has been dead code since bevy_ecs's inception. Removing it makes sense. |
|
bors r+ |
|
Lol I have a nasty habit of not checking CI before bors-ing. You should just swap out the |
# Objective
Fixes these issues:
- `WorldId`s currently aren't necessarily unique
- I want to guarantee that they're unique to safeguard my librarified version of #2805
- There probably hasn't been a collision yet, but they could technically collide
- `SystemId` isn't used for anything
- It's no longer used now that `Locals` are stored within the `System`.
- `bevy_ecs` depends on rand
## Solution
- Instead of randomly generating `WorldId`s, just use an incrementing atomic counter, panicing on overflow.
- Remove `SystemId`
- We do need to allow Locals for exclusive systems at some point, but exclusive systems couldn't access their own `SystemId` anyway.
- Now that these don't depend on rand, move it to a dev-dependency
## Todo
Determine if `WorldId` should be `u32` based instead
|
Build failed (retrying...): |
# Objective
Fixes these issues:
- `WorldId`s currently aren't necessarily unique
- I want to guarantee that they're unique to safeguard my librarified version of #2805
- There probably hasn't been a collision yet, but they could technically collide
- `SystemId` isn't used for anything
- It's no longer used now that `Locals` are stored within the `System`.
- `bevy_ecs` depends on rand
## Solution
- Instead of randomly generating `WorldId`s, just use an incrementing atomic counter, panicing on overflow.
- Remove `SystemId`
- We do need to allow Locals for exclusive systems at some point, but exclusive systems couldn't access their own `SystemId` anyway.
- Now that these don't depend on rand, move it to a dev-dependency
## Todo
Determine if `WorldId` should be `u32` based instead
|
Build failed: |
|
That's annoying - I even knew that lint would trigger but forgot to deal with it. I explicitly chose not to make it a I still expose the constructor function publicly because it could be used e.g. for tests in external crates, although I'm not certain that's really needed. |
Delete SystemId Also remove `rand` as a normal dependency 🎉 Change WorldId to use usize Add tests and a module for `WorldId`
3f65af8 to
4e84649
Compare
|
bors r+ |
# Objective
Fixes these issues:
- `WorldId`s currently aren't necessarily unique
- I want to guarantee that they're unique to safeguard my librarified version of #2805
- There probably hasn't been a collision yet, but they could technically collide
- `SystemId` isn't used for anything
- It's no longer used now that `Locals` are stored within the `System`.
- `bevy_ecs` depends on rand
## Solution
- Instead of randomly generating `WorldId`s, just use an incrementing atomic counter, panicing on overflow.
- Remove `SystemId`
- We do need to allow Locals for exclusive systems at some point, but exclusive systems couldn't access their own `SystemId` anyway.
- Now that these don't depend on rand, move it to a dev-dependency
## Todo
Determine if `WorldId` should be `u32` based instead
Objective
Fixes these issues:
WorldIds currently aren't necessarily uniqueSystemIdisn't used for anythingLocalsare stored within theSystem.bevy_ecsdepends on randSolution
WorldIds, just use an incrementing atomic counter, panicing on overflow.SystemIdSystemIdanyway.Todo
Determine if
WorldIdshould beu32based instead