Quest 03 / 04 · Quick buildTier 01 · Daily

Bounty boards / Daily · Monday, November 23, 2026

Build an eight-direction combat sandbox

  • SpriteRelay / Aseprite / Codex
  • Time2 hours
  • Stages5
  • BoardMonday, November 23, 2026

Overview

You finish with a browser room where the Heron Ronin walks in eight directions and damages a practice target only on frames five and six of his sword attack. Codex reads the layered Aseprite source through SpriteRelay first, so the names and timings in your config come from the file instead of guesses.

  • SpriteRelay registered in Codex, with aseprite_doctor reporting a working Aseprite install.
  • An inspection note listing the Heron Ronin tags with their frame durations, and where each direction keeps its hitbox.
  • A top-down room in index.html with movement, a sword attack, a target with hit points and a debug hitbox overlay on the H key.
  • A checked table showing the sword in the same hand in all eight attacks, plus console lines proving damage lands only on frames 5 and 6.
01SETUP25 minutesInstall SpriteRelay...02DATA25 minutesExtract and inspect...03BUILD15 minutesMap directions to ta...04BUILD30 minutesBuild the room, the...05TEST25 minutesCheck hands, hitboxe...
DATAHeron Ronin packTOOLCodexTOOLSpriteRelay CLITOOLAseprite in batchmodeSTOREcombat.jsonCODEgame.js canvas roomTESTDebug overlay and hitlogsprite_inspectstaged copyreads sourcetag and hitbox namessheet PNG and JSONframes 5 and 6
Codex reads the source through SpriteRelay; the game reads the exported sheet.

Tool

SpriteRelay / Aseprite / Codex

Use the free Heron Ronin pack and credit SpriteRelay under CC BY 4.0; Aseprite and the MCP setup are required for the editing step.

Announcement

SpriteRelay's new Heron Ronin example includes eight individually drawn attack directions, layered source art, and animation data.

Official announcement · 2026-11-22

Before you begin

Aseprite 1.3.18.1 or newer (paid)

SpriteRelay does not include Aseprite. The CLI baseline is Aseprite 1.3.18.1 with Lua API 40.

SpriteRelay CLI (paid, one-time)

The setup uses the spriterelay-cli-2.0.0.tgz file from your purchase. There is no public npm package, so do not install a similar name from the registry.

Node.js 18 or newer, free

Check the version with node --version. SpriteRelay runs as a local stdio MCP server on Node.

Codex with a sign-in

The Codex CLI, IDE extension or ChatGPT desktop app, signed in with a ChatGPT account or an API key.

Python 3 and a desktop browser, free

Python serves the game folder with python -m http.server; any current browser runs the canvas game.

Basic JavaScript reading skills

You will edit one JSON config and read three short JavaScript blocks.

Stage 01 · setup25 minutes

Install SpriteRelay and connect Codex

Register the SpriteRelay CLI as an MCP server in Codex and confirm it can drive Aseprite.

Install the CLI from the tarball you downloaded after purchase, then find the two absolute paths Codex needs. Desktop apps may not inherit your shell PATH, which is why the setup guide asks for absolute paths.

bash
# macOS or Linux
npm install -g "/absolute/path/to/spriterelay-cli-2.0.0.tgz"
npm root -g
command -v node
powershell
# Windows
npm install -g "$HOME\Downloads\spriterelay-cli-2.0.0.tgz"
npm root -g
(Get-Command node).Source

The server entry point is the npm root followed by spriterelay-cli/dist/index.js. Register it with Codex, and pass your Aseprite path with --env so the server does not have to search for it.

bash
codex mcp add spriterelay --env ASEPRITE_PATH=/absolute/path/to/aseprite -- /absolute/path/to/node /absolute/path/to/npm-root/spriterelay-cli/dist/index.js
codex mcp list

Start Codex in an empty project folder named combat-sandbox, type /mcp to see the active servers, and ask for a quick health check. The setup guide expects exactly six tools.

textPrompt to type into Codex.
Run spriterelay's aseprite_doctor with level quick and report discovery, versions and unsupported capabilities.
Stage 01 Checkpoint

/mcp lists spriterelay with the tools aseprite_doctor, sprite_inspect, sprite_patch, sprite_export, sprite_preview and file_commit. The doctor reports your Aseprite version and no blocking errors.

Stage 02 · data25 minutes

Extract and inspect the Heron Ronin

Learn the real tag names, frame timings and hitbox data before writing any game code.

Download SpriteRelay-Heron-Ronin.zip from the SpriteRelay devlog on itch.io and extract it into combat-sandbox/assets/heron-ronin/. The pack holds a layered 64 by 64 Aseprite source, 304 frames, a sprite sheet with JSON and GIFs of every move.

Ask Codex to read the source without changing it. The SpriteRelay CLI works on a staged copy, and only file_commit writes to your project. An inspection therefore cannot damage the pack.

textPrompt to type into Codex.
Use spriterelay sprite_inspect on the .aseprite file in assets/heron-ronin. List every layer, every tag with its frame range and per-frame durations, and every slice or user data that marks a hitbox. Tell me which tags are the idle, walk and attack for each of the eight directions. Do not patch or commit anything. Save your answer to notes/inspection.md.

Cross-check the exported JSON with a short script. Aseprite writes tags under meta.frameTags and slices under meta.slices, and this prints both with the frame durations.

pythoninspect_sheet.py
"""Print the tags, slices and frame fields in an Aseprite sheet JSON."""
import json
import sys
from pathlib import Path

data = json.loads(Path(sys.argv[1]).read_text(encoding="utf-8"))
frames = data["frames"]
frames = frames if isinstance(frames, list) else list(frames.values())
meta = data.get("meta", {})
print(f"frames: {len(frames)}  first frame fields: {sorted(frames[0])}")
print(f"image: {meta.get('image')}  size: {meta.get('size')}")
for tag in meta.get("frameTags", []):
    count = tag["to"] - tag["from"] + 1
    times = [frames[i].get("duration") for i in range(tag["from"], tag["to"] + 1)]
    print(f"tag {tag['name']!r}: frames {tag['from']}-{tag['to']} ({count}) durations {times}")
for item in meta.get("slices", []):
    keys = [(key["frame"], key["bounds"]) for key in item.get("keys", [])]
    print(f"slice {item['name']!r}: {len(keys)} keys, first {keys[:1]}")
if not meta.get("slices"):
    print("no slices in this JSON; see the inspection notes for where hitboxes live")
bash
python inspect_sheet.py assets/heron-ronin/YOUR_SHEET.json
Output
frames: 304  first frame fields: ['duration', 'frame', ...]
image: <sheet file name>  size: <sheet size>
tag '<tag name>': frames <from>-<to> (<count>) durations [...]
...
slice '<slice name>': <n> keys, first [...]
Stage 02 Checkpoint

notes/inspection.md names an attack tag for each of the eight directions, each attack has ten frames, and you know whether hitboxes are slices or need a hand-drawn rectangle.

Stage 03 · build15 minutes

Map directions to tags and hitboxes

Write combat.json so the game knows which tag and hitbox belong to each direction.

Copy the tag names from your inspection note into the config below, replacing every FILL_ME. Each hitbox is either {"slice": "NAME"} for a slice in the JSON or {"rect": [x, y, w, h]} in frame pixels.

jsoncombat.json
{
  "data": "assets/heron-ronin/FILL_ME.json",
  "scale": 3,
  "speed": 140,
  "damageFrames": [5, 6],
  "directions": {
    "e":  {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [40, 16, 22, 28]}},
    "se": {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [36, 30, 24, 24]}},
    "s":  {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [18, 40, 28, 22]}},
    "sw": {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [4, 30, 24, 24]}},
    "w":  {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [2, 16, 22, 28]}},
    "nw": {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [4, 4, 24, 24]}},
    "n":  {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [18, 0, 28, 22]}},
    "ne": {"idle": "FILL_ME", "walk": "FILL_ME", "attack": "FILL_ME", "hitbox": {"rect": [36, 4, 24, 24]}}
  }
}

Keep every direction mapped to its own tag. Mirroring the east attack to make west would move the sword to the other hand, which is the exact failure the bounty checks for.

Stage 03 Checkpoint

combat.json has no FILL_ME left, and data points at the sheet JSON inside assets/heron-ronin/.

Stage 04 · build30 minutes

Build the room, the attack and the target

Write the canvas game, with eight-way movement and an attack that deals damage on frames 5 and 6.

htmlindex.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Heron Ronin combat sandbox</title>
  <style>
    body { margin: 0; background: #1b1d24; color: #ddd; font: 14px monospace; }
    canvas { display: block; margin: 12px auto; background: #3a4a3a; image-rendering: pixelated; }
    p { text-align: center; }
  </style>
</head>
<body>
  <canvas id="room" width="768" height="512"></canvas>
  <p>WASD or arrows: move. J or Space: attack. H: hitboxes.</p>
  <p>Heron Ronin art by SpriteRelay (spriterelay.com), CC BY 4.0.</p>
  <script src="game.js"></script>
</body>
</html>

The first block loads the config and the sheet, then stops with a readable error if any tag or slice name is wrong. That error lists the tags the sheet really contains, so a typo is quick to fix.

javascriptgame.js
// Heron Ronin combat sandbox: load the sheet and check combat.json.
const DIRS = ["e", "se", "s", "sw", "w", "nw", "n", "ne"];
const canvas = document.getElementById("room");
const ctx = canvas.getContext("2d");
ctx.imageSmoothingEnabled = false;

async function loadAll() {
  const config = await (await fetch("combat.json")).json();
  const data = await (await fetch(config.data)).json();
  const frames = Array.isArray(data.frames) ? data.frames : Object.values(data.frames);
  const tags = Object.fromEntries((data.meta.frameTags || []).map(t => [t.name, t]));
  const slices = Object.fromEntries((data.meta.slices || []).map(s => [s.name, s]));
  const missing = [];
  for (const dir of DIRS) {
    for (const kind of ["idle", "walk", "attack"]) {
      const name = config.directions[dir][kind];
      if (!tags[name]) missing.push(`${dir}.${kind} = ${name}`);
    }
    const slice = config.directions[dir].hitbox.slice;
    if (slice && !slices[slice]) missing.push(`${dir}.hitbox slice = ${slice}`);
  }
  if (missing.length) {
    throw new Error("Unknown names in combat.json: " + missing.join(", ") +
      ". Tags in the sheet: " + Object.keys(tags).join(", "));
  }
  const image = new Image();
  image.src = new URL(data.meta.image, new URL(config.data, location.href)).href;
  await image.decode();
  return { config, frames, tags, slices, image };
}

function hitboxFor(game, dir, frameIndex) {
  const spec = game.config.directions[dir].hitbox;
  if (spec.rect) return spec.rect;
  const keys = game.slices[spec.slice].keys.filter(k => k.frame <= frameIndex);
  const key = keys.length ? keys[keys.length - 1] : null;
  return key ? [key.bounds.x, key.bounds.y, key.bounds.w, key.bounds.h] : null;
}

The second block turns key presses into one of eight facings and plays each tag with the per-frame durations from Aseprite. During an attack it checks for a hit only when the frame number is in damageFrames, and only once per swing.

javascriptgame.jsAppend this to the same file.
// Movement, the attack and the practice target.
const keys = new Set();
let debug = false;
addEventListener("keydown", e => { keys.add(e.code); if (e.code === "KeyH") debug = !debug; });
addEventListener("keyup", e => keys.delete(e.code));
const player = { x: 260, y: 256, dir: "s", anim: "idle", frame: 0, clock: 0, hitThisSwing: false };
const target = { x: 520, y: 220, w: 60, h: 80, hp: 10, flash: 0 };

function tagFor(game) { return game.tags[game.config.directions[player.dir][player.anim]]; }

function setAnim(anim) {
  if (player.anim === anim) return;
  player.anim = anim; player.frame = 0; player.clock = 0; player.hitThisSwing = false;
}

function update(game, dt) {
  if (player.anim !== "attack" && (keys.has("KeyJ") || keys.has("Space"))) setAnim("attack");
  if (player.anim !== "attack") {
    const dx = (keys.has("KeyD") || keys.has("ArrowRight")) - (keys.has("KeyA") || keys.has("ArrowLeft"));
    const dy = (keys.has("KeyS") || keys.has("ArrowDown")) - (keys.has("KeyW") || keys.has("ArrowUp"));
    if (dx || dy) {
      const step = Math.round(Math.atan2(dy, dx) / (Math.PI / 4));
      player.dir = DIRS[(step + 8) % 8];
      const len = Math.hypot(dx, dy);
      player.x += (dx / len) * game.config.speed * dt;
      player.y += (dy / len) * game.config.speed * dt;
      setAnim("walk");
    } else setAnim("idle");
  }
  const tag = tagFor(game);
  player.clock += dt * 1000;
  while (player.clock >= game.frames[tag.from + player.frame].duration) {
    player.clock -= game.frames[tag.from + player.frame].duration;
    player.frame += 1;
    if (tag.from + player.frame > tag.to) {
      player.frame = 0;
      if (player.anim === "attack") { setAnim("idle"); return; }
    }
  }
  if (player.anim === "attack") checkHit(game);
  target.flash = Math.max(0, target.flash - dt);
}

function worldHitbox(game) {
  const tag = tagFor(game);
  const box = hitboxFor(game, player.dir, tag.from + player.frame);
  if (!box) return null;
  const s = game.config.scale, size = game.frames[tag.from].sourceSize || { w: 64, h: 64 };
  const left = player.x - (size.w * s) / 2, top = player.y - (size.h * s) / 2;
  return { x: left + box[0] * s, y: top + box[1] * s, w: box[2] * s, h: box[3] * s };
}

function checkHit(game) {
  const frameNumber = player.frame + 1;
  if (!game.config.damageFrames.includes(frameNumber) || player.hitThisSwing) return;
  const b = worldHitbox(game);
  if (b && b.x < target.x + target.w && b.x + b.w > target.x && b.y < target.y + target.h && b.y + b.h > target.y) {
    target.hp -= 1; target.flash = 0.15; player.hitThisSwing = true;
    console.log(`hit: ${player.dir} attack frame ${frameNumber}, target hp ${target.hp}`);
  }
}
javascriptgame.jsAppend this to the same file.
// Drawing and the main loop.
function draw(game) {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.fillStyle = target.flash > 0 ? "#fff" : "#b5651d";
  ctx.fillRect(target.x, target.y, target.w, target.h);
  ctx.fillStyle = "#ddd";
  ctx.fillText(`target hp ${target.hp}`, target.x, target.y - 8);
  const tag = tagFor(game), info = game.frames[tag.from + player.frame], s = game.config.scale;
  const size = info.sourceSize || { w: info.frame.w, h: info.frame.h };
  const offset = info.spriteSourceSize || { x: 0, y: 0 };
  const left = player.x - (size.w * s) / 2, top = player.y - (size.h * s) / 2;
  ctx.drawImage(game.image, info.frame.x, info.frame.y, info.frame.w, info.frame.h,
    left + offset.x * s, top + offset.y * s, info.frame.w * s, info.frame.h * s);
  if (!debug) return;
  ctx.strokeStyle = "#4aa3ff";
  ctx.strokeRect(target.x, target.y, target.w, target.h);
  if (player.anim === "attack") {
    const b = worldHitbox(game), live = game.config.damageFrames.includes(player.frame + 1);
    if (b) { ctx.strokeStyle = live ? "#ff3b3b" : "#888"; ctx.strokeRect(b.x, b.y, b.w, b.h); }
  }
  ctx.fillStyle = "#ddd";
  ctx.fillText(`${player.dir} ${player.anim} frame ${player.frame + 1}`, 10, 20);
}

loadAll().then(game => {
  let last = performance.now();
  function tick(now) {
    update(game, Math.min(0.05, (now - last) / 1000));
    draw(game);
    last = now;
    requestAnimationFrame(tick);
  }
  requestAnimationFrame(tick);
}).catch(err => {
  ctx.fillStyle = "#fff";
  ctx.fillText(String(err.message).slice(0, 120), 10, 20);
  console.error(err);
});

Serve the folder over HTTP, because browsers block fetch from file:// pages. Binding to 127.0.0.1 keeps the server off your network.

bash
python -m http.server 8000 --bind 127.0.0.1
Stage 04 Checkpoint

Opening http://127.0.0.1:8000/ shows the Ronin and a brown target. WASD turns and walks him in all eight directions, and J plays a full attack before he returns to idle.

Stage 05 · test25 minutes

Check hands, hitboxes and damage frames

Collect evidence for each done-when check that you can hand in with the build.

Review each attack as an animation before you trust the game. The pack ships a GIF for every move, and SpriteRelay can render previews without touching the file.

textPrompt to type into Codex.
Use spriterelay sprite_preview to render each of the eight attack tags as an animated GIF. For each one, tell me which hand holds the sword on frames 1, 5 and 10. Do not patch or commit anything.
Copy this into notes/sword-hand.md and replace each dash with left or right.
DirectionHand on frame 1Hand on frame 5Hand on frame 10
e---
se---
s---
sw---
w---
nw---
n---
ne---
  1. Press H to show the debug overlay. The target outline turns blue and the attack hitbox draws gray, then red on live frames.
  2. Face each direction toward the target and attack. Take one screenshot per direction with the red box visible.
  3. Open the browser console and confirm every hit: line reports frame 5 or frame 6.
  4. Attack with the target out of reach and confirm no hit: line appears and the hit points do not change.
Output
hit: e attack frame 5, target hp 9
hit: se attack frame <5 or 6>, target hp 8
...
Stage 05 Checkpoint

notes/sword-hand.md names the same hand in every cell, and you have eight debug screenshots. The console holds only frame 5 and frame 6 hits.

Troubleshooting

codex mcp list shows spriterelay but /mcp reports it failed to start.

Check both absolute paths by running the same node .../dist/index.js command in a terminal. On Windows use the full path from (Get-Command node).Source, and quote paths that contain spaces.

aseprite_doctor cannot find Aseprite or reports an unsupported version.

Remove and re-add the server with --env ASEPRITE_PATH= set to the Aseprite executable. The CLI baseline is Aseprite 1.3.18.1, so update Aseprite if the doctor reports an older one.

The canvas shows "Unknown names in combat.json".

A tag or slice name in the config does not match the sheet. Copy the names exactly from the list printed after the error, since tag names are case sensitive.

The page is blank and the console shows a CORS or fetch error.

You opened index.html straight from disk. Run python -m http.server 8000 --bind 127.0.0.1 in the combat-sandbox folder and load http://127.0.0.1:8000/ instead.

Attacks never damage the target even when the sword overlaps it.

Turn on the overlay with H and watch the box on frames 5 and 6. If it never turns red over the target, the rectangle or slice points at the wrong side; adjust the rect values or check the slice key frames in notes/inspection.md.

The Ronin is drawn offset from his hitbox or jumps between frames.

The sheet was exported with trimming. The draw code uses spriteSourceSize and sourceSize when they exist, so re-export without trimming if those fields are missing from your JSON.

Done when

  • All eight attacks keep the sword in the same hand. Show hitboxes in debug mode and apply damage only on attack frames five and six.

Going further

  • Add a hurt flash and a short knockback to the target, timed from the frame on which the hit landed.
  • Give the target its own eight-direction facing so it turns toward the Ronin between swings.
  • Record the frame-by-frame hitbox overlay as a GIF with sprite_preview and compare it with the in-game boxes.

References

An AI guide writer drafted this walkthrough against the official documentation above, automated template and style checks validated every block, and an independent AI reviewer verified commands, flags and claims before publication.