Skip to content

Packs / game-assets-and-ai-public

sprite-atlas-packer

Pack many sprite PNGs into one texture atlas plus a JSON frame map that Phaser and PixiJS load directly (shelf packing, padding, power-of-two)

Install

logicpacks pack use game-assets-and-ai-public/sprite-atlas-packer
get_pack game-assets-and-ai-public/sprite-atlas-packer

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: local-pillow
  • Checks: 1 in outcome/checks.yaml
  • Code: make_frames.pypack_atlas.pyverify_atlas.py
  • Tools: python3, Pillow

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

One atlas image + JSON-hash data so a 2D game makes one texture bind for all its sprites.

Steps

  1. Put frames in a folder (walk_0.png, walk_1.png, ...).
  2. Run python3 code/pack_atlas.py frames/ out/atlas --pad 2 -> atlas.png + atlas.json (TexturePacker 'JSON hash' layout).
  3. Phaser: this.load.atlas('hero', 'atlas.png', 'atlas.json'); Pixi 8: Assets.load('atlas.json').
  4. Verify: python3 code/verify_atlas.py out/atlas.json (no overlaps, all inside, POT).

Edge cases

  • Max texture size on old phones is 2048 or 4096: split into several atlases above that.
  • Padding avoids bleeding with linear filtering; use 2 px.

Don'ts

  • Don't mix pixel-art (nearest) and smooth sprites in one atlas.
  • Don't rotate frames unless the loader supports it (this packer never rotates).