TITLE=Ebitengine ROUTE=/platforms/ebitengine LOCALE=en MODIFIED=1792476547 URL=https://wiki.teletypegames.org/platforms/ebitengine Ebitengine (formerly Ebiten) is a fast and portable 2D game engine for Go. bWebsite:0 https://ebitengine.org bProjects built with this engine:0 Rabbit Roller r────────────────────────────────────────────────────────────────────────────── 1Makefile 1════════ Go compiles to a native binary or to WebAssembly. The web build needs three files: cgame.wasm0, cwasm_exec.js0 and cindex.html0. 2Variables 2───────── t┌────────────────┬───────────────────────────────┬───────────────────────┐ t│h Variable t│h Description t│h Default t│ t├────────────────┼───────────────────────────────┼───────────────────────┤ t│0 cPROJECT0 t│0 Name used in output filenames t│0 cebitenginedemo0 t│ t│0 cBIN_DIR0 t│0 Native executable t│0 cbin0 t│ t│0 cDIST_DIR0 t│0 WASM and packaged artifacts t│0 cdist0 t│ t│0 cWASM_NAME0 t│0 WebAssembly filename t│0 cgame.wasm0 t│ t│0 cVERSION_FILE0 t│0 Version file for CI t│0 c.version0 t│ t│0 cINDEX_HTML_URL0 t│0 index.html template t│0 ebitengine-tools repo t│ t└────────────────┴───────────────────────────────┴───────────────────────┘ 2Targets 2─────── p make build # go build -> bin/ for the current OS p make wasm # dist/game.wasm + wasm_exec.js p make export VERSION=1.0.0 # wasm + index.html zipped as ebitenginedemo-1» p .0.0.html.zip p make watch # rebuild the native binary on change in . (nee» p ds fswatch) p make clean # remove bin/ and dist/ 2VS Code 2─────── Copy cexample-tasks.json0 to c.vscode/tasks.json0 and replace cebitenginedemo0 with your cPROJECT0. Tasks: bRun0 (default, cCmd+Shift+B0), bBuild & Run0, bBuild WASM0, bMake bbuild0. 2Generated artifacts 2─────────────────── t┌───────────────────────────────────┬────────────────────────────────────────┐ t│h File t│h Description t│ t├───────────────────────────────────┼────────────────────────────────────────┤ t│0 cbin/ebitenginedemo0 t│0 Native executable, current OS t│ t├───────────────────────────────────┼────────────────────────────────────────┤ t│0 cdist/game.wasm0 t│0 WebAssembly binary t│ t├───────────────────────────────────┼────────────────────────────────────────┤ t│0 cdist/wasm_exec.js0 t│0 Go WASM runtime helper t│ t├───────────────────────────────────┼────────────────────────────────────────┤ t│0 cebitenginedemo-.html.zip0 t│0 Web build (index.html + WASM + t│ t│0 t│0 runtime) t│ t└───────────────────────────────────┴────────────────────────────────────────┘ 2Requirements 2──────────── Local only: cmake0, cgo0 1.11+, ccurl0, czip0, and cfswatch0 for watch mode. CI images bring their own tools. r────────────────────────────────────────────────────────────────────────────── 1Pipeline 1════════ The pipeline is not in the game repo. Woodpecker asks the update server, and WarpEngine serves the whole config from c/build/config0 (template clib/warp_engine/ci/woodpecker/platforms/ebitengine/pipeline.yaml.erb0). The repo needs three things: p # .woodpecker.yaml p platform: ebitengine • cmetadata.json • the capplication_token0 Woodpecker secret: a WarpEngine ApplicationToken with cupdate0 + cupload0 scopes • cname: 0 in the marker only when the software name differs from the repo name Builder images come from the update server's cci_platforms0 config. On teletypegames.org the builder is cebitengine-ttg0: the cebitengine-builder0 image with the Go modules of every TTG Go project preloaded, so the build, binaries and test steps no longer download them (a new dependency is still downloaded as usual). The helper steps (version, upload, publish) run in the cci-tools image, which has git, jq, curl and zip preinstalled, so they install nothing. Preview the served pipeline: p curl "https://teletypegames.org/build/config?platform=ebitengine" 2Steps 2───── t┌─────────────┬──────────────────────────────────────────────────────────────┐ t│h Step t│h What it does t│ t├─────────────┼──────────────────────────────────────────────────────────────┤ t│0 1. version t│0 read the version from cmetadata.json0, else the git short t│ t│0 t│0 hash; outside cmain0/cmaster0 prefix it as t│ t│0 t│0 cdev--0 t│ t├─────────────┼──────────────────────────────────────────────────────────────┤ t│0 2. build t│0 cGOOS=js GOARCH=wasm0, add cwasm_exec.js0 and cindex.html0, zip t│ t│0 t│0 them t│ t├─────────────┼──────────────────────────────────────────────────────────────┤ t│0 3. binaries t│0 cross-compile cwin-x860, cwin-x640, clinux-x640, one versioned zip t│ t│0 t│0 each t│ t├─────────────┼──────────────────────────────────────────────────────────────┤ t│0 4. artifact t│0 copy cmetadata.json0 to its versioned name, then cPOST0 t│ t│0 t│0 c/build/upload0 with the cX-Update-Secret0 header t│ t├─────────────┼──────────────────────────────────────────────────────────────┤ t│0 5. publish t│0 cPOST /build/publish?platform=ebitengine0 t│ t└─────────────┴──────────────────────────────────────────────────────────────┘ 2Result 2────── A versioned web build plus Windows and Linux binaries, uploaded and published. The public game index updates itself.