Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak some settings according to feedback #271

Merged
merged 3 commits into from
May 29, 2023
Merged
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
33 changes: 21 additions & 12 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the `"-Z", "share-generics=y"` below.

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-Z", "share-generics=y"]
# Uncomment the following lines for better link time performance. Requires lld on Windows, zld on macOS and clang on Linux.

# [target.x86_64-unknown-linux-gnu]
# Uncomment for better performance. Requires clang.
# linker = "clang"

# Uncomment instead of default rustflags for better performance. Requires lld.
# rustflags = ["-C", "link-arg=-fuse-ld=lld", "-Z", "share-generics=y"]
rustflags = ["-Z", "share-generics=y"]

# NOTE: you must manually install https://github.com/michaeleisel/zld on mac. you can easily do this with the "brew" package manager:
# `brew install michaeleisel/zld/zld`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Z", "share-generics=y"]
# Uncomment instead of default rustflags for better performance. Requires zld via `brew install michaeleisel/zld/zld`
# rustflags = ["-C", "link-arg=-fuse-ld=/usr/local/bin/zld", "-Z", "share-generics=y"]
rustflags = ["-Z", "share-generics=y"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld", "-Z", "share-generics=y"]
# Uncomment instead of default rustflags for better performance. Requires zld via `brew install michaeleisel/zld/zld`
# rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld", "-Z", "share-generics=y"]
rustflags = ["-Z", "share-generics=y"]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe"
# Uncommentfor better performance. Requires lld via `cargo install -f cargo-binutils` and `rustup component add llvm-tools-preview`
# linker = "rust-lld.exe"
rustflags = ["-Z", "share-generics=n"]

# Enable only a small amount of optimization in debug mode
# Enable no optimization in debug mode. You should probably bump this up for Wasm builds.
[profile.dev]
opt-level = 1
opt-level = 0
# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
# debug = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
# Enable some optimizations for dependencies (incl. Bevy), but not for our code. You should probably bump this up for Wasm builds.
[profile.dev.package."*"]
opt-level = 2
opt-level = 1

[profile.release]
lto = "thin"
Expand Down
63 changes: 51 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 49 additions & 45 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,11 @@ categories = ["game-development"]
homepage = "https://janhohenheim.github.io/foxtrot/"

[features]
default = ["native-dev"]

core = [
"bevy/animation",
"bevy/bevy_asset",
"bevy/bevy_scene",
"bevy/bevy_winit",
"bevy/bevy_core_pipeline",
"bevy/bevy_pbr",
"bevy/bevy_gltf",
"bevy/bevy_render",
"bevy/bevy_sprite",
"bevy/bevy_text",
"bevy/bevy_ui",
"bevy/png",
"bevy/jpeg",
"bevy/hdr",
"bevy/zstd",
"bevy/x11",
"bevy/ktx2",
"bevy/tonemapping_luts",
"bevy/serialize",
]

dev = ["dep:bevy_editor_pls", "dep:bevy_prototype_debug_lines", "core"]

native-dev = ["bevy/bevy_dylib", "bevy/filesystem_watcher", "dev", "native"]

native = ["bevy_rapier3d/parallel", "dep:bevy_hanabi", "core"]

wasm = ["bevy_rapier3d/wasm-bindgen", "core", "dep:wasm-bindgen"]

wasm_dev = ["wasm", "dev"]

default = ["dev"]
dev = ["dep:bevy_editor_pls", "dep:bevy_prototype_debug_lines"]
tracing = ["bevy/trace_chrome"]

[dependencies]
bevy = { version = "0.10.1", default-features = false }
bevy_kira_audio = "0.15"
bevy_asset_loader = { version = "0.16", features = ["progress_tracking"] }
bevy_common_assets = { version = "0.6", features = ["ron", "toml"] }
Expand All @@ -74,28 +41,65 @@ oxidized_navigation = "0.4"
bitflags = "2"
iyes_progress = "0.8"
unicode-segmentation = "1"
bevy_hanabi = { version = "0.6", optional = true }
anyhow = "1"
bevy_rapier3d = { version = "0.21", features = [
"serde-serialize",
"simd-nightly",
] }
leafwing-input-manager = { version = "0.9", features = ["egui"] }
bevy_editor_pls = { version = "0.3", optional = true }
bevy_prototype_debug_lines = { version = "0.10", optional = true, features = [
"3d",
] }
wasm-bindgen = { version = "0.2", optional = true }
warbler_grass = "0.3"
rand = { version = "0.8", features = ["small_rng", "nightly"] }
bevy_dolly = { git = "https://github.com/BlackPhlox/bevy_dolly", rev = "b2f5dc787664cb8c3d92f792cbd437886fc090c6" }
spew = "0.2.1"
bevy_mod_sysfail = "2"
seldom_fn_plugin = "0.3"
bevy_rapier3d = { version = "0.21", features = [ "serde-serialize", "simd-nightly",] }
bevy_editor_pls = { version = "0.4", optional = true }
bevy_prototype_debug_lines = { version = "0.10", optional = true, features = [ "3d" ] }

# keep the following in sync with Bevy's dependencies
winit = { version = "0.28", default-features = false }
image = { version = "0.24", default-features = false }

[dependencies.bevy]
version = "0.10.1"
default-features = false
features = [
"animation",
"bevy_asset",
"bevy_scene",
"bevy_winit",
"bevy_core_pipeline",
"bevy_pbr",
"bevy_gltf",
"bevy_render",
"bevy_sprite",
"bevy_text",
"bevy_ui",
"png",
"jpeg",
"hdr",
"zstd",
"x11",
"ktx2",
"tonemapping_luts",
"serialize",
]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.bevy]
version = "0.10.1"
default-features = false
features = [ "filesystem_watcher" ]


[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.bevy]
version = "0.10.1"
default-features = false
features = [ "bevy_dylib" ]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy_hanabi = "0.6"
bevy_rapier3d = { version = "0.21", features = ["parallel"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
bevy_rapier3d = { version = "0.21", features = ["wasm-bindgen"] }

[build-dependencies]
embed-resource = "2.1"
19 changes: 3 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ https://user-images.githubusercontent.com/9047632/226387411-70f662de-0681-47ff-b
- Physics via [`bevy_rapier`](https://crates.io/crates/bevy_rapier)
- Audio via [`bevy_kira_audio`](https://crates.io/crates/bevy_kira_audio)
- Pathfinding via [`oxidized_navigation`](https://crates.io/crates/oxidized_navigation)
- [`bevy_editor_pls`](https://crates.io/crates/bevy_editor_pls) in the `dev` feature, bound to 'Q'
- [`bevy_editor_pls`](https://crates.io/crates/bevy_editor_pls) bound to 'G'
- Custom editor for the game state found in the windows selection for `bevy_editor_pls`.
- Saving / loading levels
- Saving / loading the game state
- Animations
- A custom dialog system
- Shaders
- GLTF imports, including auto-detection of colliders
- Dynamic builds in the `native-dev` feature
- Dynamic builds when developing
- Grass blades using [`warbler_grass`](https://crates.io/crates/warbler_grass)
- Smooth cameras via [`bevy_dolly`](https://github.com/BlackPhlox/bevy_dolly)
- A skydome that follows the camera
Expand All @@ -42,22 +42,9 @@ cargo run
```
Wasm:
```bash
trunk serve --no-default-features --features wasm_dev
trunk serve
```

Building in general requires setting up LLD or ZLD as described in the [Bevy book](https://bevyengine.org/learn/book/getting-started/setup/#enable-fast-compiles-optional).
Don't worry, it's super easy:
- **Ubuntu**: `sudo apt-get install lld`
- **Arch**: `sudo pacman -S lld`
- **Windows**: Ensure you have the latest [cargo-binutils](https://github.com/rust-embedded/cargo-binutils)

```sh
cargo install -f cargo-binutils
rustup component add llvm-tools-preview
```

- **MacOS**: Modern LLD does not yet support MacOS, but we can use zld instead: `brew install michaeleisel/zld/zld`

Building WASM requires `trunk`:

```bash
Expand Down
Loading