Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,980 changes: 1,402 additions & 578 deletions Cargo.lock

Large diffs are not rendered by default.

87 changes: 42 additions & 45 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
[package]
name = "jumpy"
version = "0.5.1"
description = "A tactical 2D shooter"
authors = ["The Fish Fight Game & Spicy Lobster Developers"]
license = "MIT OR Apache-2.0"
edition = "2021"
authors = ["The Fish Fight Game & Spicy Lobster Developers"]
default-run = "jumpy"
description = "A tactical 2D shooter"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "jumpy"
version = "0.5.1"

[features]
default = ["render"]
render = [
"bevy/x11",
"bevy/png",
"bevy/filesystem_watcher",
"bevy/bevy_gilrs",
]
render = ["bevy/x11", "bevy/png", "bevy/filesystem_watcher", "bevy/bevy_gilrs"]

[dependencies]
anyhow = "1.0.58"
async-channel = "1.7.1"
base64 = "0.13.0"
bevy-inspector-egui = { version = "0.13.0" }
bevy-parallax = "0.2.0"
bevy_ecs_dynamic = { git = "https://github.com/jakobhellermann/bevy_ecs_dynamic", rev = "aa7a051a49bd134cfd8c169542e16526bf2b36b3" }
bevy_ecs_tilemap = { version = "0.7.0", features = ["atlas"] }
bevy_egui = "0.16.1"
bevy_fluent = "0.4.0"
bevy_framepace = "0.7"
bevy_ggrs = { git = "https://github.com/zicklag/bevy_ggrs.git", branch = "jumpy" }
bevy_kira_audio = { version = "0.12.0", features = ["ogg"], default-features = false }
anyhow = "1.0.58"
async-channel = "1.7.1"
base64 = "0.20"
bevy-inspector-egui = { version = "0.16" }
bevy-parallax = "0.3.0"
bevy_ecs_dynamic = { git = "https://github.com/jakobhellermann/bevy_ecs_dynamic" }
bevy_ecs_tilemap = { version = "0.9.0", features = ["atlas"] }
bevy_egui = "0.18"
bevy_fluent = "0.5"
bevy_framepace = "0.9"
bevy_ggrs = { git = "https://github.com/zicklag/bevy_ggrs.git", branch = "jumpy" }
bevy_kira_audio = { version = "0.13", features = ["ogg"], default-features = false }
# bevy_mod_js_scripting = { git = "https://github.com/zicklag/bevy_mod_js_scripting.git", branch = "jumpy" }
bevy_prototype_lyon = "0.6.0"
bevy_system_graph = "0.3.0"
bevy_tweening = { version = "0.5", default-features = false }
bevy_prototype_lyon = "0.7"
bevy_system_graph = "0.4"
bevy_tweening = { version = "0.6", default-features = false }
bitfield = "0.14.0"
blocking = "1.2.0"
bones_has_load_progress = { git = "https://github.com/fishfolk/bones.git", features = ["bevy_egui"] }
bones_matchmaker_proto = { git = "https://github.com/fishfolk/bones.git" }
bones_camera_shake = { git = "https://github.com/DRuppFv/bones", branch = "camera_shake_bevy0.8" }
bones_has_load_progress = { git = "https://github.com/fishfolk/bones.git", features = [
"bevy_egui",
] }
bones_matchmaker_proto = { git = "https://github.com/fishfolk/bones.git" }
bytemuck = "1.12.3"
bytes = "1.2.1"
clap = { version = "4.0.18", features = ["derive", "env"] }
directories = "4.0.1"
egui_extras = "0.19.0"
egui_extras = "0.20"
either = "1.8.0"
fluent = "0.16.0"
fluent_content = "0.0.3"
fnv = "1.0.7"
futures-lite = "1.12.0"
getrandom = { version = "0.2", features = ["js"] }
iyes_loopless = "0.8.0"
leafwing-input-manager = { version = "0.6.1", default-features = false }
iyes_loopless = "0.9"
leafwing-input-manager = { version = "0.7", default-features = false }
log = { version = "0.4.17", features = ["release_max_level_debug"] }
mimalloc = { version = "0.1.32", default-features = false }
normalize-path = "0.2.0"
Expand All @@ -68,30 +66,29 @@ turborand = { version = "0.8.0", features = ["atomic", "serialize"] }
unic-langid = "0.9.0"

[dependencies.bevy]
version = "0.8"
default-features = false
features = [
"x11",
"png",
"filesystem_watcher",
"bevy_gilrs"
]
features = ["x11", "png", "filesystem_watcher", "bevy_gilrs"]
version = "0.9"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2.83"
web-sys = { version = "0.3", features = ["Window","Location","Storage"] }
web-sys = { version = "0.3", features = ["Window", "Location", "Storage"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
quinn = { version = "0.9", default-features = false, features = ["futures-io", "native-certs", "tls-rustls"] }
quinn = { version = "0.9", default-features = false, features = [
"futures-io",
"native-certs",
"tls-rustls",
] }
quinn_runtime_bevy = { git = "https://github.com/fishfolk/bones.git" }

[profile.dev.package."*"]
opt-level = 3 # Set this to 3 if the game becomes slow to respond during gameplay
debug = true
debug = true
opt-level = 3 # Set this to 3 if the game becomes slow to respond during gameplay

[profile.release]
lto = true
codegen-units = 1 # Improved rapier physics perf, so it might help other stuff, too
codegen-units = 1 # Improved rapier physics perf, so it might help other stuff, too
lto = true

[patch.crates-io]
# Fix for https://github.com/bevyengine/bevy/issues/6790
Expand Down
23 changes: 12 additions & 11 deletions src/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,20 @@ fn animate_sprites(
for (i, atlas) in pending_stacks.into_iter().enumerate() {
if let Some(atlas) = atlas {
let stack_ent = commands
.spawn()
.insert_bundle(SpriteSheetBundle {
texture_atlas: atlas.clone_weak(),
sprite: TextureAtlasSprite {
index: sprite_index,
flip_x: animated_sprite.flip_x,
flip_y: animated_sprite.flip_y,
.spawn((
SpriteSheetBundle {
texture_atlas: atlas.clone_weak(),
sprite: TextureAtlasSprite {
index: sprite_index,
flip_x: animated_sprite.flip_x,
flip_y: animated_sprite.flip_y,
..default()
},
transform: Transform::from_xyz(0.0, 0.0, (i + 1) as f32 * STACK_Z_DIFF),
..default()
},
transform: Transform::from_xyz(0.0, 0.0, (i + 1) as f32 * STACK_Z_DIFF),
..default()
})
.insert(StackedAtlas)
StackedAtlas,
))
.id();
commands.entity(sprite_ent).add_child(stack_ent);
}
Expand Down
13 changes: 13 additions & 0 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ impl AssetLoader for PlayerMetaLoader {
meta.spritesheet.tile_size.as_vec2(),
meta.spritesheet.columns,
meta.spritesheet.rows,
None,
None,
))
.with_dependency(atlas_path.clone()),
);
Expand All @@ -281,6 +283,8 @@ impl AssetLoader for PlayerMetaLoader {
meta.spritesheet.tile_size.as_vec2(),
meta.spritesheet.columns,
meta.spritesheet.rows,
None,
None,
)),
);
meta.spritesheet.decoration_handles.push(atlas_handle);
Expand Down Expand Up @@ -653,3 +657,12 @@ impl AssetLoader for EguiFontLoader {
&["ttf"]
}
}

#[derive(Debug, Clone, Resource, Deref, DerefMut)]
pub struct EguiFontDefinitions(pub egui::FontDefinitions);

impl EguiFontDefinitions {
pub fn get_fonts(&self) -> &egui::FontDefinitions {
&self.0
}
}
4 changes: 2 additions & 2 deletions src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ impl Plugin for AudioPlugin {
pub struct MusicChannel;
pub struct EffectsChannel;

#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, Resource)]
pub struct CurrentMusic {
pub instance: Handle<AudioInstance>,
pub idx: usize,
}

#[derive(Deref, DerefMut, Clone, Debug, Default)]
#[derive(Deref, DerefMut, Clone, Debug, Default, Resource)]
pub struct ShuffledPlaylist(pub Vec<Handle<AudioSource>>);

fn setup_audio_defaults(
Expand Down
63 changes: 33 additions & 30 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,47 @@ pub struct CameraBundle {

pub fn spawn_game_camera(commands: &mut Commands) -> Entity {
commands
.spawn_bundle(CameraBundle {
camera_bundle: Camera2dBundle {
// This is different than just omitting this transform field because
// Camera2DBundle's default transform is not the same as Transform::default().
transform: default(),
..default()
.spawn((
CameraBundle {
camera_bundle: Camera2dBundle {
// This is different than just omitting this transform field because
// Camera2DBundle's default transform is not the same as Transform::default().
transform: default(),
..default()
},
render_layers: RenderLayers::layer(GameRenderLayers::DEFAULT)
.with(GameRenderLayers::GAME),
parallax_camera_component: ParallaxCameraComponent,
},
render_layers: RenderLayers::layer(GameRenderLayers::DEFAULT)
.with(GameRenderLayers::GAME),
parallax_camera_component: ParallaxCameraComponent,
})
.insert(CameraShake::new(90.0, Vec2::splat(100.0), 0.5))
.insert(Name::new("Game Camera"))
.insert(GameCamera)
CameraShake::new(90.0, Vec2::splat(100.0), 0.5),
Name::new("Game Camera"),
GameCamera,
))
.id()
}

pub fn spawn_editor_camera(commands: &mut Commands) -> Entity {
commands
.spawn_bundle(CameraBundle {
camera_bundle: Camera2dBundle {
// This is different than just omitting this transform field because
// Camera2DBundle's default transform is not the same as Transform::default().
transform: default(),
camera: Camera {
// Disable editor camera by default
is_active: false,
..default()
.spawn((
CameraBundle {
camera_bundle: Camera2dBundle {
// This is different than just omitting this transform field because
// Camera2DBundle's default transform is not the same as Transform::default().
transform: default(),
camera: Camera {
// Disable editor camera by default
is_active: false,
..default()
},

render_layers: RenderLayers::layer(GameRenderLayers::DEFAULT)
.with(GameRenderLayers::EDITOR),
parallax_camera_component: ParallaxCameraComponent,
},
..default()
},

render_layers: RenderLayers::layer(GameRenderLayers::DEFAULT)
.with(GameRenderLayers::EDITOR),
parallax_camera_component: ParallaxCameraComponent,
})
.insert(Name::new("Editor Camera"))
.insert(EditorCamera)
Name::new("Editor Camera"),
EditorCamera,
))
.id()
}

Expand Down
13 changes: 7 additions & 6 deletions src/debug.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use bevy_inspector_egui::{WorldInspectorParams, WorldInspectorPlugin};
use bevy_inspector_egui::quick::WorldInspectorPlugin;

use crate::prelude::*;

pub struct DebugPlugin;

impl Plugin for DebugPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(WorldInspectorParams {
enabled: false,
..default()
})
.add_plugin(WorldInspectorPlugin::new());
app
// .insert_resource(WorldInspectorParams {
// enabled: false,
// ..default()
// })
.add_plugin(WorldInspectorPlugin::new());
}
}
28 changes: 14 additions & 14 deletions src/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use leafwing_input_manager::{
use crate::{
camera::{spawn_editor_camera, spawn_game_camera},
config::ENGINE_CONFIG,
metadata::{BorderImageMeta, GameMeta, PlayerMeta, Settings},
metadata::{BorderImageMeta, GameHandle, GameMeta, PlayerMeta, Settings},
platform::Storage,
player::{input::PlayerInputs, MAX_PLAYERS},
prelude::*,
Expand Down Expand Up @@ -44,13 +44,13 @@ impl Plugin for LoadingPlugin {
pub struct PlayerInputCollector(pub usize);

fn setup(mut commands: Commands) {
commands
.spawn()
.insert(Name::new("Menu Input Collector"))
.insert_bundle(InputManagerBundle {
commands.spawn((
Name::new("Menu Input Collector"),
InputManagerBundle {
input_map: menu_input_map(),
..default()
});
},
));

// Spawn the game camera
spawn_game_camera(&mut commands);
Expand All @@ -61,7 +61,7 @@ fn setup(mut commands: Commands) {

// Condition system used to make sure game assets have loaded
fn game_assets_loaded(
game_handle: Res<Handle<GameMeta>>,
game_handle: Res<GameHandle>,
loading_resources: LoadingResources,
game_assets: Res<Assets<GameMeta>>,
) -> bool {
Expand Down Expand Up @@ -93,7 +93,7 @@ pub struct GameLoader<'w, 's> {
skip_next_asset_update_event: Local<'s, bool>,
camera_projections: Query<'w, 's, &'static mut OrthographicProjection>,
commands: Commands<'w, 's>,
game_handle: Res<'w, Handle<GameMeta>>,
game_handle: Res<'w, GameHandle>,
clear_color: ResMut<'w, ClearColor>,
game_assets: ResMut<'w, Assets<GameMeta>>,
egui_ctx: Option<ResMut<'w, EguiContext>>,
Expand Down Expand Up @@ -163,14 +163,14 @@ impl<'w, 's> GameLoader<'w, 's> {
let settings = storage.get(Settings::STORAGE_KEY);
let settings = settings.as_ref().unwrap_or(&game.default_settings);
for player in 0..MAX_PLAYERS {
commands
.spawn()
.insert(Name::new(format!("Player Input Collector {player}")))
.insert(PlayerInputCollector(player))
.insert_bundle(InputManagerBundle {
commands.spawn((
Name::new(format!("Player Input Collector {player}")),
PlayerInputCollector(player),
InputManagerBundle {
input_map: settings.player_controls.get_input_map(player),
..default()
});
},
));
}

// Select default character for all players
Expand Down
5 changes: 2 additions & 3 deletions src/localization.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::borrow::Borrow;

use bevy::{prelude::*, utils::HashMap};
use bevy_fluent::{
exts::fluent::content::Request, BundleAsset, Content, FluentPlugin, Locale, Localization,
};
use bevy_fluent::{BundleAsset, FluentPlugin, Locale, Localization};
use fluent::FluentArgs;
use fluent_content::{Content, Request};

/// Plugin for initializing and loading the [`Localization`] resource.
pub struct LocalizationPlugin;
Expand Down
Loading