+7
-1
@@ -1,3 +1,9 @@
|
|||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
dist/
|
||||||
|
*.zip
|
||||||
|
.version
|
||||||
|
.DS_Store
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
steps:
|
||||||
|
- name: version
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache git make jq
|
||||||
|
- make ci-version
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: barichello/godot-ci:4.7.1
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get install -y --no-install-recommends make zip
|
||||||
|
- make ci-export
|
||||||
|
|
||||||
|
- name: artifact
|
||||||
|
image: alpine
|
||||||
|
environment:
|
||||||
|
DROPAREA_HOST: vps.teletype.hu
|
||||||
|
DROPAREA_PORT: 2223
|
||||||
|
DROPAREA_TARGET_PATH: /home/drop
|
||||||
|
DROPAREA_USER: drop
|
||||||
|
DROPAREA_SSH_PASSWORD:
|
||||||
|
from_secret: droparea_ssh_password
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache make openssh-client sshpass
|
||||||
|
- make ci-upload
|
||||||
|
|
||||||
|
- name: update
|
||||||
|
image: alpine
|
||||||
|
environment:
|
||||||
|
UPDATE_SERVER: https://teletypegames.org
|
||||||
|
UPDATE_SECRET:
|
||||||
|
from_secret: update_secret_key
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache make curl
|
||||||
|
- make ci-update
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# -----------------------------------------
|
||||||
|
# Makefile – Godot project builder
|
||||||
|
# -----------------------------------------
|
||||||
|
|
||||||
|
PROJECT = pong
|
||||||
|
|
||||||
|
GODOT ?= godot
|
||||||
|
EXPORT_PRESET = Web
|
||||||
|
|
||||||
|
DIST_DIR = dist
|
||||||
|
WEB_DIR = $(DIST_DIR)/web
|
||||||
|
OUTPUT_ZIP = $(PROJECT)-$(VERSION).html.zip
|
||||||
|
|
||||||
|
VERSION_FILE = .version
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
$(GODOT) --headless --import
|
||||||
|
|
||||||
|
run:
|
||||||
|
$(GODOT) --path .
|
||||||
|
|
||||||
|
web: build
|
||||||
|
@mkdir -p $(WEB_DIR)
|
||||||
|
@echo "==> Exporting web build ($(EXPORT_PRESET) preset)"
|
||||||
|
$(GODOT) --headless --export-release "$(EXPORT_PRESET)" $(WEB_DIR)/index.html
|
||||||
|
|
||||||
|
export: web
|
||||||
|
@if [ -z "$(VERSION)" ]; then \
|
||||||
|
echo "ERROR: VERSION not set!"; exit 1; \
|
||||||
|
fi
|
||||||
|
@echo "==> Packaging web build for $(VERSION)"
|
||||||
|
cd $(WEB_DIR) && zip -r ../../$(OUTPUT_ZIP) .
|
||||||
|
@echo "==> Cleaning temporary files"
|
||||||
|
rm -rf $(WEB_DIR)
|
||||||
|
|
||||||
|
watch:
|
||||||
|
fswatch -o . --include="\.gd$$" --include="\.tscn$$" | while read; do make build; done
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(DIST_DIR) .godot
|
||||||
|
|
||||||
|
ci-version:
|
||||||
|
@if [ -f metadata.json ]; then \
|
||||||
|
VERSION=$$(jq -r '.version' metadata.json); \
|
||||||
|
else \
|
||||||
|
VERSION=$$(git rev-parse --short HEAD); \
|
||||||
|
fi; \
|
||||||
|
BRANCH=$$(git rev-parse --abbrev-ref HEAD); \
|
||||||
|
if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ]; then \
|
||||||
|
VERSION="dev-$$VERSION-$$BRANCH"; \
|
||||||
|
fi; \
|
||||||
|
echo $$VERSION > $(VERSION_FILE)
|
||||||
|
|
||||||
|
ci-export:
|
||||||
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
|
$(MAKE) export VERSION=$$VERSION
|
||||||
|
|
||||||
|
ci-upload:
|
||||||
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
|
FILE="$(PROJECT)-$$VERSION.html.zip"; \
|
||||||
|
META_SRC="metadata.json"; \
|
||||||
|
META_DST="$(PROJECT)-$$VERSION.metadata.json"; \
|
||||||
|
cp $$META_SRC $$META_DST; \
|
||||||
|
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
|
||||||
|
$$FILE $$META_DST \
|
||||||
|
$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/
|
||||||
|
|
||||||
|
ci-update:
|
||||||
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
|
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=godot&version=$$VERSION"
|
||||||
|
|
||||||
|
.PHONY: all build run web export watch clean ci-version ci-export ci-upload ci-update
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Pong
|
||||||
|
|
||||||
|
The classic two-player Pong, made in [Godot](https://godotengine.org)
|
||||||
|
(4.x). First player to out-rally the other — every missed ball is a
|
||||||
|
point for the opponent.
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
| Action | Left player | Right player |
|
||||||
|
|--------|-------------|--------------|
|
||||||
|
| Paddle up | `Q` | `O` |
|
||||||
|
| Paddle down | `A` | `L` |
|
||||||
|
|
||||||
|
`Space` confirms in the menu, `Esc` quits the game.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
The project uses the [godot-tools](https://git.teletype.hu/tools/godot-tools)
|
||||||
|
templates: build logic lives in the `Makefile`, the web export
|
||||||
|
configuration in `export_presets.cfg` (the `Web` preset, threads
|
||||||
|
disabled).
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make run # run the game locally
|
||||||
|
make build # headless import (.godot cache, project check)
|
||||||
|
make web # export web build to dist/web/
|
||||||
|
make export VERSION=x # package dist/web/ into pong-x.html.zip
|
||||||
|
make clean # remove dist/ and the import cache
|
||||||
|
```
|
||||||
|
|
||||||
|
Requirements: `godot` (4.x editor binary) on PATH with the matching web
|
||||||
|
export templates installed, plus `make` and `zip`. `.vscode/tasks.json`
|
||||||
|
(copied from godot-tools, not tracked) provides the same targets as
|
||||||
|
VS Code tasks.
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
Woodpecker builds every push (`.woodpecker.yaml`): version → headless
|
||||||
|
web export (`barichello/godot-ci` image) → upload to the droparea →
|
||||||
|
`/update?platform=godot` on teletypegames.org. The version comes from
|
||||||
|
`metadata.json` (non-main branches get a `dev-` prefix). Keep the
|
||||||
|
`barichello/godot-ci` image tag in sync with the Godot version the
|
||||||
|
project is edited with.
|
||||||
|
|
||||||
|
Detailed documentation lives on the wiki: `/development/godot`.
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
; Copy to export_presets.cfg in the project root (or merge the preset
|
||||||
|
; into your existing file). The "Web" preset name is what the Makefile
|
||||||
|
; passes to `godot --headless --export-release`.
|
||||||
|
;
|
||||||
|
; `variant/thread_support=false` keeps the build runnable without
|
||||||
|
; COOP/COEP (cross-origin isolation) headers, which the game hosting
|
||||||
|
; does not send. Requires Godot 4.3+.
|
||||||
|
|
||||||
|
[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/web/index.html"
|
||||||
|
patches=PackedStringArray()
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
script_export_mode=2
|
||||||
|
|
||||||
|
[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=false
|
||||||
|
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
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "pong",
|
||||||
|
"title": "Pong",
|
||||||
|
"author": "Teletype Games",
|
||||||
|
"desc": "The classic two-player Pong, made in Godot.",
|
||||||
|
"site": "https://git.teletype.hu/games/pong",
|
||||||
|
"license": "MIT License",
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://bs08mkounx56i
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cdgeben1xfrxd
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c6vhexjie6miy
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://b38jok4r2frgs
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://c3n4g8iah6el5
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://gugjkqst8i8b
|
||||||
Reference in New Issue
Block a user