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

Rewrite with Bevy #1

Merged
merged 47 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c5de4a3
select config from gui
philiplinden Feb 24, 2024
8552601
checkpoint: feeling out bevy implementations
philiplinden Oct 28, 2024
22a6f80
bevy: round 1
philiplinden Nov 8, 2024
14bd87f
bevy: round 2
philiplinden Nov 8, 2024
ef58ca7
bevy: round 3
philiplinden Nov 8, 2024
ad84a63
docs: devlog for 2024-11-07
philiplinden Nov 8, 2024
7e2d6cc
bevy: round 4
philiplinden Nov 8, 2024
9523bcd
bevy: round 5
philiplinden Nov 8, 2024
fda951f
checkpoint
philiplinden Nov 3, 2024
8a87976
docs: rm anims
philiplinden Nov 8, 2024
0d3d5da
bevy: round 6 - this is broken
philiplinden Nov 8, 2024
6f6712b
bevy: round 7 - fix the ui, gut everything else
philiplinden Nov 9, 2024
bddf13f
bevy: migrate atmo to use position, balloon to use components
philiplinden Nov 9, 2024
feb2d6c
bevy: start migrating dynamics to avian
philiplinden Nov 9, 2024
ec6bda6
bevy: structured thermodynamics
philiplinden Nov 10, 2024
8d8d295
cleanup
philiplinden Nov 10, 2024
c0f65c0
bevy: add minor windows for help dialogs
philiplinden Nov 10, 2024
0c89762
bevy: a little beautification
philiplinden Nov 11, 2024
3ec10c1
bevy: a little more separation of concerns
philiplinden Nov 11, 2024
2f4648e
bevy: trying to make volume work
philiplinden Nov 11, 2024
43e4c27
bevy: split thermodynamics and forces into components
philiplinden Nov 11, 2024
6134125
bevy: clean
philiplinden Nov 13, 2024
0dfd9d9
physics: ball hits the ground
philiplinden Nov 13, 2024
064a3c8
physics: buoyancy and weight are working
philiplinden Nov 13, 2024
dc88c9d
docs: corrections in the devlog
philiplinden Nov 13, 2024
56ed0f3
ci: add bevy deps
philiplinden Nov 13, 2024
99642d9
ci: replace cache step with the one from leafwing
philiplinden Nov 13, 2024
eb141a6
ci: i guess docs need sound?
philiplinden Nov 13, 2024
edb98d3
cleanup: disallow dead code in most places, add placeholders for payload
philiplinden Nov 14, 2024
4d88331
physics: impl buoyancy and weight as externalforces
philiplinden Nov 14, 2024
a38fe41
cleanup
philiplinden Nov 14, 2024
307ed7b
cleanup
philiplinden Nov 14, 2024
8cf8096
ui: drop egui, add iyes_perf_ui
philiplinden Nov 16, 2024
365e37e
physics: restructure force systems
philiplinden Nov 16, 2024
f305d5b
physics: restructure force systems
philiplinden Nov 16, 2024
e4d7121
checkpoint
philiplinden Nov 16, 2024
499710a
physics: start drag calc module
philiplinden Nov 17, 2024
aac9d94
physics: drag
philiplinden Nov 17, 2024
89180a6
physics: force refactor
philiplinden Nov 17, 2024
a17b046
aero: placeholder drag from mesh
philiplinden Nov 17, 2024
fb5c6e7
aero: checkpoint
philiplinden Nov 17, 2024
b087019
physics: forces are reliable yay
philiplinden Nov 18, 2024
88ce33b
ui: sim state monitoring, play/pause
philiplinden Nov 19, 2024
81c9930
physics: fix drag force (placeholder)
philiplinden Nov 19, 2024
696266b
doc: more resources
philiplinden Nov 22, 2024
56c23ee
mod: remove the assets module for now
philiplinden Nov 22, 2024
6c18c04
lint: clippy
philiplinden Nov 22, 2024
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
63 changes: 25 additions & 38 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,24 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Restore cargo cache
uses: actions/cache@v3

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
sweep-cache: true

- name: Install Bevy dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev

- name: Cargo Check
run: RUSTFLAGS="$RUSTFLAGS -A dead_code" cargo check

- name: Cargo Build
run: cargo build --release --all-features
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Restore cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

doc:
runs-on: ubuntu-latest
needs:
Expand All @@ -63,24 +45,26 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Restore cargo cache
uses: actions/cache@v3

- name: Install Bevy dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev

- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
sweep-cache: true

- name: Cargo Doc
run: cargo doc --no-deps

- uses: actions/upload-artifact@v4
with:
name: doc
path: target/doc

deploy:
if: github.ref == 'refs/heads/main'
needs: doc
Expand All @@ -97,14 +81,17 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
name: doc
path: ${{ github.workspace }}

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Expand Down
120 changes: 86 additions & 34 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,101 @@
name = "yahs"
description = "Yet Another HAB Simulator"
authors = ["Philip Linden <[email protected]>"]
version = "0.2.0"
version = "0.4.0"
edition = "2021"
readme = "README.md"
license-file = "LICENSE"

[features]
default = ["gui"]
gui = [
"egui",
"egui_extras",
"egui_plot",
"eframe",
"emath",
"rfd",
default = [
# Default to a native dev build.
"dev_native",
]
dev = [
# Improve compile times for dev builds by linking Bevy as a dynamic
# library.
"bevy/dynamic_linking",
"bevy/bevy_dev_tools",
]
dev_native = [
"dev",
# Enable system information plugin for native dev builds.
"bevy/sysinfo_plugin",
"iyes_perf_ui/sysinfo",
]
config-files = ["ron", "bevy_common_assets", "serde"]
inspect = ["bevy-inspector-egui", "bevy_panorbit_camera/bevy_egui"]

[dependencies]
pretty_env_logger = "0.5.0"
libm = "0.2.1"
toml = "0.8.10"
clap = { version = "4.1", default-features = false, features = [
"derive",
"std",
"help",
"usage",
"error-context",
"suggestions",
] }
csv = "1.2.1"
serde = { version = "1.0.196", features = ["derive"] }
log = { version = "0.4.20", features = ["release_max_level_debug"] }
egui = { version = "0.26.2", features = ["log", "serde"], optional = true }
egui_plot = { version = "0.26.2", features = ["serde"], optional = true }
eframe = { version = "0.26.2", features = ["persistence"], optional = true }
emath = { version = "0.26.2", optional = true }
egui_extras = { version = "0.26.2", features = [
"chrono",
"datepicker",
"file",
], optional = true }
rfd = { version = "0.14.0", optional = true }
ultraviolet = { version = "0.9.2", features = ["serde"] }
# core dependencies
bevy = "0.14.2"
bevy-trait-query = "0.6.0"
# physics dependencies
avian3d = { version = "0.1.2", features = ["debug-plugin"] }
# ui dependencies
bevy_panorbit_camera = { version = "0.20.0" }
bevy-inspector-egui = { version = "0.27.0", features = ["highlight_changes"], optional = true }
iyes_perf_ui = "0.3.0"
# file io dependencies
bevy_common_assets = { version = "0.11.0", features = ["ron"], optional = true }
ron = { version = "0.8.1", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
parry3d = { version = "0.17.2", features = ["parallel"] }

[[bin]]
name = "yahs"
path = "src/main.rs"

# -----------------------------------------------------------------------------
# Some Bevy optimizations
# -----------------------------------------------------------------------------

# Idiomatic Bevy code often triggers these lints, and the CI workflow treats
# them as errors. In some cases they may still signal poor code quality however,
# so consider commenting out these lines.
[lints.clippy]
# Bevy supplies arguments to systems via dependency injection, so it's
# natural for systems to request more than 7 arguments -- which triggers
# this lint.
too_many_arguments = "allow"
# Queries that access many components may trigger this lint.
type_complexity = "allow"


# Compile with Performance Optimizations:
# https://bevyengine.org/learn/quick-start/getting-started/setup/#compile-with-performance-optimizations

# Enable a small amount of optimization in the dev profile.
[profile.dev]
opt-level = 1

# Enable a large amount of optimization in the dev profile for dependencies.
[profile.dev.package."*"]
opt-level = 3

# The default profile is optimized for Wasm builds because that's what [Trunk
# reads](https://github.com/trunk-rs/trunk/issues/605). Optimize for size in the
# wasm-release profile to reduce load times and bandwidth usage on web.
[profile.release]
# Compile the entire crate as one unit. Slows compile times, marginal
# improvements.
codegen-units = 1
# Do a second optimization pass over the entire program, including
# dependencies. Slows compile times, marginal improvements.
lto = "thin"
# Optimize with size in mind (also try "z", sometimes it is better).
# Slightly slows compile times, great improvements to file size and runtime
# performance.
opt-level = "s"
# Strip all debugging information from the binary to slightly reduce file
# size.
strip = "debuginfo"

# Override some settings for native builds.
[profile.release-native]
# Default to release profile values.
inherits = "release"
# Optimize with performance in mind.
opt-level = 3
# Keep debug information in the binary.
strip = "none"
21 changes: 4 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
# yet another HAB simulator

A high altitude balloon flight simulator based on [tkschuler/EarthSHAB](https://github.com/tkschuler/EarthSHAB) and [brickworks/mfc-apps](https://github.com/Brickworks/mfc-apps), built on Rust.
A high altitude balloon flight simulator based on
[tkschuler/EarthSHAB](https://github.com/tkschuler/EarthSHAB) and
[brickworks/mfc-apps](https://github.com/Brickworks/mfc-apps), built on Rust.

## Installation

```sh
cargo install --git https://github.com/Brickworks/yahs.git --features gui
yahs --help
```

## Usage (CLI)
Set the simulation configuration in `config/default.toml`

Then use the `start` command to start a flight simulation. Use the `RUST_LOG`
environment variable to specify the log level to report.

```sh
yahs start
```

## Usage (GUI)

```sh
yahs gui
```
103 changes: 103 additions & 0 deletions assets/configs/properties.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
(
gases: [
// Species of gas with a known molar mass (kg/mol)
(
name: "Air",
abbreviation: "Air",
molar_mass: 0.02897,
),
(
name: "Helium",
abbreviation: "He",
molar_mass: 0.0040026,
),
(
name: "Hydrogen",
abbreviation: "H2",
molar_mass: 0.00201594,
),
(
name: "Nitrogen",
abbreviation: "N2",
molar_mass: 0.0280134,
),
(
name: "Oxygen",
abbreviation: "O2",
molar_mass: 0.0319988,
),
(
name: "Argon",
abbreviation: "Ar",
molar_mass: 0.039948,
),
(
name: "Carbon Dioxide",
abbreviation: "CO2",
molar_mass: 0.04400995,
),
(
name: "Neon",
abbreviation: "Ne",
molar_mass: 0.020183,
),
(
name: "Krypton",
abbreviation: "Kr",
molar_mass: 0.08380,
),
(
name: "Xenon",
abbreviation: "Xe",
molar_mass: 0.13130,
),
(
name: "Methane",
abbreviation: "CH4",
molar_mass: 0.01604303,
),
],
// Properties, attributes and functions related to the material properties.
// Source: https://www.matweb.com/
materials: [
(
name: "Nothing",
max_temperature: 1e30,
density: 0.0,
emissivity: 1.0,
absorptivity: 0.0,
thermal_conductivity: 1e30,
specific_heat: 0.0,
poissons_ratio: 0.5,
elasticity: 1e30,
max_strain: 1e30,
max_stress: 1e30,
),
(
name: "Rubber",
max_temperature: 385.0,
density: 1000.0,
emissivity: 0.86,
absorptivity: 0.86,
thermal_conductivity: 0.25,
specific_heat: 1490.0,
poissons_ratio: 0.5,
elasticity: 4000000.0,
max_strain: 8.0,
max_stress: 25000000.0,
),
(
name: "LowDensityPolyethylene",
max_temperature: 348.0,
density: 919.0,
emissivity: 0.94,
absorptivity: 0.94,
thermal_conductivity: 0.3175,
specific_heat: 2600.0,
poissons_ratio: 0.5,
elasticity: 300_000_000.0,
max_strain: 6.25,
max_stress: 10_000_000.0,
),
]
)
Binary file added assets/textures/balloon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/textures/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading