最高の 2D Web ゲームを、もっと手軽に

## 最初の1時間は、ゲームづくりに {#spend-the-first-hour-on-the-game}

ゲームのアイデアがつぶれるのは、設計が悪いからではありません。たいていは準備の段階、ゲームループと鳴らないサウンドのあいだで消えていきます。

準備は debuff が引き受けます。テンプレートから始めれば、もういじり始めています。揺らして、壊して、思わずニヤッとした部分を残していきましょう。

## 落書きから完成まで {#from-doodle-to-done}

はじめる1分もかからずにゲームが動きます。スターターかプラットフォーマーから選べます。
つくるスプライト、Tiled や LDtk で作ったレベル、そして使うものだけを出力するアセットパイプライン。
調整する手触りの値は開発パネルのライブスライダーになり、元に戻すこともできます。
検証する決定的なシナリオが本物のブラウザでゲームを操作し、スクリーンショットを比較します。
リリースする開発用コードが紛れ込むと失敗するサイズレポート付き。Web ならどこでも、Tauri でデスクトップにも。

## 小さなコードで、大きなアイデア {#small-codebase-big-ideas}

`game.world.systems.physics.step()` の奥深くまで潜る必要はありません。ゲームは `update` と `render` を持つシーンで、楽しい機能はどれも呼び出しひとつで使えます。

```ts [Start]
const game = new Game({ canvas, width: 320, height: 180 });
const input = new Input(game, {
  bindings: { pop: ["Space", "PadA", "Pointer"] },
});

game.add(play).go("play");
game.start();
```

```ts [Tune]
// ふわふわしすぎ？ しっくりくるまで開発パネルのスライダーを動かしましょう。
const tuning = game.params.define("player", {
  speed: { type: "number", default: 140, min: 0, max: 600, units: "px/s" },
});

player.vx = approach(player.vx, dir * tuning.values.speed, accel * dt);
```

```ts [Juice]
if (input.pressed("pop")) {
  // ぷにっ、キラッ、ブルッ、ポン
  squash(tweens, player, 0.35);
  particles.emit({ x: player.x, y: player.y, count: 16, gravity: 200 });
  game.camera.shake(0.3);
  audio.synth({ freq: 660, freqEnd: 220, decay: 0.15 });
}
```

```ts [Test]
import { expect, play, test } from "keiko";

test("never leaves the screen", async () => {
  const game = await play();
  game.press("ArrowLeft");
  game.during("3s", (s) => s.player.x >= 8, "buff stays on screen");
});
```

```json [Verify]
{
  "steps": [
    { "press": "ArrowRight" },
    { "wait": 30 },
    { "release": "ArrowRight" },
    { "expect": { "state.player.x": { "gt": 200 } } },
    { "capture": "moved" }
  ]
}
```

最初のゲームをつくる · サンプルをすべて見る

## 退屈な部分は、おまかせ {#the-boring-bits-handled}

最初から小さいスターターは brotli で約 19 kB。アセットパイプラインは、ゲームが使うものだけを同梱します。
自分で説明してくれるエラークラッシュするとゲームはきれいに止まり、誰のバグなのか（あなたのコードか、拒否された呼び出しか、debuff か）を、該当するソース行とヒント付きで教えてくれます。
「なぜ？」に答える開発パネル一時停止、コマ送り、スローモーション、ゲーム状態のライブ表示。フレーム落ちは、あなたのコードが原因かそれ以外が原因かまで切り分けます。
信頼できるテスト同じ入力なら同じゲーム。シナリオは完全に再現されるので、バグには「手元では動く」ではなく再現手順がついてきます。
Web 標準だけES モジュール、canvas、Web Audio、Gamepad。独自エディタも独自のプロジェクト形式もありません。ビルドなしで CDN から動かすことすらできます。

## 単体でも使えるツール {#tools}

debuff は、debuff なしでも使える部品でできています。どのエンジンでも、エンジンなしでも使えます。

## まず遊んで、読むのはあとで {#play-first-read-later}

ここですぐに遊べる 4 つのゲームです。どれもソースと関連ドキュメントつき。カードのサイズは brotli 圧縮後の JavaScript です。

▶Overbuffed群れサバイバル · 26 kB▶squishマッチ 3 · 23 kB▶mossfell見下ろし型アドベンチャー · 29 kB▶platformerタイルマップのプラットフォーマー · 28 kB

すべてのサンプルを見る

## よければ、コーディングエージェントも一緒に {#bring-a-coding-agent-along-if-you-like}

エージェントは大歓迎ですが、必須ではありません。[debuff MCP サーバー](/ja/docs/agents)を使えば、Claude Code のようなエージェントが、あなたの開いているゲームを遊べます。状態や説明付きのエラーを読み、パラメータを調整し、変更をシナリオで検証したりもできます。エージェントの操作はすべて開発パネルに表示され、そこから元に戻せます。

新しいプロジェクトにはコマンドとルールをまとめた `AGENTS.md` が入っているので、エージェントは最初から正しい文脈で作業を始められます。創作上の判断はあなたのものです。ツールは、エージェントが提案し、人が決めるように作られています。

開くgame_start見るgame_state撮るgame_capture遊ぶgame_input測るgame_profile確かめるrun_scenarios

## ものづくりをする人たちの手で {#made-by-people-who-make-things}

Vite、Vitest、happy-dom、TypeScript、Tiled、LDtk をはじめ、たくさんのオープンソースの成果の上に成り立っています。ありがとうございます。

GitHub でコントリビュート · Discord に参加

## ものをつくろう。 {#make-something-weird}

最初のゲームをつくる GitHub でソースを見る 質問する スポンサーになる

スポンサー:  Wavedash

.home-sections {
  --c-lime: #cffb2d;
  --c-sky: #38bdf8;
  --c-pink: #f472b6;
  --c-amber: #fbbf24;
  --c-violet: #a78bfa;
}
.c-lime { --accent: var(--c-lime); }
.c-sky { --accent: var(--c-sky); }
.c-pink { --accent: var(--c-pink); }
.c-amber { --accent: var(--c-amber); }
.c-violet { --accent: var(--c-violet); }
.home-sections {
  max-width: 1152px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}
@media (min-width: 640px) {
  .home-sections { padding: 24px 48px 80px; }
}
.home-band {
  padding: 40px 0;
  border-top: 1px solid var(--vp-c-divider);
}
.home-band h2 {
  font-family: var(--vp-font-family-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}
.home-band p {
  max-width: 46rem;
  color: var(--vp-c-text-2);
  line-height: 1.7;
  margin: 0 0 12px;
}
.home-band a:not(.card):not(.final-primary) {
  color: var(--vp-c-brand-1);
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.credits {
  display: flex;
  flex-wrap: wrap;
  padding-left: 12px;
  margin: 20px 0 12px;
}
/* Overlapping avatars that bubble up on hover. */
.vp-doc .credits a {
  margin-left: -12px;
  border-radius: 30%;
  line-height: 0;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vp-doc .credits a:hover,
.vp-doc .credits a:focus-visible {
  transform: translateY(-6px) scale(1.12);
  z-index: 1;
}
.credits img {
  width: 48px;
  height: 48px;
  border-radius: 30%;
  border: 3px solid var(--vp-c-bg);
  background: var(--vp-c-bg-soft);
}
@media (prefers-reduced-motion: reduce) {
  .vp-doc .credits a { transition: none; }
}
.eyebrow {
  font: 600 12px/1.4 var(--vp-font-family-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vp-c-text-2) !important;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  counter-reset: step;
}
@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .steps li { grid-column: span 2; }
  .steps li:nth-child(n + 4) { grid-column: span 3; }
}
.steps li {
  margin: 0 !important;
  counter-increment: step;
  padding: 16px;
  border: 1px solid var(--vp-c-divider);
  border-radius: 12px;
  background: var(--vp-c-bg-soft);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 10px;
  min-width: 0;
}
.steps li strong::before {
  content: counter(step) " ";
  color: var(--accent, var(--vp-c-brand-1));
  font-family: var(--vp-font-family-mono);
}
.steps .cmd { width: 100%; min-width: 0; }
.steps span {
  color: var(--vp-c-text-2);
  font-size: 14px;
  line-height: 1.6;
}
.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--vp-c-divider);
  border-radius: 12px;
  background: var(--vp-c-bg-soft);
  text-decoration: none !important;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--vp-c-text-3); }
.card strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--accent, var(--vp-c-brand-1));
  vertical-align: 2px;
}
.card strong { color: var(--vp-c-text-1); font-size: 16px; }
.card span { color: var(--vp-c-text-2); font-size: 14px; line-height: 1.6; }
.home-final { text-align: left; }
.home-final h2 { font-size: 36px; }
.final-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 16px !important;
}
.final-primary {
  padding: 8px 18px;
  border-radius: 999px;
  background: #cffb2d;
  color: #11140d !important;
  font-weight: 600;
  text-decoration: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* Design pass: bigger headings, game cards, the spryte band, tool chips and a lime final panel. */
.home-band h2 { font-size: 36px; }
.games {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 8px 0 4px;
}
@media (max-width: 860px) { .games { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vp-doc .games a.game {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  background: var(--vp-c-bg-soft);
  text-decoration: none !important;
  transition: transform 0.15s;
}
.vp-doc .games a.game:hover { transform: translateY(-3px); }
.games img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  image-rendering: pixelated;
}
.vp-doc .games a.game { position: relative; }
.games span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  color: var(--vp-c-text-1);
}
.games span strong { font-weight: 600; }
.games span small { font-size: 12px; color: var(--vp-c-text-3); }
.games .play {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #cffb2d;
  color: #11140d;
  font-size: 13px;
  padding-left: 2px;
  opacity: 0;
  scale: 0.6;
  transition: opacity 0.2s, scale 0.3s cubic-bezier(0.34, 1.8, 0.64, 1);
}
.games a.game:hover .play, .games a.game:focus-visible .play { opacity: 1; scale: 1; }
.spryte-band {
  margin: 24px 0;
  padding: 40px !important;
  border: 0 !important;
  border-radius: 24px;
  background: #11140d;
}
.spryte-band h2 { color: #cffb2d; font-family: "Chakra Petch", var(--vp-font-family-display); }
.spryte-mark { border-radius: 16px; margin-bottom: 16px; }
.spryte-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.spryte-stats div { background: #1b2014; border-radius: 16px; padding: 16px; }
.spryte-stats b { display: block; font: 700 32px/1 "Chakra Petch", var(--vp-font-family-base); color: #cffb2d; }
.spryte-stats span { display: block; margin-top: 6px; font-size: 13px; color: #9aa38c; }
.vp-doc .home-band a.spryte-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: #cffb2d;
  color: #11140d !important;
  font-weight: 600;
  text-decoration: none !important;
}
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.tools a {
  --c: #b49cf0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, transparent) !important;
  color: var(--vp-c-text-1) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.2s, translate 0.25s cubic-bezier(0.34, 1.8, 0.64, 1);
}
.tools a:hover { background: color-mix(in srgb, var(--c) 28%, transparent) !important; translate: 0 -2px; }
.tools a code { padding: 0 !important; background: none !important; color: var(--c) !important; font-size: 12px !important; }
.tools .c-pink { --c: #f4a6d6; }
.tools .c-sky { --c: #1fb4ec; }
.tools .c-amber { --c: #e08a4a; }
.tools .c-violet { --c: #8f8cf0; }
.tools .c-mint { --c: #a8e8c0; }
:root:not(.dark) .tools a code { color: color-mix(in srgb, var(--c) 55%, #11140d) !important; }
.home-final {
  margin-top: 24px;
  padding: 40px !important;
  border: 0 !important;
  border-radius: 24px;
  background: #cffb2d;
}
.home-final h2 { color: #11140d; }
.home-final p { color: #11140d !important; }
.vp-doc .home-final .final-links a:not(.final-primary) { color: #11140d !important; }
.vp-doc .home-final a.final-primary { background: #11140d; color: #cffb2d !important; }
.card { border-radius: 18px; padding: 22px; }
.card strong::before { width: 10px; height: 10px; border-radius: 50%; }
.card:hover { border-color: var(--accent, var(--vp-c-text-3)); }

/* Pass 2. Homepage headings don't need the hover anchor. */
.home-band .header-anchor { display: none; }

/* From doodle to done: five equal steps joined by a line, commands pinned to the bottom. */
.vp-doc ol.steps { padding-left: 0 !important; position: relative; }
.steps li {
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  padding: 20px !important;
  border-radius: 18px !important;
  position: relative;
}
.steps li strong {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
}
.steps li strong::before {
  content: counter(step) !important;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #11140d !important;
  font: 700 15px/1 var(--vp-font-family-base) !important;
  flex: none;
}
.steps li > span { order: 2; }
.steps li > .cmd { order: 3; margin-top: auto; }
/* Compact commands so "npm create debuff" fits a fifth of the row. */
.steps li > .cmd { font-size: 12px; padding-left: 10px !important; padding-right: 6px !important; }
.steps li > .cmd code { white-space: normal; overflow: visible; text-overflow: clip; text-align: left; }
@media (min-width: 960px) {
  .steps { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 14px !important; }
  .steps li, .steps li:nth-child(n + 4) { grid-column: auto !important; }
  /* the line joining the step badges */
  .steps::before {
    content: "";
    position: absolute;
    left: 40px;
    right: 40px;
    top: 35px;
    height: 2px;
    background: linear-gradient(90deg, #cffb2d, #38bdf8, #f472b6, #fbbf24, #a78bfa);
    opacity: 0.35;
  }
}
@media (max-width: 959px) {
  .steps { grid-template-columns: 1fr !important; }
  .steps li, .steps li:nth-child(n + 4) { grid-column: auto !important; }
}

/* The boring bits: an even grid, text from the top, a jelly icon tile per card. */
.cards { align-items: stretch; }
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .cards .card { grid-column: span 2; }
  .cards .card:nth-child(n + 4) { grid-column: span 3; }
}
.card {
  display: flex !important;
  flex-direction: column;
  gap: 10px !important;
  align-content: start;
}
.card strong {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px !important;
}
.card strong::before {
  /* a little jelly blob with dot eyes, in the card's colour */
  content: "" !important;
  flex: none;
  width: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  border-radius: 12px !important;
  background:
    radial-gradient(circle at 38% 46%, #11140d 0 2.4px, transparent 2.9px),
    radial-gradient(circle at 62% 46%, #11140d 0 2.4px, transparent 2.9px),
    var(--accent) !important;
  animation: bob 2.6s ease-in-out infinite;
}
.card:nth-child(2) strong::before { animation-delay: 0.3s; }
.card:nth-child(3) strong::before { animation-delay: 0.6s; }
.card:nth-child(4) strong::before { animation-delay: 0.9s; }
.card:nth-child(5) strong::before { animation-delay: 1.2s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  45% { transform: translateY(-3px) scale(0.96, 1.05); }
  60% { transform: translateY(0) scale(1.06, 0.94); }
}
@media (prefers-reduced-motion: reduce) {
  .card strong::before { animation: none; }
}

/* Pass 3: squish has no outlines. Cards are flat fills; hover lifts the fill instead of the border. */
.steps li,
.card {
  border: 0 !important;
  background: var(--vp-c-bg-soft) !important;
  transition: background-color 0.15s, transform 0.15s !important;
}
.vp-doc a.card:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--vp-c-bg-soft)) !important;
  transform: translateY(-2px);
}
/* Step commands: a borderless chip on one line, no copy icon (clicking still copies). */
.steps li > .cmd {
  border: 0 !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  padding: 7px 12px !important;
  font-size: 11.5px;
  width: auto !important;
  align-self: flex-start;
}
.steps li > .cmd code { white-space: nowrap !important; }
.steps li > .cmd .state { display: none !important; }
/* Long titles wrap beside the icon, not under it. */
.card strong { align-items: flex-start !important; line-height: 1.3; }
.card strong::before { margin-top: -2px !important; }

/* Pass 4: the steps as a bento grid. */
.steps::before { display: none !important; }
@media (min-width: 960px) {
  .steps {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(150px, auto);
  }
  .steps li, .steps li:nth-child(n + 4) { grid-column: span 2 !important; }
  .steps li:first-child { grid-row: span 2; }
}
@media (min-width: 640px) and (max-width: 959px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .steps li:first-child { grid-column: span 2 !important; }
}