Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Commit

Permalink
Big reorg and cleanup (#107)
Browse files Browse the repository at this point in the history
* Simplifying camera code

* Refactoring apartment action overlay for medidation and sleeping

* Supporting Self Modulate property in Godot

* Simplified transition stack

* Using Godot Node2D to set up points around the map

* Removing apartment and downtown store in favor of matching on transition

* Simplifying by assuming Winnie to be the player - always

* Moving common_top_down and common_rscn to main_game_lib

* Renaming apartment scene to building1_player_floor scene and Apartment to Building1PlayerFloor

* Updating dependencies

* Moving the elevator cutscene to a reusable module
  • Loading branch information
porkbrain authored Mar 27, 2024
1 parent 4056679 commit b2fffea
Show file tree
Hide file tree
Showing 141 changed files with 2,894 additions and 4,189 deletions.
533 changes: 269 additions & 264 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ members = [
"common/assets",
"common/loading_screen",
"common/physics",
"common/rscn",
"common/store",
"common/story",
"common/top_down",
"common/visuals",
"main_game_lib",
"main_game",
"scenes/apartment",
"scenes/dev_playground",
"scenes/building1_player_floor",
"scenes/downtown",
"scenes/meditation",
"scenes/building1_basement1",
]


Expand Down Expand Up @@ -55,8 +53,8 @@ leafwing-input-manager = "0.13"
# > Error adding plugin bevy_egui::EguiPlugin: : plugin was already added in application
bevy_egui = "0.25"

scene_apartment = { path = "scenes/apartment" }
scene_dev_playground = { path = "scenes/dev_playground" }
scene_building1_basement1 = { path = "scenes/building1_basement1" }
scene_building1_player_floor = { path = "scenes/building1_player_floor" }
scene_downtown = { path = "scenes/downtown" }
scene_meditation = { path = "scenes/meditation" }

Expand All @@ -67,10 +65,8 @@ common_assets = { path = "common/assets" }
common_ext = { path = "common/ext" }
common_loading_screen = { path = "common/loading_screen" }
common_physics = { path = "common/physics" }
common_rscn = { path = "common/rscn" }
common_store = { path = "common/store" }
common_story = { path = "common/story" }
common_top_down = { path = "common/top_down" }
common_visuals = { path = "common/visuals" }
main_game_lib = { path = "main_game_lib" }

Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Run `$ ./bin/wiki` to open the game's [wiki](wiki/README.md) locally in your bro

# Repo organization

There are crates in the [`common`](common/) directory that help with [animation](common/visuals/), [input handling](common/action/), [loading screen](common/loading_screen/), [map layout, npc and player control](common/top_down/) and more.
There are crates in the [`common`](common/) directory that help with [animation](common/visuals/), [input handling](common/action/), [loading screen](common/loading_screen/), and more.
These crates typically either export plugins or systems that one has to register themselves.

Then there's the [main game lib](main_game_lib/).
This crate exports logic that did not fit into the common crates.
For example, the `GlobalGameState` enum that directs the game flow lives here.
For example, the `GlobalGameState` enum that directs the game flow lives here, or map layout, npc and player control.
It also sets up default plugins and alike.

Then we have the [scenes](scenes/).
Expand Down Expand Up @@ -43,10 +43,3 @@ With every extra dependency that also depends on Bevy it potentially takes longe

Some crates export `devtools` feature that enable additional debug and/or dev tooling functionality.
For example, the [`common/top_down`](common/top_down/) crate has a `devtools` feature that spawns a grid of tiles to help with level design.

There's also a whole dedicated scene for prototyping and testing: [`scenes/dev_playground`](scenes/dev_playground/).
Run this scene with `$ ./bin/dev_playground`.

We use Godot's editor to manage scenes.
The exported `.tscn` files are then loaded and spawned by the game.
See the wiki and [`common/rscn` crate](common/rscn/) for more information.
3 changes: 0 additions & 3 deletions bin/dev_playground

This file was deleted.

15 changes: 0 additions & 15 deletions common/assets/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ pub mod fonts {
pub const TINY_PIXEL1: &str = "fonts/tiny_pixel.ttf";
}

pub mod apartment {
pub const FOLDER: &str = "apartment";
pub const MAP: &str = "maps/apartment.ron";
pub const SCENE: &str = "scenes/apartment.ron";

pub const WINNIE_SLEEPING: &str = "apartment/sleeping.png";
pub const WINNIE_MEDITATING: &str = "apartment/meditating.png";
}

pub mod downtown {
pub const FOLDER: &str = "downtown";
pub const BG: &str = "downtown/bg.png";
pub const MAP: &str = "maps/downtown.ron";
}

pub mod meditation {
pub const FOLDER: &str = "meditation";

Expand Down
13 changes: 0 additions & 13 deletions common/rscn/Cargo.toml

This file was deleted.

14 changes: 0 additions & 14 deletions common/rscn/README.md

This file was deleted.

68 changes: 0 additions & 68 deletions common/store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,74 +140,6 @@ mod inspect_ability {
}
}

pub use apartment::ApartmentStore;
mod apartment {
use std::time::Duration;

use super::*;

/// Apartment store data.
pub trait ApartmentStore {
/// When the player loads the apartment, where should they be?
fn position_on_load(&self) -> Entry<'_, Vec2>;

/// When the player loads the apartment, where should they walk to?
/// This creates a nice effect of the player walking to the apartment.
fn walk_to_onload(&self) -> Entry<'_, Vec2>;

/// When the player loads the apartment, how fast should they walk?
fn step_time_onload(&self) -> Entry<'_, Duration>;
}

impl ApartmentStore for GlobalStore {
fn position_on_load(&self) -> Entry<'_, Vec2> {
self.entry("apartment.position_on_load")
}

fn walk_to_onload(&self) -> Entry<'_, Vec2> {
self.entry("apartment.walk_towards_onload")
}

fn step_time_onload(&self) -> Entry<'_, Duration> {
self.entry("apartment.step_time_onload")
}
}
}

pub use downtown::DowntownStore;
mod downtown {
use std::time::Duration;

use super::*;

/// Downtown store data.
pub trait DowntownStore {
/// When the player loads the downtown, where should they be?
fn position_on_load(&self) -> Entry<'_, Vec2>;

/// When the player loads the downtown, where should they walk to?
/// This creates a nice effect of the player walking to the downtown.
fn walk_to_onload(&self) -> Entry<'_, Vec2>;

/// When the player loads the downtown, how fast should they walk?
fn step_time_onload(&self) -> Entry<'_, Duration>;
}

impl DowntownStore for GlobalStore {
fn position_on_load(&self) -> Entry<'_, Vec2> {
self.entry("downtown.position_on_load")
}

fn walk_to_onload(&self) -> Entry<'_, Vec2> {
self.entry("downtown.walk_towards_onload")
}

fn step_time_onload(&self) -> Entry<'_, Duration> {
self.entry("apartment.step_time_onload")
}
}
}

pub use dialog::DialogStore;
mod dialog {
use super::*;
Expand Down
7 changes: 4 additions & 3 deletions common/story/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version.workspace = true
edition.workspace = true


[features]
devtools = ["bevy-inspector-egui"]


[dependencies]
bevy-inspector-egui = { workspace = true, optional = true }
bevy.workspace = true
Expand All @@ -18,6 +22,3 @@ serde_with.workspace = true
strum.workspace = true
thiserror.workspace = true
toml.workspace = true

[features]
devtools = ["bevy-inspector-egui"]
37 changes: 0 additions & 37 deletions common/top_down/Cargo.toml

This file was deleted.

12 changes: 0 additions & 12 deletions common/top_down/README.md

This file was deleted.

Loading

0 comments on commit b2fffea

Please sign in to comment.