16 KiB
Map Pipeline: parameters, workflow, and scripts
Read this once the map_mode is chosen and you are about to produce assets.
Parameter Contract
User-facing parameters may be stated in natural language:
map_mode: tile_mode | scene_mode | side_scroll_mode | grid_mode | room_chunk_mode | baked_scene_modemap_kind: overworld | town | dungeon | shrine | arena | battle_bg | side_scroller | side_view_action | platformer | metroidvania | brawler | tower_defense | survivors_like | tactical | factory | card_board | room_chunkvisual_model: baked raster | layered raster | tilemap | layered tilemap | parallaxsize: pixel dimensions, tile dimensions, or camera-relative sizestage_canvas: exact pixel dimensions and aspect ratio for side-scroll/parallax layers, references, and previewsperspective: top-down | 3/4 top-down | side-view | isometric-likeart_style: clean_hd | pixel_inspired | retro_pixel | hand_painted | project-nativevisual_asset_source: imagine_text_to_image | existing_assets | procedural_placeholdercollision_precision: none | coarse | precise | tile | walkmeshprop_generation: none | one_by_one | prop_pack_2x2 | prop_pack_3x3 | prop_pack_4x4 | platform_strip_1x3 | platform_strip_1x4 | custom_wide_packoutput_format: PNG only | layered preview | manifest JSON | engine-native map data
When unspecified:
- Use
imagine_text_to_imageas the visual asset source. - Infer
map_modefrom genre and editing needs before selecting lower-level axes. - Use
tile_modefor Pokemon-like, top-down RPG, monster-taming, editor/grid-perfect, or tilemap requests. - Use
scene_modefor tower defense, survivors-like, cozy/top-down showcase maps, and base-map-plus-props requests. - Use
side_scroll_modefor side-scrollers, platformers, runners, side-view action, brawlers, Metroidvania side rooms, Mega Man-like, Castlevania-like, Contra-like, and parallax background requests. - For
side_scroll_mode, choose a canonicalstage_canvasbefore image generation. Use the project camera/viewport aspect when available; otherwise default to a 16:9 side-scroller canvas such as1536x864. All primary parallax plates, stage references, and previews must preserve this same size/aspect. - Use
grid_modefor tactical RPGs, factory/automation maps, board/card battlers, build grids, and terrain-cost maps. - Use
room_chunk_modefor modular rooms, roguelike rooms, procedural room assembly, or Metroidvania room-chunk planning. - Use
baked_scene_modeonly for non-playable visual scenes or explicitly flat images. - Use
baked_raster + coarse_shapesonly for battle backgrounds, title/menu scenes, cutscenes, decorative backdrops, non-playable previews, or when the user explicitly asks for a single flat image. - Use
layered_raster + y_sorted_props + precise_shapesfor top-down RPG exploration with tall props, occlusion, interactables, or reusable props; the base must be foundation-only and the props/interactables must remain separate. - Use
tilemaporlayered_tilemaponly when the engine/editor already uses tiles or the user asks for editable tiles; do not flatten gameplay objects into one background image. - Use
parallax_layers + platform_objects + interactive_scene_objects + scene_hooks + precise_shapesfor playable side-view scrolling stages, platformers, runners, shooters, and horizontal action scenes; the parallax/background image is scenery-only and is not the runtime map by itself. - Use square prop packs only when 4 or more compact small/medium static props share one style and fit comfortably inside equal square cells.
- Use one-by-one, platform strips, tile/object layers, or custom wide packs for hero props, buildings, gates, irregular large props, wide/tall props, platforms, terrain chunks, bridges, walls, ladders, long hazards, animated props, or props needing strong identity or collision alignment.
- Use
clean_hdfor generated exploration maps unless the project or user asks for pixel art. This means clean hand-painted top-down 2D RPG game map, HD game asset style, sharp readable terrain shapes, low texture noise, and no chunky pixels. - Use
pixel_inspiredonly when the user wants a pixel-adjacent look without retro chunkiness. - Use
retro_pixelonly when the user explicitly asks for 16-bit, retro JRPG, or classic pixel-art maps.
Workflow
-
Inspect the target game.
- Find camera size, map dimensions, coordinate system, render order, asset loading, collision support, zone data, and existing map formats.
- Preserve the engine's existing style and data contracts.
-
Choose the pipeline axes.
- Choose
map_modefirst. Use the genre routing table inmap-strategies.mdwhen the user describes a game type instead of a technical map format. - Select
visual_model,runtime_object_model,collision_model, andengine_target. - If the request is for a playable map, stage, level, room, prototype, or game scene, choose a pipeline with explicit runtime objects. Do not downgrade to
baked_rasterunless the user asked for a background-only image. - If the request implies a playable side-view scrolling/action stage, such as a side-scroller, platformer, runner, shooter, brawler, scrolling combat stage, Megaman-like stage, Castlevania-like stage, or Contra-like stage, lock the map pipeline to
parallax_layers + platform_objects + interactive_scene_objects + scene_hooks + precise_shapesunless the engine already requires a tilemap. - Select
art_style. Prefer readable gameplay shapes over decorative texture density. - Select
visual_asset_source. Default toimagine_text_to_image; useexisting_assetsonly when the project already has suitable art; useprocedural_placeholderonly when explicitly requested. - Treat
hybridas a result of combining axes, not as a primary category.
- Choose
-
Produce assets.
- Write the creative prompts manually and use built-in
imagine_text_to_imagefor visible map art unless the user explicitly chose existing assets or procedural placeholders. - For baked raster maps, generate one background with built-in
imagine_text_to_image, or edit/use an existing image when supplied, then add optional collision/zones metadata. - For playable or editable layered maps, generate a foundation-only base/background first. The base must not contain runtime-controlled props, interactables, hazards, doors, gates, pickups, actors, or foreground occluders. If it does, regenerate or demote it to a reference artifact.
- For layered raster maps, generate a ground-only/foundation-only base map first. Then perform the visual reference handoff and generate an in-world dressed reference mockup from the visible base before making final props and placements.
- For tilemaps, generate or reuse tileset art first, then follow the engine/editor format for layers, objects, collision, and scene files. Do not script-draw the tileset as the final art source, and do not flatten object layers into a single runtime image.
- For
grid_mode, generate or reuse grid/tileset visual art first, then write cell metadata such as walkable/buildable flags, move cost, terrain effects, resource nodes, and object layers. - For
room_chunk_mode, define chunk dimensions, exits, connection sockets, collision contract, and spawn/trigger metadata before final art assembly. Chunks must be reusable and validated at their seams. - For playable side-view scrolling/action stages, define the canonical
stage_canvasbefore generating art. Generate named scenery-only parallax layers first:sky,far_bg,mid_bg,near_bg, and optionalforeground_overlay. Every primary parallax layer must use the same pixel dimensions, aspect ratio, camera framing, horizon line, and top-left anchor as thestage_canvas; do not accept mismatched image sizes that require guesswork to stack. Do not treat one full-width background image as a completeside_scroll_modebackground stack unless the user explicitly asks for a flat/non-parallax background. These parallax passes must not contain playable foreground platforms, walkable floors, terrain chunks, hazards, pickups, doors, gates, checkpoints, crates, fences, spikes, or other runtime objects. Then perform the visual reference handoff and generate an in-world stage reference mockup that visually places up to 9 distinct intended platform/object candidates before generating final separate scene objects and metadata. - If a side-view background already contains collidable-looking foreground geometry, walkable floors, or reusable gameplay props, reject it as a runtime background and regenerate a cleaner scenery-only background before continuing.
- Treat the reference mockup as a checkpoint, not a deliverable. Do not stop after generating it. After the relevant
dressed-referenceorstage-referenceexists, inspect it and continue into the post-reference object production gate (object-production-gate.md). - Do not present a rerunnable script that creates the whole art pack as the main solution unless the user asked for procedural placeholder art.
- Write the creative prompts manually and use built-in
-
Build metadata.
- Store prop placement, player spawns, actor spawn marker metadata, interactable scene objects, blockers, walk bounds, encounter zones, exits, camera bounds, and triggers as structured data.
- For
grid_mode, store grid dimensions, cell size, tile ids, terrain types, walkable/buildable flags, movement cost, collision, resource nodes, and object/entity slots. - For
room_chunk_mode, store chunk id, size, entrances/exits, connection sockets, collision, spawn markers, camera bounds, and validation hints for seam alignment. - For
side_scroll_mode, storestage_canvas, parallax layer source size, display size, anchor, render order, scroll factors, loop/repeat policy, camera bounds, platform collision, hazards, exits, checkpoints, and actor spawn marker metadata. - Keep collision independent from pixels unless the target engine explicitly uses tile collision.
-
Validate and preview.
- Compose a flattened preview for layered maps.
- Validate image sizes, alpha channels, prop pack extraction metadata, JSON parseability, and critical walkability points when collision matters.
- For
side_scroll_mode, reject or normalize mismatched primary parallax layer sizes before runtime integration. The stage reference and QA preview must matchstage_canvasexactly. Deterministic resizing/cropping/padding is allowed only as a normalization step on generated art, not as a way to invent missing art.
Prop Generation Rules
Use $generate2dsprite for reusable transparent props and visible scene objects, but the agent must write the prop prompt itself using the selected map art_style. Do not use a script to generate the creative prompt. For clean_hd maps, explicitly request clean hand-painted HD 2D game assets and explicitly forbid pixel art. For pixel_inspired, request clean modern pixel-art-inspired props without retro chunkiness. For retro_pixel, request 16-bit or retro JRPG pixel art.
Before any prop/object image generation, classify each visible runtime object from the reference mockup:
compact_prop: small/medium, roughly square or vertical, decorative or simple blocker, no exact alignment requirementwide_or_long_object: expected aspect ratio wider than about1.6:1, such as platforms, floor pieces, bridges, wall runs, fence rows, long traps, long signs, pipes, rails, ledges, or roadstall_or_large_object: expected aspect ratio taller than about1.6:1or visually dominant, such as large trees, gates, towers, buildings, banners, doors, statues, or boss-room propscollision_bearing_object: must line up with collision, walkable edges, build pads, doors, checkpoints, gates, hazards, or engine editor handlestileset_or_strip_piece: should repeat seamlessly or assemble from left/middle/right caps, corners, slopes, tops, sides, or tile pieces
Generation strategy is determined by that classification:
- Only
compact_propobjects may use squareprop_pack_2x2,prop_pack_3x3, orprop_pack_4x4. - Do not put
wide_or_long_object,tall_or_large_object,collision_bearing_object, ortileset_or_strip_pieceinto square prop packs. - Use
one_by_onefor important, large, tall, irregular, identity-sensitive, or collision-aligned objects. - Use
platform_strip_1x3orplatform_strip_1x4for repeatable floors/platforms: left cap, middle repeat, right cap, plus optional corner/slope/end variant. - Use
custom_wide_packonly for several similar wide objects that share one category and can use wide cells such as768x256,1024x384, or another explicit non-square cell size. - Never mix compact decorative props with platforms, terrain chunks, gates, doors, hazards, or other collision-critical objects in the same generated sheet.
- If a square pack fails because a wide/tall object touches an edge, do not retry the same square pack with looser QC. Reclassify that object and regenerate it one-by-one, as a platform strip, as a custom wide pack, or as tile/object-layer art.
Choose the generation shape deliberately:
one_by_one: safest for large, important, animated, or irregular props.prop_pack_2x2: 4 related compact props, safest square batch size.prop_pack_3x3: 9 compact small/medium props, good quality/time tradeoff.prop_pack_4x4: 16 very simple compact small props; fastest but most likely to drift or touch edges.platform_strip_1x3: repeatable non-actor platform/floor strip with left cap, middle repeat, and right cap.platform_strip_1x4: repeatable non-actor platform/floor strip with left cap, middle repeat, right cap, and one extra slope/corner/end variant. This is not an animation-frame format and must not be used for characters, enemies, creatures, NPCs, summons, or animated body assets.custom_wide_pack: several related wide objects using explicit wide cells, not square cells.
Prop packs save image-generation calls and prompt overhead, but reduce per-prop control. Use square prop packs for rocks, shrubs, barrels, small signs, lamps, crates, floor ornaments, plants, and repeated compact environmental props. Do not use square prop packs for buildings, gates, trees with wide canopies, bridges, platforms, floors, walls, ladders, long fences, long hazards, character-like statues, hero objects, or anything that must be pixel-perfect or collision-aligned.
For layered maps with generated props, prefer this in-world reference mockup pipeline:
- Generate
assets/map/<name>-base.pngas ground-only terrain. - Hand the base to
imagine_image_to_imageas a real reference: pass its sandboxfile_path. Alsoread_fileit so you can see it; do not rely on a path string or prompt text as the reference. - In the dressed-reference prompt, explicitly say: use the provided base image as the visual reference, preserve its camera/framing/dimensions/terrain/road/water/boundaries, and generate an in-world dressed reference mockup.
- The dressed reference must show proposed props as natural game-world objects placed on the base. It must not contain circles, arrows, outlines, labels, text, callouts, legends, highlighted boxes, or other annotation graphics.
- The dressed reference should contain at most 9 distinct visible prop/object candidates unless the user explicitly asks for more. Prefer the objects that will become final generated props, collision blockers, interactables, or occluders.
- Generate
assets/map/<name>-dressed-reference.pngfrom the visible base. Treat this as a reference mockup, not the final runtime map. - Generate one-by-one props or a prop pack based on the dressed reference.
- Place extracted props over the original base and compose a flattened preview.
- Validate that base, dressed reference, and preview dimensions match.
Scripts
Use the extract script after generating a solid-magenta prop sheet (built-in magenta cleanup is enough for most sheets):
python3 .grok/skills/generate2dmap/scripts/extract_prop_pack.py \
--input assets/props/raw/<name>-sheet.png \
--rows 3 --cols 3 \
--labels <comma-separated-labels> \
--output-dir assets/props \
--manifest assets/props/<name>-prop-pack.json \
--component-mode largest
Compose a QA preview:
python3 .grok/skills/generate2dmap/scripts/compose_layered_preview.py \
--base assets/map/<name>-base.png \
--placements data/<name>-props.json \
--output assets/map/<name>-layered-preview.png