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

0.13 migration: Add section for entity niche optimization #1029

Open
rparrett opened this issue Feb 19, 2024 · 5 comments
Open

0.13 migration: Add section for entity niche optimization #1029

rparrett opened this issue Feb 19, 2024 · 5 comments
Labels
A-Migration Guides C-Correction A typo or factual issue in what we've written

Comments

@rparrett
Copy link
Contributor

rparrett commented Feb 19, 2024

Migration guide generator didn't catch

bevyengine/bevy#9907

Because it's unlabeled and the formatting of the description isn't correct.

Unfortunately, the migration section in the description doesn't actually offer any advice for migration, so we'll need to write some.

I'm not actually sure how people can migrate this, other than recreating their scenes. It might be possible to create a small program/script/abuse awk to bit-twiddle entity ids in scene files.

See bevyengine/bevy#11289 for an example of fixing a scene file.

More context: https://discord.com/channels/691052431525675048/1209244908372627507

@alice-i-cecile alice-i-cecile added A-Migration Guides C-Correction A typo or factual issue in what we've written labels Feb 19, 2024
@Testare
Copy link

Testare commented Feb 19, 2024

If you can find all places where there is an entity ID in the scene file, you can add 2^32 to the number (4294967296) or "10000000000" if you want to make it easier to keep different entities distinct to readers. If you have an exceptionally large file or you can't identify all places where you are serializing entities... Then I think you're up a creek w/o a paddle.

In any case, as we are trying to move towards better scene files, I think that having to use such huge numbers for entities is a serious step back =/ I understand using NonZeroU32 for generation helps memory optimization, and using it for generation instead of index was less difficult, I think we need to have some way to represent entities in scene files with numbers at least as low as "1," especially since these entities are intended to be mapped to real entities later.

@Testare
Copy link

Testare commented Feb 19, 2024

Also while we're updating the migration guide, the migration guide entry for updating the serialization of Name component seems to be incorrect.

@rparrett
Copy link
Contributor Author

@irate-devil

What did you mean by

Yep. This entire way of serializing entities is terribly flawed, but the example exists as-is so it's better if it actually works.
Certified jank :')

In the issue linked above, and would you have anything to add to a migration guide entry for this PR related to that?

@rparrett
Copy link
Contributor Author

Also while we're updating the migration guide, the migration guide entry for updating the serialization of Name component seems to be incorrect.

That's a confusing one. Opened a separate issue: #1030

@rparrett rparrett changed the title 0.13 migration: Add section for scene niche optimization 0.13 migration: Add section for entity niche optimization Feb 19, 2024
@notverymoe
Copy link

notverymoe commented Feb 20, 2024

Talking on discord, there's some hesitancy to offer migration tools. It seems like the migration guide's entry should read something along the lines of "Recreate your scenes, sorry. You can try to manually offset the ids if you want". If one were to create an automatic tool, the easiest path is probably to patch bevy (for the tool specifically) to modify the Entity deserialize to increment the generation, deserialize the scene, reserialize, save - should cover most basic cases. There was a brief mention that we should considering looking at some alternative to Entity as an identifier in scenes/networking, since the internals of Entity are an implementation detail and inherently kinda volatile, nothing set in motion from that, but yeah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Migration Guides C-Correction A typo or factual issue in what we've written
Projects
None yet
Development

No branches or pull requests

4 participants