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

First class support for spawning structures of multiple entities that can be linked together. #6250

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhedgeco
Copy link

Objective

  • Adds first class support for structures of entities/components via 'blueprints' (name subject to change)
  • Allows spawning 'blueprints' in a way that is consistent with spawning bundles or components.

Solution

  • Uses a trait EntityBlueprint that can be implemented for any given struct.
  • struct can be used to hold spawning parameters, or settings for the blueprint
  • implementing EntityBlueprint requires defining fn build(self, entity: &mut EntityCommands) which is where the structure of the entity and its relations are built.
  • Added a function spawn_blueprint into the impl Commands that accepts a EntityBlueprint, similar to spawning a bundle or component.

Notes

All of this is very rudimentary and is mainly intended to be a starting point for discussion about not only the method of implementation, but the necessity for one.

@alice-i-cecile alice-i-cecile added C-Enhancement A new feature A-ECS Entities, components, systems, and events A-Scenes Serialized ECS data stored on the disk labels Oct 13, 2022
@alice-i-cecile alice-i-cecile added the X-Controversial There is active debate or serious implications around merging this PR label Oct 13, 2022
@alice-i-cecile
Copy link
Member

Initial discussion of the idea on Discord. This is quite contentious, and we want to have a clear vision for how this fits in with scenes (both on-disk and at compile time).

Copy link
Contributor

@Weibye Weibye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this for its simplicity! I'm sure it can be further improved but this is something we could start using and getting benefits from today.

I would love to see an example of how this looks when defining a blueprint using scene assets. Has there been any thoughts on that yet?

@Weibye
Copy link
Contributor

Weibye commented Jan 11, 2023

@rhedgeco, I've started exploring this idea in my Bevy Widget exploration: Weibye/bevy-prot-widgets#17

If you take a look at the PR you can see how this can look like a bit fleshed out, but I think I need to get more complicated examples and structures in place before we can really see the implications on whether this is a good design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events A-Scenes Serialized ECS data stored on the disk C-Enhancement A new feature X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants