-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Label entities by the component bundles they have for clearer inspection #1958
Comments
Using strings for label, we have the |
Functionally this sounds identical to zero-sized marker components, which are cheap, queryable, integrate with scenes, and already have all relevant CRUD ops defined. It sounds like this is largely a categorization issue? Ex: maybe we need a way to promote specific component types to "labels" for things like editors? |
lol you already covered this. i guess i glazed over it 😄 |
Maybe we could just track "bundle components" somewhere? Ex: we could just add |
Yeah, I'm leaning towards this as my preferred flavor of solution. I'm definitely in favor of trying to integrate this smoothly with minimal API changes. This isn't urgent or very impactful, but it could be a nice QoL feature once we have an editor.
What if we had an |
My problem with this is that it adds a new "Identifier" concept, which I'm not convinced we need. Bundles seem like a pretty reasonable "identifier" as-is. They denote that the entity was created for a specific purpose. Yes, there can be multiple bundles per entity, but we'd almost certainly want to support multiple "identifiers" anyway. |
Definitely agree.
I think that's fair, but I'm not sure what information you'd extract from them to display. The bundle name, and then all of your identifiers are |
I think you'd want to track this at the entity level, and set a special "bundle labels" field or something when you use |
Yeah I think this should be entity level. If someone happens to spawn the same components a bundle has, I don't think that should be "auto labeled" with that bundle. I personally think inserting a special "bundle component" is the best way to do this. |
That brings up something I've wondered about: why do bundles have to be named But I still feel the need to add the suffix. I think this might be a subconscious attempt to avoid accidentally using a That aside: I like the idea of using |
Its largely an issue of namespacing. If we have a Theres also the secondary issue of "using bundles as components and vice-versa", which might be solved by #1843, but even with that I'm still very much in favor of the *Bundle suffix.
Agreed. I've been planning on using Bundles for a number of things for awhile now:
|
Hmm, I'd be interested in discussing this further, but I don't want to derail this bug any more than I already have. And it may be partly my unfamiliarity with Rust community practices showing here: I've read through the API Guidelines, but they are pretty sparse compared to, eg, what I'm familiar with in Go land. On this question, for instance, there's is very complete guidance in a widely cited blog post and in Effective Go docs. Is there a better forum to continue this discussion, or any community docs that you think would be a helpful reference? (or if you don't think it's worth the time, I'll drop it) |
@concave-sphere #1247 would be an appropriate place to discuss this, or a seperate issue would be fine if you'd prefer :) |
What problem does this solve or what need does it fill?
When inspecting entities for debugging or as part of an editor, it can often be challenging to quickly get a a sense of what "kind" of entity it is.
Right now, you can either inspect it visually, or pore through its (long) list of components. This will become unwieldy when we need things like tooltip displays.
What solution would you like?
Create "entity labels", which are many-to-many and use the same type magic as e.g. system and stage labels.
These can be added to the AppBuilder with the
label_entities(bundle: impl Bundle)
.Each entity will have a "labels" field, which will show all relevant labels in alphabetical order (there should only be one in most cases). A label is relevant to an entity if it has all of the components in that bundle.
These will be almost entirely for display purposes. Under the hood, this can be computed and stored on a per archetype level.
Depending on their cost, we may want to only enable these during debug builds.
What alternative(s) have you considered?
Somehow designate a specific component as being "defining", or specify a priority of these.
Additional context
These will be used in close association with archetype invariants (#1481). We should ensure that the syntax and location of these are closely tied.
These bundles will commonly be reused for kinded entities; it may be correct to allow syntactic sugar to allow their specification via these entity labels.
In theory we could use query filters to search for these entities. I'm not entirely convinced by this plan, but it's not the worst idea.
The text was updated successfully, but these errors were encountered: