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

Hot-reload support for Bevy ECS systems #15613

Open
kaphula opened this issue Oct 3, 2024 · 1 comment
Open

Hot-reload support for Bevy ECS systems #15613

kaphula opened this issue Oct 3, 2024 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Needs-Design This issue requires design work to think about how it would best be accomplished

Comments

@kaphula
Copy link

kaphula commented Oct 3, 2024

What problem does this solve or what need does it fill?

Fast iteration speed is crucial for successful game development. With Rust, the compilation speed can be much worse compared to other programming languages which makes tasks like tweaking minor game details such as UI or AI behavior tedious. Having the ability to compile functions on the fly while the game is running, even if for the very specific portions of the project, helps.

What solution would you like?

An ability to mark certain Bevy ECS systems as hot-reloadable and have them recompile themselves during runtime when they are changed. Naturally you cannot change the systems' type definitions without recompiling the whole project. To my understanding, this also requires advanced project setup with multiple crates so that the systems can be placed on to a separate crate which will compiled to dynamic library during runtime. Therefore, this would probably be an advanced feature only for users of Bevy ECS crate and not whole Bevy.

What alternative(s) have you considered?

There is a crate called hot-lib-reloader-rs that demonstrates how Bevy systems can be hot-reloaded during runtime. This works only partially, there are issues when you try to hot-reload system that modify resources or use commands. I have created a repo/branch that demonstrates this issue, more details can be found here.

@kaphula kaphula added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Oct 3, 2024
@LiamGallagher737 LiamGallagher737 added A-ECS Entities, components, systems, and events D-Complex Quite challenging from either a design or technical perspective. Ask for help! and removed S-Needs-Triage This issue needs to be labelled labels Oct 7, 2024
@angelorodem
Copy link

angelorodem commented Jan 5, 2025

This would be a nice feature to have, though I imagine that adding support for it is challenging and might require restructuring the project into a workspace. The hot-reloadable systems would need to be in a library crate, while the rest of the code resides in another, which could make the code structure a bit messy.

I'm quite new to macro development, but if we could have a #[derive(System)] or #[derive(Reloadable)] attribute that automatically adds #[no_mangle] to a system and seamlessly moves it into a hot-reloadable library, that would be the best-case scenario.

Additionally, this should probably be a feature included only in debug builds. I imagine having a watcher running in release builds would be completely unnecessary.

@TimJentzsch TimJentzsch added the S-Needs-Design This issue requires design work to think about how it would best be accomplished label Jan 5, 2025
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 C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Needs-Design This issue requires design work to think about how it would best be accomplished
Projects
None yet
Development

No branches or pull requests

4 participants