-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
A-AppBevy apps and pluginsBevy apps and pluginsA-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsA-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-StatesApp-level states machinesApp-level states machinesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useX-ControversialThere is active debate or serious implications around merging this PRThere is active debate or serious implications around merging this PR
Description
Problem
- Startup systems are largely special-cased, they rely on custom stage implementations and it's quite hard to teach the model.
- It is challenging to ensure appropriate cleanup of resources on
AppExit: we must listen for the event and carefully time the resources.
Proposed solution
/// A built-in game state that controls app control flow
///
/// This is enabled by default, and user systems are added to the `Main` variant by default
enum AppState {
Startup,
Main,
Exit,
}This allows us to use standard on-enter, on-exit and state transition methods to control things like asset loading, cleanup, pausing the game, autosaving on exit and so on.
Extensions
We could add an explicit asset loading state as well. This may work well, but could be controversial.
Context
Discussed with @IceSentry on Discord after trying to help a user ensure data is cleaned up correctly.
This builds on but does not require the patterns espoused by the [Stageless RFC}(https://github.com/bevyengine/rfcs/pull/45).
Would address #1353. If we were to implement this, we would likely want to have a more robust event strategy by default, to ensure that gameplay events do not get lost during a pause.
Metadata
Metadata
Assignees
Labels
A-AppBevy apps and pluginsBevy apps and pluginsA-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsA-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-StatesApp-level states machinesApp-level states machinesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useX-ControversialThere is active debate or serious implications around merging this PRThere is active debate or serious implications around merging this PR
Type
Projects
Status
Needs Implementation