-
Notifications
You must be signed in to change notification settings - Fork 84
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
Entity ID assignment #77
Comments
I don't know if I'm missing anything, because in the documentation it says that entities that are living are guaranteed not to share an ID, but it doesn't seem like anything is done to guarantee this. If the code does need to be changed, my main hangup is how to do it efficiently. The simple thing would be to have an |
Nevermind, I just noticed this is included as part of #71. |
Just in case it wasn't clear, the code you're citing is from Bevy's fork; hecs assigns guaranteed-unique IDs, mediated via the internal |
It bears mentioning that a recent development moved Bevy back to generational IDs. |
I noticed that entity IDs are assigned randomly:
I'm concerned about this. I implemented the equations from the birthday paradox using this Python script:
According to the results, a program that spawns 1000 entities will contain at least 1 duplicate ID every
8599.03
times it is run, on average. A more impractical application that spawns 10,000 entities will contain at least 1 duplicate ID every86.41
times it is run. I'm currently experimenting with the Bevy engine and would be interested in creating a pull request to fix the problem. I am making this issue to collect any input from current project maintainers for things I should keep in mind or look out for as I am not particularly familiar with the codebase.The text was updated successfully, but these errors were encountered: