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

Make templates immutable components that apply themselves via hooks #13

Open
alice-i-cecile opened this issue Dec 18, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@alice-i-cecile
Copy link
Contributor

From https://discord.com/channels/691052431525675048/1318745402199113859/1318794634817962007

@alice-i-cecile alice-i-cecile added the enhancement New feature or request label Dec 18, 2024
@JMS55
Copy link

JMS55 commented Jan 12, 2025

The only issue with this is specifying when the templates get updated.

Presumably users would spawn an entity with a template component, and then there would be a system that each frames iterates over all template entities and re-runs the template build. However users probably want control over when those systems run.

Probably you could have a system for each of the built-in schedules (Update, PostUpdate, etc), and then have people parameterize their template component like struct AutoBuildingTemplate<S: ScheduleLabel> { template: Template }. Each system can then iterate only over the matching components.

For more manual control over scheduling and system ordering, users could add their own systems like they do now.

@JMS55
Copy link

JMS55 commented Jan 12, 2025

The other issue actually is that AutoBuildingTemplate won't have access to any system params for reading ECS data.

Potentially instead of storing a Template directly, it should store Box<dyn Fn(&World) -> Template>, and the templates get updated in an exclusive system. That's how I've done it in bevy_dioxus and similar.

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

3 participants