Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e84db26
サーバーエンドポイント変更
reigithub Apr 13, 2026
e3e17ef
CI上のシェーダーバリアントストリッピング防止
reigithub Apr 13, 2026
5089610
一部Fusionコードがストリップされる問題対応
reigithub Apr 13, 2026
f60a321
インターナルIPデプロイ設定
reigithub Apr 13, 2026
2fc66db
デプロイ用プロキシ
reigithub Apr 13, 2026
6678caa
デプロイ環境Valkey接続
reigithub Apr 13, 2026
595ec7c
ストリップ保護
reigithub Apr 13, 2026
6c05880
リシミュレーション対策
reigithub Apr 13, 2026
cb0c56c
不要削除
reigithub Apr 13, 2026
f891a7d
DSアドレス取得
reigithub Apr 13, 2026
499122b
DirectVPCEgressに変更
reigithub Apr 14, 2026
d717550
コメント修正
reigithub Apr 14, 2026
bd579eb
DirectVPCEgressデプロイ
reigithub Apr 14, 2026
7566c78
Linuxビルド初期キャッシュ用
reigithub Apr 14, 2026
1cd9fd4
linuxアセットビルド検証
reigithub Apr 14, 2026
6083c96
ワークフローパースエラー修正
reigithub Apr 14, 2026
ca3c67a
個別ランナータグ付与
reigithub Apr 14, 2026
ab8392c
Linuxビルドランナー追加
reigithub Apr 14, 2026
6f72599
ビルドスクリプトの拡張子指定
reigithub Apr 14, 2026
a0aa0b6
インゲーム不具合修正
reigithub Apr 14, 2026
8c8dc30
Fusion設定調整
reigithub Apr 15, 2026
1cad71e
診断ログ追加
reigithub Apr 15, 2026
1b1834b
ハイライト更新
reigithub Apr 15, 2026
6f9f8c4
ドキュメント更新
reigithub Apr 15, 2026
a59ab8d
デプロイスクリプト不具合修正
reigithub Apr 15, 2026
92c2686
Unityサーバーデプロイ修正
reigithub Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions .github/workflows/addressables-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ jobs:
outputs:
unity_project_path: ${{ steps.config.outputs.UNITY_PROJECT_PATH }}
build_timestamp: ${{ steps.timestamp.outputs.value }}
# build / deploy 両方で使う matrix include 配列を動的生成(job-level `if` で matrix を参照できないため)
build_matrix: ${{ steps.matrix.outputs.value }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -78,6 +80,22 @@ jobs:
id: timestamp
run: echo "value=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_OUTPUT

- name: Generate build matrix
id: matrix
run: |
# 対応 runner があるプラットフォームのみ matrix に含める
# WebGL / Android / macOS / iOS は scope 外(runner 未配置)→ 入力されても matrix が空 → job スキップ
WIN='{"platform":"StandaloneWindows64","build_target":"Win64","runner_label":"windows-mono"}'
LINUX='{"platform":"StandaloneLinux64","build_target":"Linux64","runner_label":"linux-il2cpp"}'
case "${{ inputs.build_target }}" in
All) MATRIX="[${WIN},${LINUX}]" ;;
StandaloneWindows64) MATRIX="[${WIN}]" ;;
StandaloneLinux64) MATRIX="[${LINUX}]" ;;
*) MATRIX="[]" ;;
esac
echo "value=${MATRIX}" >> "$GITHUB_OUTPUT"
echo "Generated matrix: ${MATRIX}"

- name: Load configuration
id: config
run: |
Expand All @@ -89,13 +107,16 @@ jobs:
# ============================================
build-addressables:
name: Build Addressables (${{ matrix.platform }})
runs-on: [self-hosted, linux, unity, docker]
# platform 別に self-hosted runner を振り分け(matrix.runner_label で AND マッチング)
runs-on: [self-hosted, linux, unity, docker, "${{ matrix.runner_label }}"]
needs: load-config
timeout-minutes: 180
timeout-minutes: 720
strategy:
fail-fast: false
# load-config が input に応じて生成した matrix を使う
# (job-level `if` で matrix context は使えないため、matrix 自体を空にして job をスキップする方式)
matrix:
platform: ${{ fromJSON(inputs.build_target == 'All' && '["StandaloneWindows64", "StandaloneLinux64", "WebGL", "Android"]' || format('["{0}"]', inputs.build_target)) }}
include: ${{ fromJSON(needs.load-config.outputs.build_matrix) }}
env:
UNITY_PROJECT_PATH: ${{ needs.load-config.outputs.unity_project_path }}
BUILD_TIMESTAMP: ${{ needs.load-config.outputs.build_timestamp }}
Expand All @@ -108,23 +129,10 @@ jobs:
lfs: false
clean: false

- name: Get Unity build target
id: build-target
run: |
case "${{ matrix.platform }}" in
StandaloneWindows64) echo "target=Win64" >> $GITHUB_OUTPUT ;;
StandaloneLinux64) echo "target=Linux64" >> $GITHUB_OUTPUT ;;
StandaloneOSX) echo "target=OSXUniversal" >> $GITHUB_OUTPUT ;;
WebGL) echo "target=WebGL" >> $GITHUB_OUTPUT ;;
Android) echo "target=Android" >> $GITHUB_OUTPUT ;;
iOS) echo "target=iOS" >> $GITHUB_OUTPUT ;;
*) echo "target=${{ matrix.platform }}" >> $GITHUB_OUTPUT ;;
esac

- name: Setup Library cache
run: |
chmod +x .github/scripts/setup-library-cache.sh
.github/scripts/setup-library-cache.sh "${{ env.UNITY_PROJECT_PATH }}" "${{ steps.build-target.outputs.target }}"
.github/scripts/setup-library-cache.sh "${{ env.UNITY_PROJECT_PATH }}" "${{ matrix.build_target }}"

- name: Setup directories
run: |
Expand Down Expand Up @@ -187,7 +195,7 @@ jobs:
-nographics \
-quit \
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
-buildTarget "${{ steps.build-target.outputs.target }}" \
-buildTarget "${{ matrix.build_target }}" \
$ACCELERATOR_ARGS \
-executeMethod Game.Editor.Build.AddressablesR2Uploader.BuildAddressablesCI \
-logFile "${{ github.workspace }}/Logs/addressables-build-${{ matrix.platform }}.log"
Expand Down Expand Up @@ -305,14 +313,16 @@ jobs:
# ============================================
deploy-to-r2:
name: Deploy to R2 (${{ matrix.platform }})
# 軽量タスク(rclone のみ)。任意の self-hosted runner で実行可
runs-on: [self-hosted, linux, unity, docker]
needs: [load-config, build-addressables]
if: inputs.deploy == true
timeout-minutes: 360
strategy:
fail-fast: false
# build-addressables と同じ matrix を共有(platform フィールドのみ参照)
matrix:
platform: ${{ fromJSON(inputs.build_target == 'All' && '["StandaloneWindows64", "StandaloneLinux64", "WebGL", "Android"]' || format('["{0}"]', inputs.build_target)) }}
include: ${{ fromJSON(needs.load-config.outputs.build_matrix) }}
env:
BUILD_TIMESTAMP: ${{ needs.load-config.outputs.build_timestamp }}

Expand Down Expand Up @@ -475,7 +485,7 @@ jobs:
echo "### Deployed URLs" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ inputs.build_target }}" == "All" ]; then
for platform in StandaloneWindows64 StandaloneLinux64 WebGL Android; do
for platform in StandaloneWindows64 StandaloneLinux64; do
echo "- **${platform}:** https://${{ env.R2_CUSTOM_DOMAIN }}/${platform}/" >> $GITHUB_STEP_SUMMARY
done
else
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/unity-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
# ============================================
test:
name: Run Tests
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: load-config
if: ${{ !inputs.skip_tests }}
timeout-minutes: 180
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
# ============================================
build-windows:
name: Build Windows
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, windows-mono]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -237,7 +237,7 @@ jobs:
# ============================================
build-linux:
name: Build Linux
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -303,7 +303,8 @@ jobs:
# ============================================
build-macos:
name: Build macOS
runs-on: [self-hosted, linux, unity, docker]
# scope 外: 対応する mac-mono runner は未配置。実行すると queue 待機 → cancel を想定
runs-on: [self-hosted, linux, unity, docker, mac-mono]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -369,7 +370,8 @@ jobs:
# ============================================
build-webgl:
name: Build WebGL
runs-on: [self-hosted, linux, unity, docker]
# scope 外: 対応する webgl runner は未配置。実行すると queue 待機 → cancel を想定
runs-on: [self-hosted, linux, unity, docker, webgl]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -435,7 +437,8 @@ jobs:
# ============================================
build-android:
name: Build Android
runs-on: [self-hosted, linux, unity, docker]
# scope 外: 対応する android runner は未配置。実行すると queue 待機 → cancel を想定
runs-on: [self-hosted, linux, unity, docker, android]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -501,7 +504,8 @@ jobs:
# ============================================
build-ios:
name: Build iOS (Xcode Project)
runs-on: [self-hosted, linux, unity, docker]
# scope 外: 対応する ios runner は未配置。実行すると queue 待機 → cancel を想定
runs-on: [self-hosted, linux, unity, docker, ios]
needs: [load-config, test]
if: |
always() &&
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/unity-server-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
# ============================================
test:
name: Run Tests
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: load-config
if: ${{ !inputs.skip_tests }}
timeout-minutes: 180
Expand Down Expand Up @@ -149,7 +149,8 @@ jobs:
# ============================================
build-windows-server:
name: Build Windows Dedicated Server
runs-on: [self-hosted, linux, unity, docker]
# windows-mono image は win64_server_*_mono バリアントを内包するため windows-mono runner で対応可
runs-on: [self-hosted, linux, unity, docker, windows-mono]
needs: [load-config, test]
if: |
always() &&
Expand Down Expand Up @@ -215,7 +216,8 @@ jobs:
# ============================================
build-linux-server:
name: Build Linux Dedicated Server
runs-on: [self-hosted, linux, unity, docker]
# linux-il2cpp image は linux64_server_*_il2cpp / mono バリアントを内包するため linux-il2cpp runner で対応可
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: [load-config, test]
if: |
always() &&
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# ============================================
test-editmode:
name: EditMode Tests
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: load-config
timeout-minutes: 30
env:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
# ============================================
test-playmode:
name: PlayMode Tests
runs-on: [self-hosted, linux, unity, docker]
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: [load-config, test-editmode]
timeout-minutes: 120
env:
Expand Down
21 changes: 11 additions & 10 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ A game development portfolio built with Unity 6 + ASP.NET Core 9 + MagicOnion gR

## Highlights

* **8-assembly modular design** — MVC/MVP coexistence with structurally enforced circular reference prevention
* **1,148 automated tests** (EditMode 746 + PlayMode 63 + Server 339) across 7 CI/CD workflows
* **Unity × Server × Infrastructure in a single monorepo** — Unity 6 client / ASP.NET Core 9 + MagicOnion gRPC / PostgreSQL + Valkey / GitHub Actions CI/CD
* **Photon Fusion 2 server authority model + Dedicated Server operations** — Dead Reckoning interpolation, enemy batch sync (NetworkArray<512>), Linux headless build with self-registration + HMAC auth + Docker deployment
* **Self-built LiveOps delivery pipeline** — GitHub Actions self-hosted runners + Unity Accelerator + Cloudflare R2 CDN, Addressables with 4-environment switching, index.json differential sync, editor auto-sync
* **ECS + Burst parallelization** — up to 20.3x speedup for enemy spawn calculations (5,000 entities), 23 ProfilerMarkers for instrumentation
* **Protobuf schema-driven master data** — custom CLI tool (6 subcommands), deploy-target-filtered binary generation from a single schema for Client/Server
* **Circuit breaker + exponential backoff retry** for fault-tolerant HTTP communication with cache fallback
* **Photon Fusion 2 server authority model** — Dead Reckoning interpolation, enemy batch sync (NetworkArray<512>), Dedicated Server orchestration
* **Rendering optimization targeting mobile device quality** — custom URP/HLSL shaders (ToonLit / Dissolve / Hit Flash / Outline), distance-based 3-tier LOD, dual URP profiles, Canvas separation
* **Protobuf schema-driven master data** — custom CLI tool (6 subcommands), deploy-target-filtered binary generation from a single schema for Client/Server/Realtime
* **8-assembly modular design** — MVC/MVP coexistence with structurally enforced circular reference prevention
* **1,148 automated tests** (EditMode 746 + PlayMode 63 + Server 339 with Testcontainers) across 7 CI/CD workflows

> **Architecture Details**: [ARCHITECTURE.md](ARCHITECTURE.md) (11 chapters, 14 ADRs)

Expand Down Expand Up @@ -194,7 +196,7 @@ dotnet test
* **Real-time Chat**: Room-based messaging via SignalR WebSocket + MagicOnion
* **Request Signing Policy**: Declarative endpoint security (3 signing attributes), fail-fast startup validation

### Multiplayer (Photon Fusion 2)
### Realtime Online Gameplay (Photon Fusion 2)
* **Server Authority Model**: Server/Client mode, [Networked] properties, Fusion FSM player state sync
* **Enemy Batch Sync**: Server-controlled enemy AI, 10Hz batch sync (NetworkArray<512>), client Dead Reckoning interpolation
* **Dedicated Server Orchestration**: Linux headless build, self-registration + heartbeat to Game.Server, HMAC auth, Docker deploy
Expand Down Expand Up @@ -1001,14 +1003,13 @@ Unity6Portfolio/
* DOTween Sequence compound UI animations (level-up, result screens)
* Skip/interrupt control (DOKill / IsTweening guard) implementation

**Design Patterns:**
* ScriptableObject event channel introduction (comparison with MessagePipe)
* ScriptableObject data assets for runtime configuration

**Platform:**
* Localization support (multi-language, Unity Localization)
* Multi-resolution & multi-platform support (iOS / Android build & signing)

**Features:**
* In-app purchase system, gacha, present box, etc.

---

## About the Demo Game
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ Unity 6 + ASP.NET Core 9 + MagicOnion gRPC + Photon Fusion 2 によるゲーム

## ハイライト

* **8アセンブリ分割**のモジュラー設計 — MVC/MVP両パターンを共存させ、循環参照を構造的に防止
* **1,148テスト**による自動品質保証(EditMode 746 + PlayMode 63 + サーバー 339)、CI/CD 7ワークフロー
* **Unity × サーバー × インフラをモノレポで一括実装** — Unity 6 クライアント / ASP.NET Core 9 + MagicOnion gRPC / PostgreSQL + Valkey / GitHub Actions CI/CD
* **Photon Fusion 2 サーバー権威モデル + Dedicated Server運用** — Dead Reckoning補間、敵バッチ同期(NetworkArray<512>)、Linuxヘッドレスビルド自己登録+HMAC認証+Docker化
* **LiveOps配信基盤の自力構築** — GitHub Actions セルフホストランナー + Unity Accelerator + Cloudflare R2 CDN、Addressables 4環境切替・index.json差分同期・エディタ自動同期
* **ECS + Burst並列化**で敵スポーン計算を最大20.3倍高速化(5,000体)、23箇所のProfilerMarkerによる計測基盤
* **Protobufスキーマ駆動**のマスターデータ基盤 — CLIツール自作(6サブコマンド)、Client/Server同一スキーマからデプロイターゲット別バイナリ生成
* **サーキットブレーカー + 指数バックオフリトライ**によるHTTP通信の耐障害設計、キャッシュフォールバック対応
* **Photon Fusion 2 サーバー権威モデル** — Dead Reckoning補間、敵バッチ同期(NetworkArray<512>)、Dedicated Serverオーケストレーション
* **モバイル実機品質を意識したレンダリング最適化** — カスタムURP/HLSLシェーダー(ToonLit / Dissolve / Hit Flash / Outline)、距離ベース3段階LOD、URP 2プロファイル、Canvas分離
* **Protobufスキーマ駆動のマスターデータ基盤** — CLIツール自作(6サブコマンド)、Client/Server/Realtime同一スキーマからデプロイターゲット別バイナリ生成
* **8アセンブリ分割のモジュラー設計** — MVC/MVP両パターンを共存させ、循環参照を構造的に防止
* **1,148テスト**による自動品質保証(EditMode 746 + PlayMode 63 + サーバー 339・Testcontainers採用)、CI/CD 7ワークフロー

> **アーキテクチャ詳細**: [ARCHITECTURE.md](ARCHITECTURE.md)(全11章、ADR 14件)

Expand Down Expand Up @@ -194,7 +196,7 @@ dotnet test
* **リアルタイムチャット**: SignalR WebSocket + MagicOnionによるルームベースメッセージング
* **リクエスト署名ポリシー**: 宣言的エンドポイントセキュリティ(3種の署名属性)、起動時fail-fastバリデーション

### サーバー/クライアントモデル(Photon Fusion 2)
### リアルタイムオンラインゲームプレイ(Photon Fusion 2)
* **サーバー権威モデル**: Server/Clientモード、[Networked]プロパティ、Fusion FSMによるプレイヤーステート同期
* **敵バッチ同期**: サーバーが敵AI制御、10Hzバッチ同期(NetworkArray<512>)、クライアントDead Reckoning補間
* **Dedicated Serverオーケストレーション**: Linux ヘッドレスビルド、Game.Serverへの自己登録+ハートビート、HMAC認証、Dockerデプロイ
Expand Down Expand Up @@ -1008,14 +1010,13 @@ Unity6Portfolio/
* DOTween Sequenceによる複合UI演出(レベルアップ、リザルト)
* スキップ・割り込み制御(DOKill / IsTweening ガード)の実装

**設計パターン:**
* ScriptableObjectイベントチャネルの導入(MessagePipeとの使い分け検証)
* ScriptableObjectデータアセットの追加(ランタイム設定用途)

**プラットフォーム:**
* ローカライズ対応(多言語、Unity Localization)
* マルチ解像度・マルチプラットフォーム対応(iOS / Androidビルド・署名)

**機能:**
* 課金システム・ガチャ・プレゼントBOXなど

---

## デモゲームについて
Expand Down
10 changes: 7 additions & 3 deletions docker/game-realtime/prod/cloudbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ steps:
--region=${_REGION} \
--platform=managed \
--allow-unauthenticated \
--vpc-connector=${_VPC_CONNECTOR} \
--clear-vpc-connector \
--network=${_VPC_NETWORK} \
--subnet=${_VPC_SUBNET} \
--vpc-egress=private-ranges-only \
--set-env-vars="ASPNETCORE_ENVIRONMENT=Production" \
--set-env-vars="ConnectionStrings__Valkey=${_VALKEY_HOST}:${_VALKEY_PORT},abortConnect=false,connectTimeout=5000" \
--set-env-vars="Jwt__Issuer=${_JWT_ISSUER}" \
Expand Down Expand Up @@ -83,8 +86,9 @@ substitutions:
# Memorystore for Valkey 設定
_VALKEY_HOST: ''
_VALKEY_PORT: '6379'
# VPC Connector(Memorystore 接続に必要)
_VPC_CONNECTOR: ''
# Direct VPC Egress(Memorystore / 内部通信に必要)
_VPC_NETWORK: default
_VPC_SUBNET: game-direct-vpc-subnet

# ===== ビルドオプション =====
options:
Expand Down
Loading
Loading