Something went wrong. Try again.
an npmx inspired game for PICO-8 npicomx.vinnymac.dev
games pico-8 adventure npmx
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114# npicomx - dev tasks. Source lives in src/ (src/*.lua modules + src/cart.p8, which# #includes them and holds the gfx/map/sfx data). `make` builds the shippable cart to# ./npicomx.p8 (minified, debug-stripped, self-contained). Override vars on the CLI,# e.g. `make web PICO8=/usr/bin/pico8` or `make serve PORT=9000`.
# --- config ------------------------------------------------------------------PICO8 ?= $(HOME)/.local/pico-8/pico8P8HOME ?= /tmp/p8home-npicomxSHRINKO8 ?= python3 tools/shrinko8/shrinko8.pyMINIFY ?= --minify -ot # -ot/--focus-tokens: merges successive assigns etc. (~113 tok)CART ?= src/cart.p8 # source cart (#includes src/*.lua + data sections)OUT ?= npicomx.p8 # built, shippable cart (this is a BUILD OUTPUT)EXPORT ?= npicomx.jsHTML ?= npicomx.htmlPORT ?= 8128HEADLESS_ENV = SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy
.DEFAULT_GOAL := build
# --- build -------------------------------------------------------------------# shrinko8 expands the #includes in src/cart.p8, minifies, const-folds away the debug# tour (`--const dbg false`), and writes the single self-contained cart to ./npicomx.p8..PHONY: buildbuild: ## Build src/cart.p8 -> npicomx.p8 (minified, debug-stripped, self-contained) $(SHRINKO8) $(CART) $(OUT) $(MINIFY) --const dbg false @echo "built $(OUT)"
# --- code checks (shrinko8) --------------------------------------------------# Lint/count read the SOURCE; count minifies first so the budget is the one that ships..PHONY: lintlint: ## Lint the cart source (implicit game-state globals + the `t` math-param convention are by design; the unused-var lint still runs) $(SHRINKO8) $(CART) --lint --no-lint-undefined --no-lint-duplicate-global
.PHONY: countcount: ## Token / char / compressed budgets of the shipped (minified) cart @mkdir -p build $(SHRINKO8) $(CART) build/count.p8 $(MINIFY) --const dbg false --count
.PHONY: validatevalidate: lint count ## Lint source + budget-check the minified cart (the gate)
# --- .p8.png export (BBS / Splore) -------------------------------------------.PHONY: pngpng: build ## Build npicomx.p8.png (for Splore / BBS); needs Pillow $(SHRINKO8) $(OUT) npicomx.p8.png -f png --title "npmx inspired game for PICO-8" --title "made by vinnymac ♥"
.PHONY: web-iconsweb-icons: ## Regenerate favicons, app icons + Open Graph card from the ./ npicomx wordmark; needs Pillow python3 tools/gen_web_icons.py
.PHONY: gen-labelgen-label: ## Regenerate the 128x128 cart label ("./ npicomx" wordmark) in src/cart.p8; needs Pillow python3 tools/gen_label.py
# --- web export --------------------------------------------------------------# Drive headless PICO-8 to export the JS runtime from the built cart. `-export` writes# npicomx.html + npicomx.js; we use only npicomx.js - the custom index.html loads it..PHONY: webweb: build ## Export the JS web runtime -> npicomx.js (loaded by index.html) @mkdir -p $(P8HOME) $(HEADLESS_ENV) $(PICO8) -home $(P8HOME) $(OUT) -export "$(HTML)" @echo "built $(EXPORT) - open index.html (via make serve)"
# --- preview -----------------------------------------------------------------.PHONY: serveserve: ## Dev server to preview index.html (LAN=1 to expose; HOST= / PORT= to change; needs `make web` first) PORT=$(PORT) node serve.js $(if $(LAN),--lan,) $(if $(HOST),--host=$(HOST),)
# --- screenshot (headless verification) --------------------------------------# Runs the built cart under a dummy SDL driver. PICO-8 only writes a screenshot when the# cart calls extcmd("screenshot") (gated behind the dbg flag - only the smoke build)..PHONY: screenshotscreenshot: build ## Run the built cart headlessly so an extcmd("screenshot") call can capture a PNG @mkdir -p $(P8HOME) -$(HEADLESS_ENV) $(PICO8) -home $(P8HOME) $(OUT) @echo "if the cart called extcmd(\"screenshot\"), look in $(P8HOME)/screenshots"
# --- deploy ------------------------------------------------------------------DIST ?= dist
.PHONY: distdist: web ## Assemble web-only files into dist/ for Cloudflare Pages deploy rm -rf $(DIST) mkdir -p $(DIST) cp index.html sw.js manifest.webmanifest crt.js npicomx.js og.png $(DIST)/ cp -r favicons fonts vendor $(DIST)/ @[ -f _headers ] && cp _headers $(DIST)/ || true
.PHONY: deploydeploy: dist ## Build + deploy to Cloudflare Pages (requires wrangler auth) npx wrangler pages deploy $(DIST) --project-name npicomx --commit-dirty=true
.PHONY: ci-distci-dist: ## Assemble dist/ from committed artifacts (no pico8/python3 required) rm -rf $(DIST) mkdir -p $(DIST) cp index.html sw.js manifest.webmanifest crt.js npicomx.js og.png $(DIST)/ cp -r favicons fonts vendor $(DIST)/ @[ -f _headers ] && cp _headers $(DIST)/ || true
.PHONY: ci-deployci-deploy: ci-dist ## Deploy committed artifacts to Cloudflare Pages (CI-safe, no pico8 needed) CLOUDFLARE_ACCOUNT_ID=ebbd354a5e5728e183b95c92fbcfb770 npx wrangler pages deploy $(DIST) --project-name npicomx --branch=main --commit-dirty=true
# --- help / housekeeping -----------------------------------------------------.PHONY: helphelp: ## Show this help @grep -E '^[a-zA-Z0-9_-]+:.*?## ' $(MAKEFILE_LIST) \ | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-14s\033[0m %s\n",$$1,$$2}'
.PHONY: cleanclean: ## Remove generated exports (js/html/.p8.png) + build/ intermediates (keeps npicomx.p8) rm -rf build npicomx.js npicomx.html npicomx.p8.png