From aba736b02c834b9dcb406ae5079136b118cbed88 Mon Sep 17 00:00:00 2001 From: florianvazelle Date: Tue, 29 Aug 2023 21:46:20 +0200 Subject: [PATCH] update game building --- .github/actions/export-game/action.yml | 17 ++--- .github/workflows/release-packaging.yml | 22 +++--- .godot_version | 1 + .pre-commit-config.yaml | 4 +- .reuse/REUSE-compliant.svg | 1 + .reuse/dep5 | 23 +++--- .version | 1 + CREDITS.md | 14 ++-- Makefile | 95 +++++++++++++++++++++++++ README.md | 17 +++-- generate_credits.py | 82 ++++++++------------- 11 files changed, 175 insertions(+), 102 deletions(-) create mode 100644 .godot_version create mode 100644 .reuse/REUSE-compliant.svg create mode 100644 .version create mode 100644 Makefile diff --git a/.github/actions/export-game/action.yml b/.github/actions/export-game/action.yml index 6cda89c..2174b6c 100644 --- a/.github/actions/export-game/action.yml +++ b/.github/actions/export-game/action.yml @@ -24,25 +24,26 @@ runs: with: version: ${{ inputs.version }} - - name: Setup Godot Templates - shell: bash - run: | - mkdir -v -p ~/.local/share/godot/export_templates - mv /root/.local/share/godot/export_templates/${{ inputs.godot_version }}.stable ~/.local/share/godot/export_templates/${{ inputs.godot_version }}.stable + - name: Setup Godot + uses: chickensoft-games/setup-godot@v1 + with: + version: ${{ inputs.godot_version }} + use-dotnet: false - name: Install Addons shell: bash run: | [ -f plug.gd ] && godot --headless -s plug.gd install || true + # workaround: https://github.com/godotengine/godot/pull/68461 - name: Import Assets shell: bash run: | - godot --editor --quit --headless + timeout 60 godot --editor --headless || true - name: Build ${{ inputs.preset }} shell: bash run: | [ -d build ] && rm -r build - mkdir -v -p build/${{ matrix.platform }} - godot --export-release "${{ inputs.preset }}" --headless ./build/${{ matrix.platform }}/${{ inputs.output }} + mkdir -v -p build/${{ inputs.platform }} + timeout 60 godot --export-release "${{ inputs.preset }}" --headless ./build/${{ inputs.platform }}/${{ inputs.output }} || true diff --git a/.github/workflows/release-packaging.yml b/.github/workflows/release-packaging.yml index 9d80c6e..031bd6a 100644 --- a/.github/workflows/release-packaging.yml +++ b/.github/workflows/release-packaging.yml @@ -1,4 +1,3 @@ - name: Release Packaging on: @@ -6,15 +5,10 @@ on: branches: [main] workflow_dispatch: -env: - version: '1.4.0' - godot_version: '4.1' - jobs: release-packaging: runs-on: ubuntu-20.04 - container: - image: barichello/godot-ci:4.1 + timeout-minutes: 30 strategy: fail-fast: false @@ -28,9 +22,9 @@ jobs: output: Marble.x86_64 preset: Linux/X11 - - platform: web - output: index.html - preset: Web + # - platform: web + # output: index.html + # preset: Web - platform: mac output: Marble.zip @@ -40,13 +34,19 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Setup Versions Vars + run: | + echo "game_version=$(cat .version)" >> $GITHUB_ENV + echo "godot_version=$(cat .godot_version)" >> $GITHUB_ENV + ./bump_version.sh + - name: Export Marble uses: ./.github/actions/export-game with: platform: ${{ matrix.platform }} output: ${{ matrix.output }} preset: ${{ matrix.preset }} - version: ${{ env.version }} + version: ${{ env.game_version }} godot_version: ${{ env.godot_version }} - name: Upload artifact diff --git a/.godot_version b/.godot_version new file mode 100644 index 0000000..627a3f4 --- /dev/null +++ b/.godot_version @@ -0,0 +1 @@ +4.1.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70a70c1..a31b0b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,8 +46,10 @@ repos: files: '[^a-z0-9._/-]' exclude: | (?x)^( + .reuse/| LICENSES/| public/| + Makefile| CONTRIBUTING.md| CREDITS.md| LICENSE.md| @@ -70,7 +72,7 @@ repos: - --style=file - -Werror language: system - files: \.shader$ + files: \.gdshader$ exclude: ^addons/ - id: lint-gdscript name: lint gdscript diff --git a/.reuse/REUSE-compliant.svg b/.reuse/REUSE-compliant.svg new file mode 100644 index 0000000..f806584 --- /dev/null +++ b/.reuse/REUSE-compliant.svg @@ -0,0 +1 @@ +REUSE: compliantREUSEcompliant diff --git a/.reuse/dep5 b/.reuse/dep5 index ad69da2..6d1c15a 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -9,25 +9,20 @@ License: MIT # Addons -Files: addons/flexible_toon_shader/* -Copyright: 2021 John Wigg +Files: addons/gd-plug/* +Copyright: 2021 Tan Jian Ping License: MIT -Source: https://github.com/CaptainProton42/FlexibleToonShaderGD +Source: https://github.com/imjp94/gd-plug -Files: addons/fps_graph_overlay/* -Copyright: 2023 Sander Vanhove +Files: addons/debug_menu/* +Copyright: 2023-present Hugo Locurcio and contributors License: MIT -Source: https://github.com/SanderVanhove/godot-fps-graph-overlay +Source: https://github.com/godot-extended-libraries/godot-debug-menu -Files: addons/kanban_tasks/* -Copyright: 2022-2023 HolonProduction +Files: addons/UniversalFade/* +Copyright: 2019 Tomek License: MIT -Source: https://github.com/HolonProduction/godot_kanban_tasks - -Files: addons/lod/* -Copyright: 2020 Hugo Locurcio and contributors -License: MIT -Source: https://github.com/godot-extended-libraries/godot-lod +Source: https://github.com/KoBeWi/Godot-Universal-Fade # Models diff --git a/.version b/.version new file mode 100644 index 0000000..88c5fb8 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +1.4.0 diff --git a/CREDITS.md b/CREDITS.md index 44f3d54..ef8172b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,15 +1,13 @@ # Credits ## Addons -- "[addons/flexible_toon_shader/*](https://github.com/CaptainProton42/FlexibleToonShaderGD)" by **John Wigg** licensed under [MIT](https://spdx.org/licenses/MIT.html) -- "[addons/fps_graph_overlay/*](https://github.com/SanderVanhove/godot-fps-graph-overlay)" by **Sander Vanhove** licensed under [MIT](https://spdx.org/licenses/MIT.html) -- "[addons/kanban_tasks/*](https://github.com/HolonProduction/godot_kanban_tasks)" by **HolonProduction** licensed under [MIT](https://spdx.org/licenses/MIT.html) -- "[addons/lod/*](https://github.com/godot-extended-libraries/godot-lod)" by **Hugo Locurcio and contributors** licensed under [MIT](https://spdx.org/licenses/MIT.html) -## Assets -### Models +- "[addons/gd-plug/*](https://github.com/imjp94/gd-plug)" by **Tan Jian Ping** licensed under [MIT](https://spdx.org/licenses/MIT.html) +- "[addons/debug_menu/*](https://github.com/godot-extended-libraries/godot-debug-menu)" by **Hugo Locurcio and contributors** licensed under [MIT](https://spdx.org/licenses/MIT.html) +- "[addons/UniversalFade/*](https://github.com/KoBeWi/Godot-Universal-Fade)" by **Tomek** licensed under [MIT](https://spdx.org/licenses/MIT.html) +## Models - "[assets/blocks/*](https://github.com/Zylann/marbles)" by **Zylann** licensed under [MIT](https://spdx.org/licenses/MIT.html) -### Textures +## Textures - "[assets/icons/*](https://icons8.com/)" by **Icons8** licensed under [LicenseRef-linksware](https://spdx.org/licenses/LicenseRef-linksware.html) - "[assets/marble/*](https://ambientcg.com/view?id=Ground037)" by **Lennart Demes** licensed under [CC0-1.0](https://spdx.org/licenses/CC0-1.0.html) -### Fonts +## Fonts - "[assets/fonts/box_pixies.ttf](https://www.fontspace.com/boxpixies-font-f27657)" by **Heaven Castro** licensed under [CC0-1.0](https://spdx.org/licenses/CC0-1.0.html) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8ecb747 --- /dev/null +++ b/Makefile @@ -0,0 +1,95 @@ +############# +# Variables # +############# + +GODOT_VERSION := $(shell cat .godot_version) +RELEASE_NAME = stable +SUBDIR = +GODOT_PLATFORM = linux.x86_64 +GODOT_FILENAME = Godot_v${GODOT_VERSION}-${RELEASE_NAME}_${GODOT_PLATFORM} +GODOT_TEMPLATE = Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz + +GAME_NAME = Marble +GAME_VERSION := $(shell cat .version) + +############# +# Commands # +############# + +mkflower: + mkdir -p .mkflower + mkdir -p .mkflower/build + mkdir -p .mkflower/bin + mkdir -p .mkflower/cache + + touch .mkflower/.gitignore + echo '*' >> .mkflower/.gitignore + + touch .mkflower/.gdignore + +install_godot: mkflower + # curl -X GET "https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/SHA512-SUMS.txt" --output .mkflower/cache/SHA512-SUMS.txt + # if [ ! -f ".mkflower/cache/${GODOT_FILENAME}" ] || [ "$(cat .mkflower/cache/SHA512-SUMS.txt | grep ${GODOT_FILENAME} | awk -F'[[:space:]]+' '{print $1}')" != "$(sha256sum .mkflower/cache/${GODOT_FILENAME})" ]; then \ + curl -X GET "https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/${GODOT_FILENAME}.zip" --output .mkflower/cache/${GODOT_FILENAME}.zip; \ + unzip .mkflower/cache/${GODOT_FILENAME}.zip -d .mkflower/cache/; \ + cp .mkflower/cache/${GODOT_FILENAME} .mkflower/bin/${GODOT_FILENAME}; + # fi + +install_templates: mkflower + curl -X GET "https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/${GODOT_TEMPLATE}" --output .mkflower/cache/${GODOT_TEMPLATE}; \ + unzip .mkflower/cache/${GODOT_TEMPLATE} -d .mkflower/cache/; \ + mkdir -p ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME}; \ + cp .mkflower/cache/templates/* ~/.local/share/godot/export_templates/${GODOT_VERSION}.${RELEASE_NAME}; + +install_addons: + .mkflower/bin/${GODOT_FILENAME} --headless --script plug.gd install || true + +import_resources: + .mkflower/bin/${GODOT_FILENAME} --headless --export-pack null /dev/null + # timeout 60 .mkflower/bin/${GODOT_FILENAME} --editor || true + # .mkflower/bin/${GODOT_FILENAME} --headless --quit --editor + +export_release_linux: + mkdir -p .mkflower/build/linux + .mkflower/bin/${GODOT_FILENAME} --export-release "Linux/X11" --headless .mkflower/build/linux/${GAME_NAME}.x86_64 + (cd .mkflower/build/linux && zip ${GAME_NAME}-linux-v${GAME_VERSION}.zip -r .) + mv .mkflower/build/linux/${GAME_NAME}-linux-v${GAME_VERSION}.zip .mkflower/build/${GAME_NAME}-linux-v${GAME_VERSION}.zip + +export_release_windows: + mkdir -p .mkflower/build/windows + .mkflower/bin/${GODOT_FILENAME} --export-release "Windows Desktop" --headless .mkflower/build/windows/${GAME_NAME}.exe + (cd .mkflower/build/windows && zip ${GAME_NAME}-windows-v${GAME_VERSION}.zip -r .) + mv .mkflower/build/windows/${GAME_NAME}-windows-v${GAME_VERSION}.zip .mkflower/build/${GAME_NAME}-windows-v${GAME_VERSION}.zip + +export_release_mac: + .mkflower/bin/${GODOT_FILENAME} --export-release "macOS" --headless .mkflower/build/${GAME_NAME}-mac-v${GAME_VERSION}.zip + +editor: + .mkflower/bin/${GODOT_FILENAME} --editor + +godot: + .mkflower/bin/${GODOT_FILENAME} $(ARGS) + +run_release: + .mkflower/build/linux/${GAME_NAME}.x86_64 + +clean_mkflower: + rm -rf .mkflower + +clean_godot: + rm -rf .godot + +clean_plug: + rm -rf .plugged + find addons/ -type d -not -name 'addons' -not -name 'gd-plug' -exec rm -rf {} \; || true + +############# +# Playbook # +############# + +clean: clean_mkflower clean_godot clean_plug +build: clean_godot clean_plug install_addons import_resources export_release_linux +run: build run_release + +export_release_all: export_release_linux export_release_mac export_release_windows +ci_build: clean install_godot install_templates install_addons import_resources export_release_all diff --git a/README.md b/README.md index a9528f3..426ccc2 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ # ⚽ Marble -![Godot Badge](https://img.shields.io/badge/godot-4.1-blue?logo=Godot-Engine&logoColor=white) ![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white) ![license](https://img.shields.io/badge/license-MIT-green?logo=open-source-initiative&logoColor=white) +![Godot Badge](https://img.shields.io/badge/godot-4.1-blue?logo=Godot-Engine&logoColor=white) ![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white) ![license](https://img.shields.io/badge/license-MIT-green?logo=open-source-initiative&logoColor=white) ![reuse](./.reuse/REUSE-compliant.svg) A marble race minigame, made with [Godot Engine](https://godotengine.org/). Download on  Github Download on  itch.io -Download on Flathub -Download on Snap Store + + @@ -20,10 +20,8 @@ Marble is an open source mini-game about marble racing. ### Controls -- `WASD` to move. -- `Mouse` to move the camera around. -- `Tab` to follow a marble. -- `ESC` to open and close pause menu. +- `Tab` to follow an other marble. +- `ESC` to open and close menu. ### Features @@ -31,6 +29,11 @@ Marble is an open source mini-game about marble racing. - Start procedural races. - Watch the real-time ranking. +There are two racing modes: **normal** and **explosion**. + +In **explosion**, a timer starts, and when it reaches zero the last marble explodes. +The race is infinite, and the game ends when only one marble remains. + ### Screenshots
diff --git a/generate_credits.py b/generate_credits.py index 7da1edd..46f4cfd 100644 --- a/generate_credits.py +++ b/generate_credits.py @@ -1,18 +1,6 @@ import os from string import Template -ADDON = "addon" -MODEL = "model" -TEXTURE = "texture" -FONT = "font" - -SECTIONS = { - ADDON, - MODEL, - TEXTURE, - FONT, -} - def main(): template = Template(( @@ -20,63 +8,51 @@ def main(): ' under [$license](https://spdx.org/licenses/$license.html)\n' )) - deps = {section: [] for section in SECTIONS} - last_section = None + deps = {} + section = None with open(".reuse/dep5", "r") as file: for line in file: - if "# Addons" in line: - last_section = ADDON - elif "# Models" in line: - last_section = MODEL - elif "# Textures" in line: - last_section = TEXTURE - elif "# Fonts" in line: - last_section = FONT - - if last_section is None: + if line.startswith('# '): + section = line[len("# "): -1].lower() + + if section is None: continue if line.startswith("Files: "): - deps[last_section].append({"files": line[len("Files: "):-1]}) + if section not in deps: + deps[section] = [] + + deps[section].append({"files": line[len("Files: "):-1]}) + + elif line.startswith("Copyright: "): + if section not in deps: + deps[section] = [] - elif last_section and line.startswith("Copyright: "): date_author = line[len("Copyright: "):-1].split(" ") date_author.pop(0) - deps[last_section][-1]["author"] = " ".join(date_author) + deps[section][-1]["author"] = " ".join(date_author) + + elif line.startswith("License: "): + if section not in deps: + deps[section] = [] - elif last_section and line.startswith("License: "): - deps[last_section][-1]["license"] = line[len("License: "):-1] + deps[section][-1]["license"] = line[len("License: "):-1] - elif last_section and line.startswith("Source: "): - deps[last_section][-1]["source"] = line[len("Source: "):-1] + elif line.startswith("Source: "): + if section not in deps: + deps[section] = [] - if deps[ADDON] or deps[MODEL] or deps[TEXTURE] or deps[FONT]: + deps[section][-1]["source"] = line[len("Source: "):-1] + + if deps: with open("CREDITS.md", "w") as file: file.writelines("# Credits\n\n") - if deps[ADDON]: - file.writelines("## Addons\n") - for dep in deps[ADDON]: + for key, value in deps.items(): + file.writelines(f"## {key.title()}\n") + for dep in value: file.writelines(template.substitute(**dep)) - - if deps[MODEL] or deps[TEXTURE] or deps[FONT]: - file.writelines("## Assets\n") - - if deps[MODEL]: - file.writelines("### Models\n") - for dep in deps[MODEL]: - file.writelines(template.substitute(**dep)) - - if deps[TEXTURE]: - file.writelines("### Textures\n") - for dep in deps[TEXTURE]: - file.writelines(template.substitute(**dep)) - - if deps[FONT]: - file.writelines("### Fonts\n") - for dep in deps[FONT]: - file.writelines(template.substitute(**dep)) else: if os.path.exists("CREDITS.md"): os.remove("CREDITS.md")