/bevy_combat

A sci-fi battle simulation implemented in the bevy engine.

Primary LanguageRustMIT LicenseMIT

Bevy Combat

crate_version crate_version

It's a bevy port of my ECS Combat Unity demo.

Check out the web demo in your browser. You can use the - and = keys to speed up and slow down time (make sure you have focussed the browser window).

demo scene

another scene

Added so far

  • Movement
  • Combat and targetting AI
  • Simple weapons (instant hit), damage, health and mortality
  • Death animations and explosions
  • Shields

Coming soon

  • More weapons
  • Combat calculations, e.g. weapon effectiveness.
  • Ship shaders
  • Fix bugs

Getting Started

To build and deploy for web:

cargo make serve

To run for pc:

cargo run

Building for web (fast)

Make sure you have added the wasm target to your toolchain:

rustup target add wasm32-unknown-unknown

If you do not have wasm-server-runner, install it via

cargo install wasm-server-runner

Afterwards, you can build and run in your browser:

cargo run --target wasm32-unknown-unknown

For more info on web deployment, see the bevy book.

Building for itch.io

Following these instructions...

itch.io build requires

cargo install wasm-bindgen-cli

Build the wasm target, then run wasm-bindgen. After, optimize the generated .wasm:

cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name "game" ./target/wasm32-unknown-unknown/release/bevy_combat.wasm

If you want to optimize further:

wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name "preopt_game" ./target/wasm32-unknown-unknown/release/bevy_combat.wasm
wasm-opt -O -ol 100 -s 100 -o game.wasm preopt_game.wasm

Copy the assets folder to /out. Copy web/index.html to /out/index.html

Zip the out folder, upload to itch.io, and celebrate!

Credits

Credit for individual art assets can be found here.