Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e4d00e5
Start rewriting to bevy
tversteeg Feb 12, 2022
9e3fd14
Use nice bevy structure
tversteeg Feb 12, 2022
82761e9
Add physics system from polygons
tversteeg Feb 14, 2022
6c0bfda
Fix terrain collider
tversteeg Feb 14, 2022
25c8ef4
Start creating breakable polygons
tversteeg Feb 14, 2022
c7f224d
Split rocks on impact
tversteeg Feb 16, 2022
59825ee
Port heron to bevy_rapier2d
tversteeg Feb 17, 2022
549f2d5
Update dependencies
tversteeg Feb 24, 2022
6363645
Add RemoveAfterRestingFor component
tversteeg Feb 24, 2022
64991cf
Add simple unit that walks on terrain
tversteeg Feb 25, 2022
eb16136
Keep camera Y static
tversteeg Feb 25, 2022
113c648
Refactor polygon and make it inspectable
tversteeg Feb 27, 2022
4bf9a3d
Start creating game-ui
tversteeg Feb 28, 2022
0b2c802
Add recruit buttons
tversteeg Mar 2, 2022
084343f
Start rewriting using custom SVG tesselator using lyon
tversteeg Mar 6, 2022
6f33765
Add vertex color rendering from example
tversteeg Mar 6, 2022
868ae7e
Fix SVG loading
tversteeg Mar 6, 2022
79a5de6
Use proper noise for random terrain
tversteeg Mar 6, 2022
3c7a251
Add camera border
tversteeg Mar 6, 2022
79f588e
Small visual tweaks
tversteeg Mar 6, 2022
4000f5a
Add outlines to polygon
tversteeg Mar 8, 2022
7a7455e
Support WASM in CI
tversteeg Mar 8, 2022
e9da7f3
Add weapons
tversteeg Mar 9, 2022
f49d17e
Let walkers stop at nearest enemy
tversteeg Mar 10, 2022
580ca16
Simplify unit spawning and definitions
tversteeg Mar 12, 2022
de0e2b5
Properly position weapon
tversteeg Mar 12, 2022
b46b0ba
Make inspector optional with a feature flag
tversteeg Mar 13, 2022
5ad4b92
Put constants in an editable struct
tversteeg Mar 13, 2022
2984f9c
Start spawning arrows
tversteeg Mar 15, 2022
d5ed596
Improve arrow
tversteeg Mar 18, 2022
724fad0
Fix arrow rotation
tversteeg Mar 24, 2022
665ff33
Add constants for ui & spawning
tversteeg Mar 26, 2022
c0a9b67
Add random range element
tversteeg Mar 27, 2022
bd055f3
Start detecting collisions between projectiles and units
tversteeg Mar 30, 2022
aea5d5d
refactor: old commit not pushed
tversteeg Jul 21, 2023
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
161 changes: 61 additions & 100 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,112 +11,71 @@ on:

jobs:
# Run the `rustfmt` code formatter
rustfmt:
name: Rustfmt [Formatter]
rust:
name: cargo fmt & cargo clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions/checkout@v2

# Run the `clippy` linting tool
clippy:
name: Clippy [Linter]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo apt-get install -y xorg-dev libasound2-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D clippy::all
- name: install dependencies
# run: sudo apt-get install -y libasound2-dev libwayland-cursor0 libxkbcommon-dev libwayland-dev
run: sudo apt-get install -y libwayland-cursor0 libxkbcommon-dev libwayland-dev

# Ensure that the project could be successfully compiled
cargo_check:
name: Compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: sudo apt-get install -y xorg-dev libasound2-dev
- uses: actions-rs/toolchain@v1
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
profile: default
toolchain: nightly
override: true
- uses: actions-rs/cargo@v1

- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all

# Run tests on Linux, macOS, and Windows
# On both Rust stable and Rust nightly
test:
name: Test Suite
needs: [cargo_check]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable, nightly]
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

wasm:
name: wasm compile & deploy
runs-on: ubuntu-latest
steps:
# Checkout the branch being tested
- uses: actions/checkout@v1
- uses: actions/checkout@v2

# Install all the required dependencies for testing
- uses: actions-rs/toolchain@v1
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly
override: true
target: wasm32-unknown-unknown

# Install Node.js at a fixed version
- uses: actions/setup-node@v1
with:
node-version: "12.0"

# Install Ruby at a fixed version
- uses: actions/setup-ruby@v1
with:
ruby-version: "2.6"
- name: install wasm-bindgen
uses: jetli/wasm-bindgen-action@v0.1.0

# Install Python at a fixed version
- uses: actions/setup-python@v1
with:
python-version: "3.7"

# Install dotnet at a fixed version
- uses: actions/setup-dotnet@v1
- name: cargo build --release
uses: actions-rs/cargo@v1
with:
dotnet-version: "2.2.402"
command: build
args: --release --target wasm32-unknown-unknown

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y xorg-dev libasound2-dev
- name: run wasm-bindgen and copy assets
run: |
wasm-bindgen --out-name castle-game --out-dir web --target web target/wasm32-unknown-unknown/release/castle-game.wasm
rm -rf web/assets
cp -R assets web/assets

# Run the ignored tests that expect the above setup
- name: Run all tests
uses: actions-rs/cargo@v1
with:
command: test
args: -- -Z unstable-options --include-ignored
- name: deploy to github pages
uses: s0/git-publish-subdir-action@master
env:
REPO: self
BRANCH: gh-pages
FOLDER: web
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Build sources for every OS
github_build:
Expand All @@ -132,13 +91,13 @@ jobs:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: castle-game-x86_64-unknown-linux-gnu.tar.gz
name: castle_game-x86_64-unknown-linux-gnu
- target: x86_64-apple-darwin
os: macOS-latest
name: castle-game-x86_64-apple-darwin.tar.gz
name: castle_game-x86_64-apple-darwin
- target: x86_64-pc-windows-msvc
os: windows-latest
name: castle-game-x86_64-pc-windows-msvc.zip
name: castle_game-x86_64-pc-windows-msvc.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
Expand All @@ -147,13 +106,13 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
toolchain: nightly
override: true
target: ${{ matrix.target }}

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y xorg-dev libasound2-dev
run: sudo apt-get install -y libx11-dev libxi-dev libgl1-mesa-dev gcc-mingw-w64

- name: Build target
uses: actions-rs/cargo@v1
Expand All @@ -165,16 +124,16 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip castle-game.exe
7z a ../../../${{ matrix.name }} castle-game.exe
strip castle_game.exe
mv castle_game.exe ../../../${{ matrix.name }}
cd -

- name: Prepare build artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip castle-game
tar czvf ../../../${{ matrix.name }} castle-game
strip castle_game
mv castle_game ../../../${{ matrix.name }}
cd -

- name: Upload build artifact
Expand All @@ -196,26 +155,28 @@ jobs:
- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-unknown-linux-gnu.tar.gz
name: castle_game-x86_64-unknown-linux-gnu
path: .

- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-apple-darwin.tar.gz
name: castle_game-x86_64-apple-darwin
path: .

- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-pc-windows-msvc.zip
name: castle_game-x86_64-pc-windows-msvc.exe
path: .

- name: Generate checksums
run: for file in castle-game-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
run: for file in castle_game-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done

- name: Create GitHub release ${{ matrix.target }}
uses: softprops/action-gh-release@v1
with:
files: |
castle-game-*
castle_game-*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ Cargo.lock
**/*.rs.bk

resources/
assets/

*.js
*.wasm
*.ts
71 changes: 41 additions & 30 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "castle-game"
version = "0.1.37-alpha.0"
edition = "2018"
edition = "2021"
authors = ["Thomas Versteeg <thomasversteeg@gmx.com>"]
license = "GPL-3.0"
homepage = "https://github.com/tversteeg/castle-game"
Expand All @@ -13,37 +13,48 @@ repository = "https://github.com/tversteeg/castle-game.git"
keywords = ["game", "2d", "destructible"]
categories = ["games"]

build = "build.rs"

[badges]
travis-ci = {repository = "tversteeg/castle-game"}
is-it-maintained-issue-resolution = { repository = "tversteeg/castle-game" }

[features]
default = []
inspector = ["bevy-inspector-egui"]

[dependencies]
cgmath = "0.17.0"
collision = "0.20.1"
const-tweaker = "0.3.1"
cpal = "0.11.0"
direct-gui = "0.1.25"
line_drawing = "0.8.0"
minifb = "0.19.0"
rand = "0.8.0"
sfxr = "0.1.4"
specs = { version = "0.16.1", features = ["shred-derive"] }
specs-derive = "0.4.1"

[dependencies.rust-embed]
version = "5.5.1"
features = ["interpolate-folder-path"]

[dependencies.blit]
version = "0.5.12"
default-features = false
features = ["aseprite"]

[build-dependencies]
git2 = "0.13.6"
blit = "0.5.12"
image = "0.23.6"
aseprite = "0.1.3"
serde_json = "1.0.56"
anyhow = "1.0.56"
bevy = { version = "0.7.0", default-features = false, features = ["trace"] }
bevy-inspector-egui = { version = "0.10.0", optional = true }
bevy_easings = "0.6.0"
bevy_egui = "0.13.0"
bevy-inspector-egui-rapier = { version = "0.1.1", features = ["rapier2d"] }
bevy_rapier2d = { version = "0.12.1", features = ["simd-stable", "wasm-bindgen", "render"] }
earcutr = "0.2.0"
fastrand = "1.7.0"
geo = "0.20.0"
geo-booleanop = { git = "https://github.com/21re/rust-geo-booleanop.git" }
geo-types = "0.7.4"
itertools = "0.10.3"
lyon_path = "0.17.7"
lyon_tessellation = "0.17.10"
nalgebra = "0.30.1"
noise = { version = "0.7.0", default-features = false }
mock-inspector-derive = { version = "0.0.1", path = "mock-inspector-derive" }
rand = "0.8.5"
tracing-subscriber = "0.3.11"
usvg = { version = "0.22.0", default-features = false }

[target.'cfg(target_arch = "wasm32")'.dependencies]
tracing-wasm = "0.2.1"
console_error_panic_hook = "0.1.7"

[workspace]
members = [".", "mock-inspector-derive"]

# Don't make debug builds painfully slow
[profile.dev]
opt-level = 1

# Always run release versions of slow crates
[profile.dev.package."*"]
opt-level = 3
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ To build the project you need to have [Rust](https://www.rustup.rs/) installed.

You need to install [CMake](https://cmake.org/) and make sure it's in your path.

### WASM

```sh
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli

cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --out-name castle-game --out-dir web --target web target/wasm32-unknown-unknown/release/castle-game.wasm

cargo install basic-http-server
(cd web && basic-http-server)
```

## Run

Check out the repository with git and build:
Expand Down
Binary file added assets/fonts/Pixerif.ttf
Binary file not shown.
Loading