From 8500646226a18390389980af95eb07916ca59cff Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 13:40:41 +0100 Subject: [PATCH 1/9] document WGPU_BACKEND=gl workaround for non-vulkan GPUs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e63ec11..30b9235 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ Key features: - A graphics card with vulkan support +Workaround if you don't have a vulkan GPU: Enable the OpenGL rendering backend by setting the `WGPU_BACKEND` environment variable to `gl`, e.g. by running `WGPU_BACKEND=gl cargo run` or `WGPU_BACKEND=gl ./outfly`. Note that this has considerably slower performance and occasional visual glitches. + # Building To run the pre-compiled version on Arch Linux, you need some basic libs: From 10b8b90c2dccd69fb337df9fe8c263d9a5048f61 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 13:52:15 +0100 Subject: [PATCH 2/9] add MacOS build instructions --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 30b9235..5a981a2 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Key features: Workaround if you don't have a vulkan GPU: Enable the OpenGL rendering backend by setting the `WGPU_BACKEND` environment variable to `gl`, e.g. by running `WGPU_BACKEND=gl cargo run` or `WGPU_BACKEND=gl ./outfly`. Note that this has considerably slower performance and occasional visual glitches. # Building +## On Linux To run the pre-compiled version on Arch Linux, you need some basic libs: @@ -66,6 +67,23 @@ cargo build --target=x86_64-pc-windows-gnu --release More information here: https://bevy-cheatbook.github.io/setup/cross/linux-windows.html +## Building on Mac OS + +Install homebrew, and then get the following dependencies: + +``` +brew install pkg-config molten-vk rustup +rustup-init +``` + +Download, compile and run the game: + +``` +git clone [URL] +cd outfly +cargo run --release +``` + # Credits - https://pixabay.com/sound-effects/typosonic-typing-192811 From eb3447127a1cbdbb8bdcad9b4cd6c1cfc2dca29c Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:25:48 +0100 Subject: [PATCH 3/9] tweak dependency section --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5a981a2..8dddc58 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,17 @@ Key features: # System Requirements -- A graphics card with vulkan support +- Screen, keyboard, mouse +- Operating System: Linux, Windows, MacOS +- Ideally, a graphics card with vulkan support -Workaround if you don't have a vulkan GPU: Enable the OpenGL rendering backend by setting the `WGPU_BACKEND` environment variable to `gl`, e.g. by running `WGPU_BACKEND=gl cargo run` or `WGPU_BACKEND=gl ./outfly`. Note that this has considerably slower performance and occasional visual glitches. +If your GPU does not support vulkan, try rendering with OpenGL by setting the environment variable `WGPU_BACKEND` to `gl`, like: + +``` +WGPU_BACKEND=gl ./outfly +or +WGPU_BACKEND=gl cargo run +``` # Building ## On Linux From 55a44db71478352ed2bb01b3a669026ca0b8c5c4 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:26:59 +0100 Subject: [PATCH 4/9] warn about poor performance with OpenGL --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8dddc58..230678d 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ or WGPU_BACKEND=gl cargo run ``` +However, this may result in poor performance and visual glitches. + # Building ## On Linux From e34b2b3eb73a46b594072c2b83e5be0a75fe6d5d Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:31:02 +0100 Subject: [PATCH 5/9] "--features dev": easier toggling between static/dynamic linking --- Cargo.toml | 6 ++++-- README.md | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1b63932..3ada0e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,10 @@ bevy_embedded_assets = "0.10.2" [dependencies."bevy"] version = "0.13.0" -features = ["jpeg", "minimp3", "dynamic_linking"] # For debug builds -#features = ["jpeg", "minimp3"] # For release builds +features = ["jpeg", "minimp3"] + +[features] +dev = ["bevy/dynamic_linking"] # Enable a small amount of optimization in debug mode [profile.dev] diff --git a/README.md b/README.md index 230678d..e93125c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,14 @@ WGPU_BACKEND=gl cargo run However, this may result in poor performance and visual glitches. # Building +## General notes + +For development, it's recommended to use `--features dev` to enable dynamic linking, e.g. like this: + +``` +cargo [run|build] --features dev +``` + ## On Linux To run the pre-compiled version on Arch Linux, you need some basic libs: From f70c47f891bb401e61e5b09dd35f96e17b2ab598 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:32:02 +0100 Subject: [PATCH 6/9] smaller release binary size --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3ada0e1..2fccd6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ opt-level = 3 [profile.release] lto = true opt-level = 'z' -#opt-level = 3 codegen-units = 1 incremental = false debug = false +strip = true From 1c900b193606ebd90fe2937a16889e5bfe60edad Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:43:46 +0100 Subject: [PATCH 7/9] cleanup, remove minimp3 dep --- Cargo.lock | 32 -------------------------------- Cargo.toml | 9 ++------- 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48436ee..bcdbd2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2340,26 +2340,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "minimp3-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e21c73734c69dc95696c9ed8926a2b393171d98b3f5f5935686a26a487ab9b90" -dependencies = [ - "cc", -] - -[[package]] -name = "minimp3_fixed" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42b0f14e7e75da97ae396c2656b10262a3d4afa2ec98f35795630eff0c8b951b" -dependencies = [ - "minimp3-sys", - "slice-ring-buffer", - "thiserror", -] - [[package]] name = "miniz_oxide" version = "0.7.2" @@ -2947,7 +2927,6 @@ checksum = "3b1bb7b48ee48471f55da122c0044fcc7600cfcc85db88240b89cb832935e611" dependencies = [ "cpal", "lewton", - "minimp3_fixed", ] [[package]] @@ -3074,17 +3053,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "slice-ring-buffer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7081c7e452cb62f5f0c32edd4e265391bdbb23e90905df8bb88a23d3b5166b77" -dependencies = [ - "libc", - "mach2", - "winapi", -] - [[package]] name = "slotmap" version = "1.0.7" diff --git a/Cargo.toml b/Cargo.toml index 2fccd6c..618d89b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,21 +12,16 @@ rust-version = "1.76.0" [dependencies] regex = "1" bevy_embedded_assets = "0.10.2" - -[dependencies."bevy"] -version = "0.13.0" -features = ["jpeg", "minimp3"] +bevy = { version = "0.13.0", features = ["jpeg"] } [features] dev = ["bevy/dynamic_linking"] -# Enable a small amount of optimization in debug mode [profile.dev] opt-level = 1 -# Enable high optimizations for dependencies (incl. Bevy), but not for our code: [profile.dev.package."*"] -opt-level = 3 +opt-level = 3 # high optimizations for dependencies, but not for our code [profile.release] lto = true From 6d256211d94ffc4a1e66ff2032905b68cd3d2ccf Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 14:50:12 +0100 Subject: [PATCH 8/9] expand bevy default features --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 618d89b..2994885 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.76.0" [dependencies] regex = "1" bevy_embedded_assets = "0.10.2" -bevy = { version = "0.13.0", features = ["jpeg"] } +bevy = { version = "0.13.0", default-features = false, features = ["jpeg", "animation", "bevy_asset", "bevy_audio", "bevy_gilrs", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_sprite", "bevy_text", "bevy_ui", "multi-threaded", "png", "hdr", "vorbis", "x11", "bevy_gizmos", "android_shared_stdcxx", "tonemapping_luts", "default_font", "webgl2", "bevy_debug_stepping"]} [features] dev = ["bevy/dynamic_linking"] From 001c928d3b028c622f72adff1ce43da560094254 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 30 Mar 2024 15:17:00 +0100 Subject: [PATCH 9/9] remove unneeded bevy features --- Cargo.lock | 182 +++-------------------------------------------------- Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 176 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcdbd2f..79ba49f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -310,25 +310,6 @@ dependencies = [ "bevy_ecs", ] -[[package]] -name = "bevy_animation" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4ef4c35533df3f0c4e938cf6a831456ea563775bab799336f74331140c7665" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_ecs", - "bevy_hierarchy", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_time", - "bevy_transform", - "bevy_utils", -] - [[package]] name = "bevy_app" version = "0.13.0" @@ -403,7 +384,6 @@ dependencies = [ "bevy_reflect", "bevy_transform", "bevy_utils", - "oboe 0.5.0", "rodio", ] @@ -534,22 +514,6 @@ dependencies = [ "encase_derive_impl", ] -[[package]] -name = "bevy_gilrs" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96364a1875ee4545fcf825c78dc065ddb9a3b2a509083ef11142f9de0eb8aa17" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_input", - "bevy_log", - "bevy_time", - "bevy_utils", - "gilrs", - "thiserror", -] - [[package]] name = "bevy_gizmos" version = "0.13.0" @@ -591,7 +555,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "031d0c2a7c0353bb9ac08a5130e58b9a2de3cdaa3c31b5da00b22a9e4732a155" dependencies = [ "base64", - "bevy_animation", "bevy_app", "bevy_asset", "bevy_core", @@ -650,7 +613,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7af89c7083830b1d65fcf0260c3d2537c397fe8ce871471b6e97198a4704f23e" dependencies = [ "bevy_a11y", - "bevy_animation", "bevy_app", "bevy_asset", "bevy_audio", @@ -659,7 +621,6 @@ dependencies = [ "bevy_derive", "bevy_diagnostic", "bevy_ecs", - "bevy_gilrs", "bevy_gizmos", "bevy_gltf", "bevy_hierarchy", @@ -1473,7 +1434,7 @@ dependencies = [ "mach2", "ndk", "ndk-context", - "oboe 0.6.1", + "oboe", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -1716,12 +1677,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "foreign-types" version = "0.5.0" @@ -1797,40 +1752,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gilrs" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0510502768c64b944bf4d1518ba36e2431c638ac996ebacb543a297b145f8300" -dependencies = [ - "fnv", - "gilrs-core", - "log", - "uuid", - "vec_map", -] - -[[package]] -name = "gilrs-core" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c132270a155f2548e67d66e731075c336c39098afc555752f3df8f882c720e" -dependencies = [ - "core-foundation", - "inotify", - "io-kit-sys", - "js-sys", - "libc", - "libudev-sys", - "log", - "nix", - "uuid", - "vec_map", - "wasm-bindgen", - "web-sys", - "windows 0.54.0", -] - [[package]] name = "gl_generator" version = "0.14.0" @@ -2077,36 +1998,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" -[[package]] -name = "inotify" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "io-kit-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "617ee6cf8e3f66f3b4ea67a4058564628cde41901316e19f559e14c7c72c5e7b" -dependencies = [ - "core-foundation-sys", - "mach2", -] - [[package]] name = "itertools" version = "0.12.1" @@ -2118,9 +2009,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -2254,16 +2145,6 @@ dependencies = [ "redox_syscall 0.4.1", ] -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "linux-raw-sys" version = "0.4.13" @@ -2421,18 +2302,6 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" -dependencies = [ - "bitflags 2.4.2", - "cfg-if", - "cfg_aliases", - "libc", -] - [[package]] name = "nom" version = "7.1.3" @@ -2468,17 +2337,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num-derive" version = "0.4.2" @@ -2587,17 +2445,6 @@ dependencies = [ "cc", ] -[[package]] -name = "oboe" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" -dependencies = [ - "num-derive 0.3.3", - "num-traits", - "oboe-sys 0.5.0", -] - [[package]] name = "oboe" version = "0.6.1" @@ -2607,18 +2454,9 @@ dependencies = [ "jni", "ndk", "ndk-context", - "num-derive 0.4.2", + "num-derive", "num-traits", - "oboe-sys 0.6.1", -] - -[[package]] -name = "oboe-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" -dependencies = [ - "cc", + "oboe-sys", ] [[package]] @@ -3014,9 +2852,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -3359,12 +3197,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 2994885..caf4b62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.76.0" [dependencies] regex = "1" bevy_embedded_assets = "0.10.2" -bevy = { version = "0.13.0", default-features = false, features = ["jpeg", "animation", "bevy_asset", "bevy_audio", "bevy_gilrs", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_sprite", "bevy_text", "bevy_ui", "multi-threaded", "png", "hdr", "vorbis", "x11", "bevy_gizmos", "android_shared_stdcxx", "tonemapping_luts", "default_font", "webgl2", "bevy_debug_stepping"]} +bevy = { version = "0.13.0", default-features = false, features = ["jpeg", "bevy_asset", "bevy_audio", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_text", "bevy_ui", "multi-threaded", "png", "vorbis", "x11", "tonemapping_luts"]} [features] dev = ["bevy/dynamic_linking"]