/agent-sprite-forge:generate2dmapfrom Agent Sprite Forge
Plans and builds 2D game maps and scenes with collision, navigation, and export to Tiled, Godot 4, or LDtk. Generates map art via image APIs or local tools, and produces a playable HTML preview.
Ships in Agent Sprite Forge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Build the smallest scene bundle the request needs, in the game's art, camera, renderer and data conventions. A background picture needs no game system; a playable map needs explicit geometry and data beyond a painting.
Run python "<skill-dir>/../generate2dmedia/scripts/forge_doctor.py" --host-tools <tools> --save <output>/doctor.json, where <tools> lists the media tools in your own tool list (image_gen, image_edit, image_to_video) or none. Its ROUTES block shows which API keys are configured (yes or no), the local readiness and the resolved order. If encoding.stdout fails, set PYTHONUTF8=1.
Image generation is the default for map art: terrain and tile sheets, prop kits, HD-2D plates, painted backgrounds and parallax layers. Map data (layout, collision, exits, spawns) is data you write and validate, not art. Record each asset's art_source (api, host_image, existing, or code only on request) and name the route in your reply. A route the user names explicitly wins.
OPENAI_API_KEY), Google Gemini (GEMINI_API_KEY), xAI (XAI_API_KEY), BytePlus Seedream (ARK_API_KEY) or fal.ai (FAL_KEY), in the environment or the user config file (route-media.md). The configured key is the owner's consent, so there is no per-call question.image_gen, Grok's native tool) when you have one, otherwise the user's signed-in Codex CLI, then Antigravity CLI, then Grok CLI.route_media.py prints no-route (exit 3). Then say "code-drawn, no image model".Every image goes through one command: python "<skill-dir>/../generate2dmedia/scripts/route_media.py" image --prompt-file <txt> --reference <png> --size 1536x1024 --out-dir <new>; masked plate motion uses route_media.py video. Each prints one JSON line with route, artifact, sha256 and estimateUsd. Existing art the user supplies is always welcome. Never claim a generation that did not happen; keep the prompt and contract and report a missing capability.
image_gen is your own image tool; with no configured key use it and look at results with view_image. An image this session made that is not in the project: python "<skill-dir>/../generate2dmedia/scripts/cli_media.py" adopt --codex-thread <thread-id> --output-dir <new>. codeart2d and generate2dmedia are explicit-only: open their SKILL.md when this one routes there.route_media.py takes the API or the local CLIs. Look at every PNG you make with Read (debug overlays, previews); run tools with Bash; <skill-dir> is ${CLAUDE_SKILL_DIR}.Run each tool as one line from the user's project root: python "<skill-dir>/scripts/<tool>.py" .... <skill-dir> is this skill's folder; sibling skills sit beside it (<skill-dir>/../codeart2d). Keep inputs and outputs inside the project. Every tool writes a new --output-dir (or a new --output file): it refuses an existing one, stages beside it and publishes only after its checks (--strict-qc / --strict publish nothing on failure). Success prints one JSON line; errors print error: ... and exit 1 (nothing usable is published); usage errors exit 2; a result published for inspection with QA status fail exits 4. Needs Python 3.10+, numpy and Pillow (scipy recommended); ffmpeg 5.1+ for scene motion; node for the browser runtime. --help lists every flag. A host lists everything the skills made under a folder with python "<skill-dir>/scripts/forge_index.py" scan <dir> (one forge.asset_index.v1 JSON line: masters, sprite sets (each action's chosen and accepted take, and the package and review status of the chosen take only), FX, plates, maps; references/schemas/host.schema.json).
Record viewport and logical resolution, world extent, origin, camera and zoom, actor scale and footprint, routes, landmarks, interactions, exits and render order. Source pixels are not world units: measure returned sizes and declare uniform scale and anchors. Choose by behaviour (map-strategies.md; starting values per genre in map-presets.md):
scene_mode: authored area, town or arena; terrain plus props and explicit geometry.tile_mode / grid_mode: repeated or editable terrain or cell rules; tiles plus layer data.room_chunk_mode: connected rooms from a shared kit with door sockets.side_scroll_mode: side-view scenery or a playable platform stage with movement geometry.baked_scene_mode: a complete battle, title or story picture, with optional hotspots or bounded motion.Split objects only when interaction, depth, reuse, editing or motion needs it. Pixel art needs deliberate logical pixels and nearest scaling; HD-2D pairs pixel actors with painted plates and light.
Block out navigation, make art and kit, place it, validate the data, preview, then export. A playable map is a map_bundle.v2 (layered-map-contract.md).
| Need | Route |
|---|---|
| Props from a sheet | extract_prop_pack.py --input <sheet> --rows R --cols C --labels a,b --output-dir <new> (--grid-rounding nearest, --auto-boxes, --boxes-file <json> --keep-canvas, --world-scale 3/8, --suggest-footprint ellipse); place by anchor_px (prop-pack-contract.md) |
| Terrain fills, overlays, iso or hex, Wang rows | extract_terrain_tiles.py --strict-qc (--layer overlay, --shape iso-diamond, --wang NAME=A/B:MASKS; --edge-policy seamless only for art meant to tile) |
| Platform caps and middles | extract_platform_strip.py --strict-qc (side-scroll-scenes.md) |
| Code-drawn autotiles, only on request | codeart2d autotile_build.py (seam-proven tileset manifest), then the exporters |
| A code-drawn playable map, only on request | codeart2d layout_build.py (writes map_bundle.v2), then map_nav.py check and the exporters |
| Draw order, contact anchors, placement audit | compose_layered_preview.py --base <png> --placements <json> --output <png> --report <json>; with --bundle <map_bundle.json> --debug-overlay --audit-out <json> look at both |
| Validate a playable map | map_bundle.py validate --bundle <b> (map_bundle.py hash fills sha256), then map_nav.py check --bundle <b> --output-dir <new> (--link each neighbour); review nav-debug.png; map_nav.py query tests one spot or move |
| Walk the map, check every route | build_scene_preview.py --bundle <b> --output-dir <new> --verify; attach scene-snapshot.json (scene-preview.md) |
| Export | export_tiled.py export --bundle <b> --output-dir <new> (--embedded-variant for Phaser); export_godot.py --bundle <b> --output-dir <new>; export_ldtk.py --bundle <b> --output-dir <new> (engine-maps.md) |
| Room chunks; side-scroll grammar | validate_chunks.py --chunks <json> --output-dir <new>; validate_layout.py --layout <json> --output-dir <new> |
| Parallax | validate_parallax.py --spec <plan> --report <qa.json> (declare camera.pivot and the aspects you ship); code-drawn layers on request: codeart2d parallax_build.py (parallax-backgrounds.md) |
| Fit a painting to the game size or floor | conform_background.py conform --mode cover or --mode ground-fit; subjects on every screen aspect: conform_background.py validate-crops |
| Hi-bit pixel-art plate (with hibit sprites) | paint the background flat and lineless (never ask the model for "pixel art"), then hibit_plate.py plate --input <painting> --output-dir <new>: 480x270 (x4 = 1920x1080), 14 colours, majority downsample, lone-pixel cleanup, a 3x3 paper-cut pass, palette.json and shade-maps.json; --palette shares one palette across a game's plates. Draw it nearest at whole zoom |
| HD-2D plate | hd2d-plates.md: plan stage.json, scene_layout_guide.py, generate with guide.png attached, then validate_stage.py --stage <json> --output-dir <new>; look at every layout-*.png |
| Lights, shadows, atmosphere | hd2d-presentation.md: extract_scene_lights.py extract --stage <json>, curate lights.json |
| Night, lit or damaged variant of a plate | edit_locality_check.py --before <master> --after <variant> --stage <json> --edit-box <box>; regenerate on failure |
| Water, fire, mist or cloth on a still plate | background-scenes.md: build_motion_mask.py --envelope-from <clip>, scene_motion.py build, then scene_motion.py qa on the decoded file; code-drawn ripples or glow on request: codeart2d ambient_bake.py |
| Full-frame scene loop | generate2dsprite assemble_frames.py (--static-regions, --loop-overlap K --ambient) |
| Collision and paths in a web game | references/runtime/map-runtime.mjs (same rules as map_nav.py) |
map_bundle.py validate and map_nav.py check pass, and the build_scene_preview.py route check says ok: true for every route. map_nav proves reachability from data, not that collision matches the painted art.needs-visual-review. Quote scene_motion.py qa numbers (decoded seam, frames, fps, keyint, bytes) before calling a loop seamless.estimateUsd), runtime assets and data, the preview and the checks run, with remaining limits.map-strategies.md, map-presets.md, layered-map-contract.md, prop-pack-contract.md, side-scroll-scenes.md, parallax-backgrounds.md, background-scenes.md, hd2d-plates.md, hd2d-presentation.md, scene-preview.md, engine-maps.md; data contracts in references/schemas/map.schema.json.
agents/openai.yaml (opens in a new tab)references/background-scenes.md (opens in a new tab)references/engine-maps.md (opens in a new tab)references/hd2d-plates.md (opens in a new tab)references/hd2d-presentation.md (opens in a new tab)references/layered-map-contract.md (opens in a new tab)references/map-presets.md (opens in a new tab)references/map-strategies.md (opens in a new tab)references/parallax-backgrounds.md (opens in a new tab)references/prop-pack-contract.md (opens in a new tab)references/runtime/map-runtime.mjs (opens in a new tab)references/scene-preview.md (opens in a new tab)references/schemas/common.schema.json (opens in a new tab)references/schemas/host.schema.json (opens in a new tab)references/schemas/map.schema.json (opens in a new tab)references/side-scroll-scenes.md (opens in a new tab)scripts/build_motion_mask.py (opens in a new tab)scripts/build_scene_preview.py (opens in a new tab)scripts/compose_layered_preview.py (opens in a new tab)scripts/conform_background.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2d-maps, tilemaps, game-levels, parallax-backgrounds, map-export
5 skills in this plugin
/codeart2dExplicit-only last resort. Draws game art from code, with no image model - pixel sprites from a PixelSpec, flat vector props, UI and icons from portable SVG, rigged characters with planted feet, FX with a JS runtime, seam-proven autotiles, playable top-down layouts with collision, stylized parallax and ambient plate motion - palette-exact, with QA and review sheets. Use only when the user explicitly asks for code-drawn art, or when generate2dmedia route_media.py finds no image or video route (no-route, exit 3). Never the default - image generation (generate2dsprite, generate2dmap, video2dsprite) comes first for characters, props, maps and FX. Not for painterly, detailed or likeness art, HD-2D plates or realistic fire, smoke or water. Always disclose the result as code-drawn./generate2dmediaThe art-route layer of the Forge skills. route_media.py is the one command that generates an image or an image-to-video clip - through the paid API of any provider whose key is configured (OpenAI, Google Gemini, xAI, BytePlus ModelArk, fal.ai; the configured key is the owner's consent), else through the user's own signed-in Codex, Antigravity or Grok CLI - and prints one JSON line with the route, artifact, sha256 and cost estimate; with no route it answers no-route (codeart2d is then the last resort). Also the capability check (forge_doctor), API key configuration, the spend ledger, resume and Codex image adoption. Use when a Forge skill sends a generation here, for the capability check, or when the user asks about keys, routes or spend. Not for planning, processing or QA of sprites, video frames or maps (generate2dsprite, video2dsprite, generate2dmap) or for code-drawn art (codeart2d)./generate2dspriteMake game-ready 2D characters, creatures, props, icons and FX as master stills, sprite sheets or animation clips. Plan size, motion and finish; generate the art (image generation is the default, through generate2dmedia route_media.py - the API when a key is configured, else the local Codex, Antigravity or Grok CLI); approve one master still per character; then key, slice, register, scale, palette, QA and export frames for a game engine (Aseprite JSON, Godot SpriteFrames or Sprite3D). HD finish by default, pixel finish on request. Character animation is one image-to-video clip per action from the master (video2dsprite); sheets are for FX, icons and props. Use for sprites, masters, sheets, frame-by-frame animation and packaging frames from any source. Not for maps, tiles or backgrounds (generate2dmap), video clips (video2dsprite), code-drawn art (codeart2d, only on request) or calling an image or video API by itself (generate2dmedia)./video2dspriteTurn one approved master still into a character's whole animated sprite set - one image-to-video clip per action (idle, walk, run, attack, jump, hurt, cast and so on), all from that still, generated through generate2dmedia route_media.py (the xAI API when a key is configured, else the local Grok CLI) - then gate each take, key it with a soft matte, register it to the master, pick loops or retime actions, finish (HD by default, pixel on request) and package fixed-canvas frames, alpha WebM, packed MP4 for iPhone and a PNG fallback with engine metadata and a JS runtime. Also processes a supplied clip. Use for character and creature animation, fluid motion and any video-to-sprite work. Not for FX, icon or prop sheets (generate2dsprite), maps or plate loops (generate2dmap), code-drawn animation (codeart2d, only on request) or calling a video API by itself (generate2dmedia).npx claudepluginhub 0x0funky/agent-sprite-forge --plugin agent-sprite-forgeOther plugins' skills for the same job