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 #56

Draft
wants to merge 75 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
01d3969
refactor!: start anew
tversteeg Jul 21, 2023
2c30c70
refactor: move window to own file
tversteeg Jul 21, 2023
a1e4fd8
chore: change license to APGL
tversteeg Jul 21, 2023
641d7b9
feat(terrain): basic with camera panning
tversteeg Jul 21, 2023
30427cd
feat: clamp camera position to level
tversteeg Jul 22, 2023
2ceeafb
feat(unit): add and move over terrain
tversteeg Jul 22, 2023
edcabe0
chore: move assets to own module and make it static
tversteeg Jul 23, 2023
d968c28
chore: set MSRV to 1.70
tversteeg Jul 23, 2023
045c572
feat(unit): spawner & split sprites
tversteeg Jul 23, 2023
618c036
feat(assets): assets_manager implementation with hot-reloading
tversteeg Jul 23, 2023
c6db99b
feat(assets): hot-reloadable settings.toml for global settings
tversteeg Jul 23, 2023
e2f2a5e
feat(unit): throw projectiles
tversteeg Jul 24, 2023
c45879a
feat(debug): special state viewable with spacebar
tversteeg Jul 24, 2023
1620e2a
feat(enemy): spawn dynamically from script
tversteeg Jul 25, 2023
8bf16d8
feat(random): allow random range in settings
tversteeg Jul 26, 2023
d6e5cf7
feat(physics): start writing engine using XPBD
tversteeg Jul 26, 2023
44dea3d
feat(constraint): add ground constraint
tversteeg Jul 27, 2023
587f3f6
feat(collision): start implementing a spatial hash grid
tversteeg Jul 27, 2023
65faf16
feat(collision): implement spatial hash grid
tversteeg Jul 28, 2023
ad105b2
feat(collision): implement boolean collision detection with Separatin…
tversteeg Jul 28, 2023
15bc294
feat(collision): return collision information from SAT
tversteeg Jul 29, 2023
8069fc8
feat(physics): resolve collisions without angular momentum
tversteeg Jul 29, 2023
6c5b26a
feat(physics): implement angular velocity
tversteeg Jul 30, 2023
b4474aa
fix(physics): remove ground constraint
tversteeg Jul 30, 2023
3a01f4f
refactor(assets): use global init function for all asset loading
tversteeg Jul 31, 2023
4864946
fix(wasm): remove nightly needed to build
tversteeg Jul 31, 2023
d20a372
fix(collision): use predicted AABR for broad-phase
tversteeg Jul 31, 2023
480d64f
style(font): tiny debug font
tversteeg Jul 31, 2023
4fe750a
fix(collision): collision detection with parry2d
tversteeg Aug 2, 2023
b465b26
refactor(input): store state properly
tversteeg Aug 3, 2023
90d4fa9
fix(physics): partially implement friction
tversteeg Aug 4, 2023
66b95ab
fix(collision): detection angle
tversteeg Aug 5, 2023
384db5b
refactor(game): use physics engine
tversteeg Aug 5, 2023
d46f0a1
fix(build): disable debug on wasm
tversteeg Aug 6, 2023
15ccd15
feat(sprite): allow custom drawing offsets
tversteeg Aug 6, 2023
254c2a9
fix(physics): grid & friction related bugs
tversteeg Aug 6, 2023
eb4d7a7
refactor(collision): simplify and improve performance
tversteeg Aug 7, 2023
3581cd6
fix(collision): remove old structs
tversteeg Aug 7, 2023
e58aa58
fix(collision): heightmap collider
tversteeg Aug 8, 2023
9c9de4a
fix(debug): cleanup & integrate with game
tversteeg Aug 9, 2023
0f191f5
feat(physics): attempt to let projectiles follow direction of flight
tversteeg Aug 10, 2023
d15d63e
perf(physics): reduce a lot of collision detection allocations
tversteeg Aug 11, 2023
6600fe1
refactor(physics): creating rigidbody returns auto-destroying handles
tversteeg Aug 11, 2023
1f7ce57
feat(debug): show broad-phase grid
tversteeg Aug 12, 2023
8511e19
feat(physics): apply partially working airflow torque stabilization t…
tversteeg Aug 12, 2023
f1fbb6f
refactor: change float precision from 32 to 64
tversteeg Aug 13, 2023
615cc4a
perf(collision): broad-phase caching
tversteeg Aug 13, 2023
d34f227
perf(collision): use shared shape when loading
tversteeg Aug 13, 2023
b372c55
fix(unit): walk again
tversteeg Aug 14, 2023
491c555
feat(debug): add toggle to show colliders
tversteeg Aug 14, 2023
3e3d2c5
refactor(physics): start implementing rigid bodies in an ECS
tversteeg Aug 15, 2023
4231257
refactor(physics): ECS WIP
tversteeg Aug 16, 2023
70e267b
refactor(physics): implement ECS
tversteeg Aug 17, 2023
ede50a2
refactor(collision): change broad-phase from custom grid to bvh-arena
tversteeg Aug 18, 2023
6809f90
feat(physics): support kinematic rigidbodies
tversteeg Aug 19, 2023
1b0ed56
feat(graphics): render healthbar for units
tversteeg Aug 19, 2023
92c59cc
feat: detect collisions between projectiles and units
tversteeg Aug 20, 2023
6fd60a3
feat(unit): add configurable collider
tversteeg Aug 20, 2023
fa3822e
feat(terrain): procedurally generate
tversteeg Aug 21, 2023
fd21a73
feat(terrain): allow removal of pixels to create craters
tversteeg Aug 23, 2023
0d08ce5
feat: generate collider for solid shape
tversteeg Aug 25, 2023
526cd9c
refactor: simplify solid shape pixel deletion
tversteeg Aug 26, 2023
9c2a4a2
feat(isoline): start implementing partial updates
tversteeg Aug 27, 2023
cd5d9ac
fix: properly clip removal shape edges
tversteeg Aug 27, 2023
a3afdb4
feat: partially implement splitting of shapes based on masks
tversteeg Aug 28, 2023
3b015e5
chore: simplify isoline
tversteeg Aug 28, 2023
e6e12bd
fix: algorithm bounds checking
tversteeg Aug 29, 2023
b5eb362
fix: hole algorithm
tversteeg Aug 30, 2023
370020b
refactor: simplify island detection
tversteeg Aug 31, 2023
ef6d5ae
chore: improve WASM
tversteeg Sep 28, 2023
620644c
refactor(window): use pixel-game-lib
tversteeg Oct 21, 2023
1324af9
refactor: move physics to pixel-game-lib
tversteeg Oct 25, 2023
ce76bde
chore(ci): update and add auto-release
tversteeg Oct 25, 2023
b4026cd
chore(deps): update crate pixel-game-lib to 0.4
tversteeg Nov 20, 2023
8c00260
chore(deps): update rust dependencies
tversteeg Mar 8, 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
8 changes: 8 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":automergeAll",
":automergeBranch"
]
}
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- master

jobs:
release-plz:
name: Release PR
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
212 changes: 39 additions & 173 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,218 +4,84 @@ on:
paths-ignore:
- "docs/**"
- "**.md"
pull_request:
paths-ignore:
- "docs/**"
- "**.md"

jobs:
# Run the `rustfmt` code formatter
# Check for formatting
rustfmt:
name: Rustfmt [Formatter]
name: Formatter check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- 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

# 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

# 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
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all

# Run tests on Linux, macOS, and Windows
# On both Rust stable and Rust nightly
# Run test check on Linux, macOS, and Windows
test:
name: Test Suite
needs: [cargo_check]
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable, nightly]
steps:
# Checkout the branch being tested
- uses: actions/checkout@v1
- uses: actions/checkout@v4

# Install all the required dependencies for testing
- uses: actions-rs/toolchain@v1
# Install rust stable
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true

# Install Node.js at a fixed version
- uses: actions/setup-node@v1
# Cache the built dependencies
- uses: Swatinem/[email protected]
with:
node-version: "12.0"
save-if: ${{ github.event_name == 'push' }}

# Install Ruby at a fixed version
- uses: actions/setup-ruby@v1
with:
ruby-version: "2.6"

# Install Python at a fixed version
- uses: actions/setup-python@v1
with:
python-version: "3.7"
# Install cargo-hack
- uses: taiki-e/install-action@cargo-hack

# Install dotnet at a fixed version
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "2.2.402"

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y xorg-dev libasound2-dev

# 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
# Test all feature combinations on the target platform
- name: Test
run: cargo hack --feature-powerset test

# Build sources for every OS
github_build:
if: startsWith(github.ref, 'refs/tags/v')
name: Build release binaries
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-msvc
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: castle-game-x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-apple-darwin
os: macOS-latest
name: castle-game-x86_64-apple-darwin.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
name: castle-game-x86_64-pc-windows-msvc.zip
runs-on: ${{ matrix.os }}
# Build the WASM target & push it to GitHub pages
wasm:
name: WASM test & build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
# Install rust stable
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
target: ${{ matrix.target }}
targets: wasm32-unknown-unknown

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y xorg-dev libasound2-dev

- name: Build target
uses: actions-rs/cargo@v1
# Cache the built dependencies
- uses: Swatinem/[email protected]
with:
command: build
args: --release --target ${{ matrix.target }}

- name: Prepare build artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip castle-game.exe
7z a ../../../${{ matrix.name }} castle-game.exe
cd -
save-if: ${{ github.event_name == 'push' }}

- 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
cd -

- name: Upload build artifact
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}

# Create GitHub release with Rust build targets and release notes
github_release:
if: startsWith(github.ref, 'refs/tags/v')
name: Create GitHub Release
needs: github_build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# Build the WASM
- name: Build
run: cargo run --package run-wasm -- --bin castle-game --no-default-features --release --build-only

# These can be squashed when https://github.com/actions/download-artifact/issues/6 is closed
- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-unknown-linux-gnu.tar.gz
path: .
- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-apple-darwin.tar.gz
path: .
- name: Download releases from github_build
uses: actions/download-artifact@v1
with:
name: castle-game-x86_64-pc-windows-msvc.zip
path: .

- name: Generate checksums
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-*
# Deploy to GitHub pages
- name: Deploy to GitHub Pages
uses: s0/git-publish-subdir-action@master
env:
REPO: self
BRANCH: gh-pages
FOLDER: target/wasm-examples/castle-game
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

resources/
assets/
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Expand Down
70 changes: 35 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "castle-game"
version = "0.1.37-alpha.0"
edition = "2018"
authors = ["Thomas Versteeg <[email protected]>"]
version = "0.2.0"
edition = "2021"
authors = ["Thomas Versteeg <[email protected]>"]
license = "GPL-3.0"
homepage = "https://github.com/tversteeg/castle-game"

Expand All @@ -13,37 +13,37 @@ 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 = ["debug"]
debug = ["drawille"]

[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"
blit = "0.8"
miette = { version = "7", features = ["fancy"] }
image = { version = "0.24", default-features = false, features = ["png"] }
rotsprite = "0.1"
vek = "0.16"
serde = "1"
itertools = "0.12"
parry2d-f64 = { version = "0.13", features = ["simd-stable"] }
hecs = { version = "0.10", features = ["macros"] }
bvh-arena = "1"
raqote = { version = "0.8", default-features = false }
bitvec = "1"
line_drawing = "1"
drawille = { version = "0.3", optional = true }
spiral = "0.2"
pixel-game-lib = "0.8"
assets_manager = "0.11"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
fastrand = "2"
puffin = "0.19"
puffin_http = "0.16"

[target.'cfg(target_arch = "wasm32")'.dependencies]
fastrand = { version = "2", default-features = false, features = ["js"] }
puffin = "0.19"

[workspace]
members = ["run-wasm"]
Loading
Loading