From cde8d9d234e9d1249c1c59ce10a56b30a7462cf9 Mon Sep 17 00:00:00 2001 From: Vinay Date: Sun, 28 Jun 2026 22:14:46 +0530 Subject: [PATCH 1/4] Add base Godot project setup --- .gitignore | 11 ++++++++++- Makefile | 21 +++++++++++++++++++++ README.md | 23 +++++++++++++++++++++++ godot/assets/.gitkeep | 1 + godot/autoloads/.gitkeep | 1 + godot/export_presets.cfg | 28 ++++++++++++++++++++++++++++ godot/project.godot | 25 +++++++++++++++++++++++++ godot/scenes/Main.tscn | 27 +++++++++++++++++++++++++++ godot/scripts/.gitkeep | 1 + godot/shaders/.gitkeep | 1 + 10 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 godot/assets/.gitkeep create mode 100644 godot/autoloads/.gitkeep create mode 100644 godot/export_presets.cfg create mode 100644 godot/project.godot create mode 100644 godot/scenes/Main.tscn create mode 100644 godot/scripts/.gitkeep create mode 100644 godot/shaders/.gitkeep diff --git a/.gitignore b/.gitignore index baf5a0b..7bc8ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,13 @@ .stellar-game-studio/ .zemeroth/ zemeroth-full/ -.vscode/ \ No newline at end of file +.vscode/ + +# Godot editor cache and generated imports +godot/.godot/ +godot/**/*.import + +# Godot web exports are generated with `make godot-export`. +/dist/ + +# godot/export_presets.cfg is intentionally tracked. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..18fc732 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +.PHONY: godot-export + +godot-export: + @set -eu; \ + if command -v godot4 >/dev/null 2>&1; then \ + GODOT_BIN=godot4; \ + elif command -v godot >/dev/null 2>&1; then \ + GODOT_BIN=godot; \ + else \ + echo "Error: Godot 4 was not found. Install it and expose 'godot4' or 'godot' in PATH." >&2; \ + exit 1; \ + fi; \ + GODOT_VERSION="$$("$$GODOT_BIN" --version)"; \ + case "$$GODOT_VERSION" in \ + 4.*) ;; \ + *) echo "Error: $$GODOT_BIN is $$GODOT_VERSION; Godot 4.x is required." >&2; exit 1 ;; \ + esac; \ + mkdir -p dist; \ + DIST_PATH="$$(pwd)/dist/index.html"; \ + echo "Exporting Godot Web build with $$GODOT_BIN to $$DIST_PATH"; \ + "$$GODOT_BIN" --headless --path godot --export-release Web "$$DIST_PATH" diff --git a/README.md b/README.md index b3baf8c..0f51e9a 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,29 @@ The flow is aligned with Stellar hackathon architecture and is prepared for deep - `scripts/serve-civ-lite.sh` - `scripts/game-studio.sh` +## Godot project + +The base Godot project lives in `godot/` and requires Godot 4.x. + +To open it, import `godot/project.godot` from the Godot Project Manager or run: + +```bash +godot4 --editor --path godot +``` + +If your Godot 4 executable is named `godot`, use that command instead. + +Install the matching Godot export templates before exporting for the first time. +Then export the Web build from the repository root: + +```bash +make godot-export +``` + +The command detects `godot4` or `godot`, runs the `Web` export preset in headless +mode, and writes the generated entry point to `dist/index.html`. The generated +`dist/` directory is intentionally not tracked. + ## Third-party references and licenses - Unciv assets inspiration (visual assets used in demo pipeline) diff --git a/godot/assets/.gitkeep b/godot/assets/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/godot/assets/.gitkeep @@ -0,0 +1 @@ + diff --git a/godot/autoloads/.gitkeep b/godot/autoloads/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/godot/autoloads/.gitkeep @@ -0,0 +1 @@ + diff --git a/godot/export_presets.cfg b/godot/export_presets.cfg new file mode 100644 index 0000000..07a6945 --- /dev/null +++ b/godot/export_presets.cfg @@ -0,0 +1,28 @@ +[preset.0] + +name="Web" +platform="Web" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../dist/index.html" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +variant/extensions_support=false +variant/thread_support=false +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=true +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false diff --git a/godot/project.godot b/godot/project.godot new file mode 100644 index 0000000..e7777eb --- /dev/null +++ b/godot/project.godot @@ -0,0 +1,25 @@ +; Engine configuration file. +; Edit this file through the Godot editor when possible. +; +; Format: +; [section] +; param=value + +config_version=5 + +[application] + +config/name="HumanVsBots" +run/main_scene="res://scenes/Main.tscn" + +[display] + +window/size/viewport_width=1280 +window/size/viewport_height=720 +window/stretch/mode="canvas_items" + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +renderer/rendering_method.web="gl_compatibility" diff --git a/godot/scenes/Main.tscn b/godot/scenes/Main.tscn new file mode 100644 index 0000000..7467e97 --- /dev/null +++ b/godot/scenes/Main.tscn @@ -0,0 +1,27 @@ +[gd_scene format=3] + +[node name="Main" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Title" type="Label" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -160.0 +offset_top = -16.0 +offset_right = 160.0 +offset_bottom = 16.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "Human vs Bots" +horizontal_alignment = 1 +vertical_alignment = 1 +theme_override_font_sizes/font_size = 24 diff --git a/godot/scripts/.gitkeep b/godot/scripts/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/godot/scripts/.gitkeep @@ -0,0 +1 @@ + diff --git a/godot/shaders/.gitkeep b/godot/shaders/.gitkeep new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/godot/shaders/.gitkeep @@ -0,0 +1 @@ + From d120003a53d272a56b3d1a1f0ea56e97a1f5805e Mon Sep 17 00:00:00 2001 From: Vinay Date: Sun, 28 Jun 2026 22:27:12 +0530 Subject: [PATCH 2/4] Add Godot Web build workflow --- .github/workflows/godot-build.yml | 55 +++++++++++++++++++++++++++++++ README.md | 14 ++++++++ 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/godot-build.yml diff --git a/.github/workflows/godot-build.yml b/.github/workflows/godot-build.yml new file mode 100644 index 0000000..0993425 --- /dev/null +++ b/.github/workflows/godot-build.yml @@ -0,0 +1,55 @@ +name: Godot Web build + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + build: + name: Build Godot Web export + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Set up Godot + uses: chickensoft-games/setup-godot@v2 + with: + version: 4.7.0 + use-dotnet: false + include-templates: true + cache: true + + - name: Export Godot Web build + run: make godot-export + + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v4 + with: + path: dist + + deploy: + name: Deploy to GitHub Pages + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + concurrency: + group: github-pages + cancel-in-progress: false + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy GitHub Pages site + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index 0f51e9a..53f61d9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Human-vs-bots +[![Godot Web build](https://github.com/Bitcoindefi/Human-vs-bots/actions/workflows/godot-build.yml/badge.svg)](https://github.com/Bitcoindefi/Human-vs-bots/actions/workflows/godot-build.yml) + Turn-based strategy game with a Web3-ready flow on Stellar. ## What this project is @@ -95,6 +97,18 @@ The command detects `godot4` or `godot`, runs the `Web` export preset in headles mode, and writes the generated entry point to `dist/index.html`. The generated `dist/` directory is intentionally not tracked. +### Godot Web CI/CD + +The [Godot Web build workflow](.github/workflows/godot-build.yml) runs for every +pull request and every push to `main`. Its `build` job installs and caches Godot +4.7.0 plus the matching Web export templates, calls `make godot-export`, and +uploads `dist/` as the GitHub Pages artifact. + +For pushes to `main`, the `deploy` job publishes that artifact to the +`github-pages` environment with `actions/deploy-pages`. Pull requests build and +upload the artifact for validation but never deploy it. The repository's Pages +source must be set to **GitHub Actions** under **Settings → Pages**. + ## Third-party references and licenses - Unciv assets inspiration (visual assets used in demo pipeline) From 9f4225ca342f34becdf2e6bef61af4ea28228960 Mon Sep 17 00:00:00 2001 From: Vinay Date: Sun, 28 Jun 2026 22:41:30 +0530 Subject: [PATCH 3/4] Pin Godot workflow actions --- .github/workflows/godot-build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/godot-build.yml b/.github/workflows/godot-build.yml index 0993425..f0fc339 100644 --- a/.github/workflows/godot-build.yml +++ b/.github/workflows/godot-build.yml @@ -16,10 +16,10 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v6 + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 - name: Set up Godot - uses: chickensoft-games/setup-godot@v2 + uses: chickensoft-games/setup-godot@f166999204a4f2722c6fe042fbaa3b3ea0d9c789 with: version: 4.7.0 use-dotnet: false @@ -30,7 +30,7 @@ jobs: run: make godot-export - name: Upload GitHub Pages artifact - uses: actions/upload-pages-artifact@v4 + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b with: path: dist @@ -52,4 +52,4 @@ jobs: steps: - name: Deploy GitHub Pages site id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e From 06bf8b8d631afc461f8ee39a5437838c42c21136 Mon Sep 17 00:00:00 2001 From: Vinay Date: Sun, 28 Jun 2026 22:55:30 +0530 Subject: [PATCH 4/4] Scope workflow permissions to build job --- .github/workflows/godot-build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/godot-build.yml b/.github/workflows/godot-build.yml index f0fc339..dd031f2 100644 --- a/.github/workflows/godot-build.yml +++ b/.github/workflows/godot-build.yml @@ -6,11 +6,10 @@ on: - main pull_request: -permissions: - contents: read - jobs: build: + permissions: + contents: read name: Build Godot Web export runs-on: ubuntu-latest