mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-06 13:15:47 -06:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cdc6979458 | |||
| 564f88fee5 | |||
| 00c99dc05f | |||
| 1e12940445 | |||
| dc3c4a7580 | |||
| 434b62b036 | |||
| 2bd523e58a | |||
| 7cd6e8005e | |||
| a8a3745ca1 | |||
| cfa26bf146 |
203
.github/workflows/build.yaml
vendored
203
.github/workflows/build.yaml
vendored
@@ -9,7 +9,75 @@ env:
|
|||||||
RUST_TOOLCHAIN: 1.86.0
|
RUST_TOOLCHAIN: 1.86.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build (${{ matrix.target }})
|
||||||
|
env:
|
||||||
|
VCPKG_SYSTEM_LIBRARIES: "OFF"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
artifact_name: pacman
|
||||||
|
- os: macos-13
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
artifact_name: pacman
|
||||||
|
- os: windows-latest
|
||||||
|
target: x86_64-pc-windows-gnu
|
||||||
|
artifact_name: pacman.exe
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Rust Toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||||
|
|
||||||
|
- name: Rust Cache
|
||||||
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Cache vcpkg
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: target/vcpkg
|
||||||
|
key: ${{ runner.os }}-vcpkg-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-vcpkg-
|
||||||
|
|
||||||
|
- name: Vcpkg Linux Dependencies
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y build-essential gettext libltdl-dev
|
||||||
|
|
||||||
|
- name: Vcpkg
|
||||||
|
run: |
|
||||||
|
cargo install cargo-vcpkg
|
||||||
|
cargo vcpkg -v build
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
|
- name: Acquire Package Version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
PACKAGE_VERSION=$(cargo metadata --format-version 1 --no-deps | jq '.packages[0].version' -r)
|
||||||
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ matrix.target }}"
|
||||||
|
path: ./target/release/${{ matrix.artifact_name }}
|
||||||
|
retention-days: 7
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
wasm:
|
wasm:
|
||||||
|
name: Build (wasm32-unknown-emscripten)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pages: write
|
pages: write
|
||||||
@@ -23,6 +91,7 @@ jobs:
|
|||||||
uses: mymindstorm/setup-emsdk@v14
|
uses: mymindstorm/setup-emsdk@v14
|
||||||
with:
|
with:
|
||||||
version: 3.1.43
|
version: 3.1.43
|
||||||
|
actions-cache-folder: "emsdk-cache"
|
||||||
|
|
||||||
- name: Setup Rust (WASM32 Emscripten)
|
- name: Setup Rust (WASM32 Emscripten)
|
||||||
uses: dtolnay/rust-toolchain@master
|
uses: dtolnay/rust-toolchain@master
|
||||||
@@ -50,137 +119,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|
||||||
linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
TARGET: x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust Toolchain (Linux)
|
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
target: ${{ env.TARGET }}
|
|
||||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Vcpkg
|
|
||||||
run: |
|
|
||||||
cargo install cargo-vcpkg
|
|
||||||
cargo vcpkg -v build
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: Install Cargo Binstall
|
|
||||||
uses: cargo-bins/cargo-binstall@main
|
|
||||||
|
|
||||||
- name: Acquire Package Version
|
|
||||||
run: |
|
|
||||||
cargo binstall toml-cli -y
|
|
||||||
PACKAGE_VERSION=$(toml get ./Cargo.toml package.version --raw)
|
|
||||||
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
|
|
||||||
path: ./target/release/pacman
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
macos:
|
|
||||||
runs-on: macos-13
|
|
||||||
env:
|
|
||||||
TARGET: x86_64-apple-darwin
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust Toolchain (MacOS)
|
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
target: ${{ env.TARGET }}
|
|
||||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Vcpkg
|
|
||||||
run: |
|
|
||||||
cargo install cargo-vcpkg
|
|
||||||
cargo vcpkg build
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: Install Cargo Binstall
|
|
||||||
uses: cargo-bins/cargo-binstall@main
|
|
||||||
|
|
||||||
- name: Acquire Package Version
|
|
||||||
run: |
|
|
||||||
cargo binstall toml-cli -y
|
|
||||||
PACKAGE_VERSION=$(toml get ./Cargo.toml package.version --raw)
|
|
||||||
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
|
|
||||||
path: ./target/release/pacman
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
windows:
|
|
||||||
env:
|
|
||||||
TARGET: x86_64-pc-windows-gnu
|
|
||||||
SDL2: 2.30.2
|
|
||||||
SDL2_TTF: 2.22.0
|
|
||||||
SDL2_MIXER: 2.8.0
|
|
||||||
SDL2_IMAGE: 2.8.2
|
|
||||||
# SDL2_GFX: 1.0.4
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust (Windows)
|
|
||||||
uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
target: ${{ env.TARGET }}
|
|
||||||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
|
||||||
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Vcpkg
|
|
||||||
run: |
|
|
||||||
cargo install cargo-vcpkg
|
|
||||||
cargo vcpkg build
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: Install Cargo Binstall
|
|
||||||
uses: cargo-bins/cargo-binstall@main
|
|
||||||
|
|
||||||
- name: Acquire Package Version
|
|
||||||
run: |
|
|
||||||
cargo binstall toml-cli -y
|
|
||||||
PACKAGE_VERSION=$(toml get ./Cargo.toml package.version --raw)
|
|
||||||
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $env:GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "pacman-${{ env.PACKAGE_VERSION }}-${{ env.TARGET }}"
|
|
||||||
path: ./target/release/pacman.exe
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|||||||
7
BUILD.md
7
BUILD.md
@@ -1,7 +0,0 @@
|
|||||||
# Building Pac-Man
|
|
||||||
|
|
||||||
## GitHub Actions Workflow
|
|
||||||
|
|
||||||
1. Build workflow produces executables & WASM files for all platforms
|
|
||||||
2. Uploaded as artifacts
|
|
||||||
3. Deployment workflow downloads artifacts and uploads to GitHub Pages
|
|
||||||
@@ -41,7 +41,8 @@ rev = "2024.05.24" # release 2024.05.24 # to check for a new one, check https://
|
|||||||
|
|
||||||
[package.metadata.vcpkg.target]
|
[package.metadata.vcpkg.target]
|
||||||
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }
|
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }
|
||||||
stable-x86_64-unknown-linux-gnu = { triplet = "x86_64-unknown-linux-gnu" }
|
x86_64-unknown-linux-gnu = { triplet = "x64-linux" }
|
||||||
|
# x86_64-apple-darwin = { triplet = "x64-osx-release" }
|
||||||
|
|
||||||
[target.'cfg(target_os = "emscripten")'.dependencies]
|
[target.'cfg(target_os = "emscripten")'.dependencies]
|
||||||
libc = "0.2.16"
|
libc = "0.2.16"
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
# Implementation
|
|
||||||
|
|
||||||
A document detailing the implementation the project from rendering, to game logic, to build systems.
|
|
||||||
|
|
||||||
## Rendering
|
|
||||||
|
|
||||||
1. Map
|
|
||||||
- May require procedural text generation later on (cacheable?)
|
|
||||||
2. Pacman
|
|
||||||
3. Ghosts
|
|
||||||
- Requires colors
|
|
||||||
4. Items
|
|
||||||
5. Interface
|
|
||||||
- Requires fonts
|
|
||||||
|
|
||||||
## Grid System
|
|
||||||
|
|
||||||
1. How does the grid system work?
|
|
||||||
|
|
||||||
The grid is 28 x 36 (although, the map texture is 28 x 37), and each cell is 24x24 (pixels).
|
|
||||||
Many of the walls in the map texture only occupy a portion of the cell, so some items are able to render across multiple cells.
|
|
||||||
24x24 assets include pellets, the energizer, and the map itself ()
|
|
||||||
|
|
||||||
2. What constraints must be enforced on Ghosts and PacMan?
|
|
||||||
|
|
||||||
3. How do movement transitions work?
|
|
||||||
|
|
||||||
All entities store a precise position, and a direction. This position is only used for animation, rendering, and collision purposes. Otherwise, a separate 'cell position' (which is 24 times less precise, owing to the fact that it is based on the entity's position within the grid).
|
|
||||||
|
|
||||||
When an entity is transitioning between cells, movement directions are acknowledged, but won't take effect until the next cell has been entered completely.
|
|
||||||
|
|
||||||
4. Between transitions, how does collision detection work?
|
|
||||||
|
|
||||||
It appears the original implementation used cell-level detection.
|
|
||||||
I worry this may be prone to division errors. Make sure to use rounding (50% >=).
|
|
||||||
Reference in New Issue
Block a user