テーマ
manifest.json リファレンス
manifest.json はゲームプロジェクトのルートに配置する設定ファイルです。npx uzu publish がこのファイルを読み取り、ビルド・アップロード・リビジョン登録を行います。
最小構成
json
{
"id": "reversi",
"playerCount": 2,
"build": "pnpm run build",
"output": "dist"
}フィールド一覧
| フィールド | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|
id | string | ✅ | — | ゲームの一意な識別子 |
playerCount | number | ✅ | — | プレイヤー人数 (characters 指定時は配列長で上書き) |
output | string | ✅ | — | ビルド成果物の出力ディレクトリ (例: "dist") |
build | string | — | — | ビルドコマンド。npx uzu publish 時に自動実行 |
orientation | "portrait" | "landscape" | — | "portrait" | ゲーム画面の向き |
serverActionLogicPath | string | — | — | サーバーサイド reducer のエントリポイント (run() パターン使用時) |
characters | Character[] | — | — | プレイヤーキャラクターの定義 |
Character オブジェクト
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
id | string | ✅ | キャラクターの一意な識別子 |
name | string | ✅ | 表示名 |
description | string | — | キャラクターの説明 |
icon | string | — | アイコン画像。ローカルパスまたは URL。ローカルパスは publish 時に Cloudflare Images にアップロードされる |
furigana | string | — | 名前のふりがな |
パターン別の設定例
sync() パターン (クライアントサイド同期)
json
{
"id": "reversi",
"playerCount": 2,
"build": "pnpm run build",
"output": "dist"
}serverActionLogicPath を指定しない場合、ゲームは SyncRoom 方式で動作します。
run() パターン (サーバー権威)
json
{
"id": "shogi",
"build": "pnpm run build",
"output": "dist",
"serverActionLogicPath": "./src/logic.ts",
"playerCount": 2,
"characters": [
{
"id": "sente",
"name": "先手",
"description": "先手番のプレイヤー",
"icon": "https://example.com/sente.png",
"furigana": "せんて"
},
{
"id": "gote",
"name": "後手",
"icon": "./assets/gote.png",
"furigana": "ごて"
}
]
}serverActionLogicPath を指定すると、npx uzu publish 時に reducer ロジックがサーバーにデプロイされ、GameRoom DO 上で実行されます。
横向きゲーム
json
{
"id": "card-game",
"playerCount": 4,
"build": "pnpm run build",
"output": "dist",
"orientation": "landscape"
}パブリッシュ時の処理フロー
npx uzu publish を実行すると、以下の順序で処理が行われます:
manifest.jsonを読み取り、フィールドをバリデーションbuildコマンドを実行 (指定されている場合)outputディレクトリを ZIP 化して R2 にアップロードserverActionLogicPathが指定されている場合: サーバーロジックをビルド・アップロードcharactersのローカルアイコンを Cloudflare Images にアップロード- gRPC でバックエンドにリビジョンを登録
- UZU Studio の URL を出力
bash
npx uzu publish # ビルド → アップロード → 登録
npx uzu publish --skip-build # ビルド済みの場合バリデーションルール
id、playerCount、outputは必須charactersを指定する場合:- 空配列は不可
- 各キャラクターに
idとnameが必要 - 実際のプレイヤー人数は
charactersの配列長で決定 (playerCountより優先)