EN /HU | Login

Phaser

Phaser is an open source HTML5 framework for 2D games, written in JavaScript/TypeScript. WebGL and Canvas rendering, arcade and matter.js physics, tweens, particles, many plugins. A Phaser game is a plain web page — nothing to compile — so its pipeline is the simplest of all our engines.

Website: https://phaser.io

Tutorials


Makefile

No bundler, no node_modules. The pinned phaser.min.js and the HTML shell are downloaded at build time, and src/*.js is concatenated in filename order into game.js — prefix files with numbers when load order matters. The repo holds game code only.

Templates are in phaser-tools: copy example-makefile.make to Makefile, set PROJECT and PHASER_VERSION.

Variables

Variable Description Default
PROJECT Name used in output filenames phaserdemo
PHASER_VERSION Phaser release from jsDelivr 3.90.0
SRC_DIR Game sources src
DIST_DIR Exported artifacts dist
WEB_DIR Assembled web bundle dist/web
VERSION_FILE Version file for CI .version
INDEX_HTML_URL HTML shell phaser-tools web/index.html

Targets

SH
make build                   # node --check on every file in src/
make web                     # download phaser.min.js + index.html, concat src/*.js
make serve                   # web bundle on http://localhost:8000 (python3 http.server)
make export VERSION=1.0.0     # dist/web/ zipped as phaserdemo-1.0.0.html.zip
make watch                   # re-check on change under src/ (needs fswatch)
make clean                   # remove dist/

VS Code

Copy example-tasks.json to .vscode/tasks.json. Tasks: Serve (default, Cmd+Shift+B), Build Web, Make build.

Generated artifacts

File Description
dist/web/ Web bundle (index.html, phaser.min.js, game.js)
phaserdemo-<version>.html.zip Web build

Requirements

Local only: make, git, jq, zip, curl, node, python3 for make serve, and fswatch for watch mode. CI images bring their own tools.


Pipeline

The pipeline is not in the game repo. Woodpecker asks the update server, and WarpEngine serves the whole config from /build/config (template lib/warp_engine/ci_templates/phaser.yaml.erb).

The repo needs three things:

YAML
# .woodpecker.yaml
platform: phaser
name: phaserdemo   # only when the software name differs from the repo name
  • metadata.json
  • the application_token Woodpecker secret: a WarpEngine ApplicationToken with update + upload scopes

Builder images come from the update server's ci_platforms config. Preview the served pipeline:

SH
curl "https://teletypegames.org/build/config?platform=phaser"

Steps

Step What it does
1. version on alpine: version from metadata.json, else git
2. build in the phaser-builder image (Node + make/zip/curl, from builder.Dockerfile in phaser-tools): syntax check, download the runtime and shell, assemble and zip
3. upload POST /build/upload, X-Update-Secret header
4. publish POST /build/publish?platform=phaser

Demo project

phaser-demo — animated "TELETYPE GAMES" wave text on Phaser 3.90, the same demo as ebitengine-demo.