diff --git a/main_game_lib/src/hud/daybar.rs b/main_game_lib/src/hud/daybar.rs index 381d31a4..bbffa701 100644 --- a/main_game_lib/src/hud/daybar.rs +++ b/main_game_lib/src/hud/daybar.rs @@ -21,6 +21,8 @@ pub struct DayBar { pub enum IncreaseDayBarEvent { /// Non trivial scene transition, such as leaving a building. ChangedScene, + /// Finished meditating. + Meditated, } #[derive(Component)] @@ -87,6 +89,7 @@ pub(crate) fn increase( for event in events.read() { let amount = match event { IncreaseDayBarEvent::ChangedScene => 0.01, + IncreaseDayBarEvent::Meditated => 0.05, }; daybar.progress = (daybar.progress + amount).clamp(0.0, 1.0); diff --git a/scenes/building1_player_floor/src/layout.rs b/scenes/building1_player_floor/src/layout.rs index 291d303d..140466ff 100644 --- a/scenes/building1_player_floor/src/layout.rs +++ b/scenes/building1_player_floor/src/layout.rs @@ -7,6 +7,7 @@ use main_game_lib::{ cutscene::enter_an_elevator::{ start_with_open_elevator_and_close_it, STEP_TIME_ON_EXIT_ELEVATOR, }, + hud::daybar::IncreaseDayBarEvent, top_down::actor::player::TakeAwayPlayerControl, }; use rscn::{NodeName, TscnSpawner, TscnTree, TscnTreeHandle}; @@ -84,6 +85,7 @@ struct Spawner<'a> { player_builder: &'a mut CharacterBundleBuilder, asset_server: &'a AssetServer, atlases: &'a mut Assets, + daybar_event: &'a mut Events, tilemap: &'a mut TileMap, zone_to_inspect_label_entity: &'a mut ZoneToInspectLabelEntity, @@ -98,6 +100,7 @@ fn spawn( mut tscn: ResMut>, mut atlas_layouts: ResMut>, mut tilemap: ResMut>, + mut daybar_event: ResMut>, mut q: Query<&mut TscnTreeHandle>, ) { @@ -114,6 +117,7 @@ fn spawn( player_entity: player, player_builder: &mut player_builder, asset_server: &asset_server, + daybar_event: &mut daybar_event, atlases: &mut atlas_layouts, tilemap: &mut tilemap, zone_to_inspect_label_entity: &mut zone_to_inspect_label_entity, @@ -208,6 +212,8 @@ impl<'a> TscnSpawner for Spawner<'a> { )); self.player_builder .initial_step_time(STEP_TIME_ONLOAD_FROM_MEDITATION); + + self.daybar_event.send(IncreaseDayBarEvent::Meditated); } "NewGameSpawn" if self.transition == NewGameToBuilding1PlayerFloor => diff --git a/scenes/downtown/src/layout.rs b/scenes/downtown/src/layout.rs index 52221a71..430eb799 100644 --- a/scenes/downtown/src/layout.rs +++ b/scenes/downtown/src/layout.rs @@ -3,7 +3,7 @@ use bevy_grid_squared::sq; use common_loading_screen::{LoadingScreenSettings, LoadingScreenState}; use common_visuals::camera::render_layer; use main_game_lib::{ - cutscene::in_cutscene, hud::daybar, + cutscene::in_cutscene, hud::daybar::IncreaseDayBarEvent, top_down::inspect_and_interact::ZoneToInspectLabelEntity, }; use rscn::{NodeName, TscnSpawner, TscnTree, TscnTreeHandle}; @@ -53,7 +53,7 @@ struct Spawner<'a> { player_builder: &'a mut CharacterBundleBuilder, player_entity: Entity, transition: GlobalGameStateTransition, - daybar_event: &'a mut Events, + daybar_event: &'a mut Events, zone_to_inspect_label_entity: &'a mut ZoneToInspectLabelEntity, } @@ -66,7 +66,7 @@ fn spawn( mut tscn: ResMut>, mut atlas_layouts: ResMut>, transition: Res, - mut daybar_event: ResMut>, + mut daybar_event: ResMut>, mut q: Query<&mut TscnTreeHandle>, ) { @@ -135,8 +135,7 @@ impl<'a> TscnSpawner for Spawner<'a> { + sq(0, -2), )); - self.daybar_event - .send(daybar::IncreaseDayBarEvent::ChangedScene); + self.daybar_event.send(IncreaseDayBarEvent::ChangedScene); } "MallEntrance" if self.transition == MallToDowntown => { self.player_builder.initial_position(translation.truncate()); @@ -144,6 +143,8 @@ impl<'a> TscnSpawner for Spawner<'a> { LAYOUT.world_pos_to_square(translation.truncate()) + sq(0, -2), )); + + self.daybar_event.send(IncreaseDayBarEvent::ChangedScene); } _ => {} } diff --git a/wiki/src/SUMMARY.md b/wiki/src/SUMMARY.md index f512c4f5..c5966b47 100644 --- a/wiki/src/SUMMARY.md +++ b/wiki/src/SUMMARY.md @@ -2,6 +2,8 @@ - [Introduction](intro.md) - [Phone](phone.md) +- [The Daybar](daybar.md) +- [Traits](traits.md) - [Top down scenes](top_down.md) - [Inspect ability](ability_to_inspect.md) - [Devtools](devtools.md) diff --git a/wiki/src/daybar.md b/wiki/src/daybar.md new file mode 100644 index 00000000..42878764 --- /dev/null +++ b/wiki/src/daybar.md @@ -0,0 +1,38 @@ +# The Daybar + +The daybar is a HUD element resembling a progress bar. +It shows how much of the day has passed and how much remains. + +Before defining how time works in _Don't Count the Sheep_, let's take a look at how time is measured in other games. + +## Time Measurement in Other Games + +In Stardew Valley, the game operates on a day-night cycle starting at 6:00 AM and ending at 2:00 AM. +Each in-game day lasts approximately 10 minutes, during which players must manage their daily energy expenditure by performing various actions. + +Baldur's Gate 3 does not utilize a traditional time measurement system. +Instead, players are provided with 3 short rests per day, followed by the option to conclude the day with a long rest. +Action points are expended throughout the day, with some resetting after short rests and others after long rests. + +Skyrim also incorporates a day-night cycle, affecting gameplay such as shop availability and merchant restocking. +Players have the option to rest or sleep, allowing them to choose the number of hours to pass. + +In Knight of Honour 2, time management is flexible, allowing players to pause or accelerate time according to their preferences. +This feature enables players to strategize and plan their actions at their own pace. + +## Time Measurement in _Don't Count the Sheep_ + +In _Don't Count the Sheep_, time is primarily segmented into days, with each day commencing when the character wakes up and concluding when the character goes to sleep. +Unlike traditional clock-based systems, there is no constant ticking of seconds; instead, time progresses as the player takes actions. +Essentially, we intertwine the concept of energy with time, granting players greater control over the pace of time advancement. +For example, players can reorganize their inventory in peace at the end of the day, a task that would be stressful in Stardew Valley. + +NPCs within the game adhere to their own schedules, often influenced by the time of day. +Since time progression is contingent upon player actions, NPC behavior dynamically adjusts based on the player's activities throughout the day. + +- [ ] There would be various instruments that could change how much time would be consumed by specific actions. + Instruments could include [traits][traits], consumables, events, quests, etc. + + + +[traits]: traits.md diff --git a/wiki/src/traits.md b/wiki/src/traits.md new file mode 100644 index 00000000..1333ed77 --- /dev/null +++ b/wiki/src/traits.md @@ -0,0 +1 @@ +TODO