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

Entities that refer to other entities #21

Closed
idanarye opened this issue Apr 13, 2023 · 4 comments
Closed

Entities that refer to other entities #21

idanarye opened this issue Apr 13, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@idanarye
Copy link
Owner

idanarye commented Apr 13, 2023

Some entities need to refer to other entities. For example - a key that opens a specific door. We need a way to represent this and to provide UI for editing this.

@idanarye
Copy link
Owner Author

Entities should obviously get serializable IDs - Bevy's builtin Entity won't work because we can not guarantee the relevant IDs are not in use when a level is loaded from scratch. So probably a UUID.

There is no need to give every entity a UUID, and this can be done in Vpeol - say with a struct VpeolUuid(Uuid) component. Any entity that has that component will automatically get a UUID assigned to it - this is not something the level-editor can edit (unless they manipulate the .yol files). Additionally, Vpeol will maintain a UUID->entity hashmap, so that entities that refer to other entities that refer to a VpeolUuid entity can quickly find it. This hashmap will be populated in a populate system (a bit misleading, since it does not populate the entity's components, but it still populates a resource so this kind of works) that runs before all the other populate systems - so that they can all depend on it.

@idanarye idanarye added the enhancement New feature or request label Apr 13, 2023
@idanarye
Copy link
Owner Author

#22 (comment)

@idanarye
Copy link
Owner Author

If I want to use that for #23, it can't be in Vpeol - it has to be part of Yoleck itself. So YoleckUuid instead of VpeolUuid. And maybe YoleckUuid should not be a YoleckComponent. Actually - does it even have to be a Bevy component of its own?

@idanarye
Copy link
Owner Author

This is a dup of #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant