Skip to content

stevenlovegrove/killer-critters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Killer-Critters

A simple and fun multiplayer mega bomberman inspired game written in Rust using the Bevy game engine. The game has been tested on desktop and the web (via WASM).

Play it at stevenlovegrove.github.io/killer-critters!

Player 1 Controls: Arrow keys + Space

Player 2 controls: WASD + Q

3 + 4 players is supported via bluetooth controllers but requires a one-line code change in main.rs:148.

screenshot

Build and Run from Source

Install rust

https://www.rust-lang.org/tools/install

TL;DR: Linux/Mac: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Checkout project
cd ~/your_code_dir
git clone https://github.com/stevenlovegrove/killer-critters.git
cd killer-critters
Run natively on desktop

cargo run --release -- --fullscreen

Note: Bevy has performance issues in a non-optimized build, so don't forget that --release flag

Deploy on the web
Do once

Install the rust wasm toolchain and optionally a simple local webserver:

rustup target add wasm32-unknown-unknown
cargo install wasm-server-runner # optional

To make working with wasm targets simpler, ask cargo to automatically start a local webserver when running them. Just add to your ~/.cargo/config.toml

[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"
Running

If you setup the default runner as above, just execute:

cargo run --target wasm32-unknown-unknown --release

which will start the server and provide a URL for viewing.

Embed on webpage
cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --no-typescript --target web \
    --out-dir ./web-dist/ \
    --out-name "killer-critters" \
    ./target/wasm32-unknown-unknown/release/killer-critters.wasm

The generated wasm file is a bit large. It takes a minute or so, but you can make it smaller with

wasm-opt -Oz -o ./web-dist/killer-critters_bg.wasm ./web-dist/killer-critters_bg.wasm

Now the wasm can be embedded on your page - see github.com/stevenlovegrove/killer-critters/tree/gh-pages for an example. Note, CORRS prohibits running the webpage by opening the index.html file locally - you'll need to use a web server of your choice. I like to use the simple rust web server 'miniserve':

cargo install --locked miniserve
miniserve . --open
Bundle into Application (MacOS)

To create a MacOS Application bundle:

cargo bundle --release
cargo install cargo-bundle

Contributions

This was a fun weekend project and is released as open-source in case it happens to be interesting to anyone. Issues and Pull requests are welcome, but my replies will be slow, perhaps non-existent.

A big thanks to the asset creators!

The assets for this game are all made available for free by their authors.

3D Model Assets
Audio Assets

About

Mega-bomberman inspired animal escapades

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages