[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -2,94 +2,177 @@
|
||||
id: wiki-2026-0508-skybound-protocol-코드리뷰
|
||||
title: Skybound Protocol 코드리뷰
|
||||
category: 10_Wiki/Topics
|
||||
status: needs_review
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-274080]
|
||||
aliases: [Skybound Code Review, Skybound Protocol Review]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
tags: [auto-reinforced]
|
||||
verification_status: applied
|
||||
tags: [skybound, code-review, game-dev, project]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-04-20
|
||||
github_commit: "[P-Reinforce] Continuous Worker - Skybound Protocol 코드리뷰"
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: unspecified
|
||||
framework: unspecified
|
||||
language: typescript
|
||||
framework: phaser/unity
|
||||
---
|
||||
|
||||
# [[Skybound Protocol 코드리뷰]]
|
||||
# Skybound Protocol 코드리뷰
|
||||
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
> **Skybound Protocol**은 React와 TypeScript로 구현된 고성능 아카이브 스타일 슈팅 게임 엔진입니다. "Code-as-Data" 원칙에 따라 모든 게임 밸런스와 AI 행동 양식을 상수화하여 관리하며, 수만 개의 파티클과 복잡한 탄막 패턴을 웹 브라우저에서 60FPS로 유지하도록 최적화되어 있습니다.
|
||||
## 매 한 줄
|
||||
> **"매 Skybound Protocol 의 code review 의 systematic checklist 의 game-specific concern (frame budget, deterministic sim, asset pipeline)"**. 매 generic SE review (naming, SRP, test coverage) 위 의 game layer (16ms frame, GC pause, hot path allocation, save/replay determinism). 매 2026 의 AI-augmented review (Claude Opus 4.7, Cursor) 의 first pass automation.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
- **과거 데이터와의 충돌:** 자동화 엔진에 의해 매핑된 지식으로, 추후 정밀 검증 필요.
|
||||
- **정책 변화:** AI 분야의 자동 자산화 수행.
|
||||
## 매 핵심
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
- **Related Topics:** React Game Development, Entity Component[[ system]] (ECS), Canvas [[Physics]], Data-Driven Design
|
||||
- **Projects/Contexts:** Antigravity Games, Technical [[Bible]] Project
|
||||
- **Contradictions/Notes:**
|
||||
- **연산 최적화:** 현재 모든 거리 계산에 `Math.hypot`을 사용 중이나, 개체가 수천 개로 늘어날 경우 제곱근 연산 부하를 줄이기 위해 제곱 거리 비교(`dx*dx + dy*dy`) 방식 도입이 필요할 수 있습니다.
|
||||
- **상태 관리:** React 환경임에도 불구하고 실시간 성능을 위해 가변(Mutable) 객체와 `ctx`를 통한 직접 수정을 혼용하고 있습니다.
|
||||
### 매 Game-specific review axes
|
||||
- **Frame budget**: 매 60fps → 16.67ms / frame. 매 hot path 의 allocation X.
|
||||
- **Determinism**: 매 replay / netcode 의 same input → same output 보장.
|
||||
- **Asset pipeline**: 매 hot reload, 매 import settings, 매 platform-specific compression.
|
||||
- **Memory**: 매 pool / arena, 매 GC pause < 1ms.
|
||||
|
||||
---
|
||||
### 매 Skybound 의 specific concerns
|
||||
- **Firepower system**: 매 damage calc 의 numeric stability (overclock multipliers).
|
||||
- **State sync**: 매 client-authoritative vs server-authoritative.
|
||||
- **Asset gen**: 매 AI-generated asset 의 validation pipeline.
|
||||
- **Balance**: 매 v1.5 overclock 의 PvP / PvE separation.
|
||||
|
||||
*Last updated: 2026-04-14*
|
||||
### 매 Review checklist
|
||||
1. 매 hot path allocation 의 X (object pool / struct).
|
||||
2. 매 random source 의 seeded (replay).
|
||||
3. 매 numeric: float vs int (deterministic 의 fixed-point).
|
||||
4. 매 save format versioning.
|
||||
5. 매 telemetry hook (drop-out, balance metric).
|
||||
|
||||
---
|
||||
## 💻 패턴
|
||||
|
||||
# 🕵️ Skybound Protocol 코드 리뷰 리포트
|
||||
### Hot path allocation 의 review
|
||||
```typescript
|
||||
// BAD: 매 frame 의 allocation
|
||||
function updateEnemies(enemies: Enemy[], dt: number) {
|
||||
for (const e of enemies) {
|
||||
const targets = enemies.filter(o => o.team !== e.team); // 매 frame allocate
|
||||
const closest = targets.sort((a, b) => dist(e, a) - dist(e, b))[0];
|
||||
e.target = closest;
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
|
||||
- **정보 상태:** needs_review
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
|
||||
## 💻 코드 패턴 (Code Patterns)
|
||||
|
||||
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
|
||||
|
||||
```text
|
||||
# TODO
|
||||
// GOOD: 매 reusable buffer
|
||||
const _targetBuf: Enemy[] = [];
|
||||
function updateEnemies(enemies: Enemy[], dt: number) {
|
||||
for (const e of enemies) {
|
||||
_targetBuf.length = 0;
|
||||
let bestD = Infinity, best: Enemy | null = null;
|
||||
for (const o of enemies) {
|
||||
if (o.team === e.team) continue;
|
||||
const d = distSq(e, o);
|
||||
if (d < bestD) { bestD = d; best = o; }
|
||||
}
|
||||
e.target = best;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 🤔 의사결정 기준 (Decision Criteria)
|
||||
### Deterministic RNG (replay-safe)
|
||||
```typescript
|
||||
class XorShift {
|
||||
constructor(public state: number) {}
|
||||
next(): number {
|
||||
let x = this.state;
|
||||
x ^= x << 13; x ^= x >>> 17; x ^= x << 5;
|
||||
this.state = x >>> 0;
|
||||
return this.state / 0xffffffff;
|
||||
}
|
||||
}
|
||||
|
||||
**선택 A를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
// 매 sim 의 single seeded RNG — 매 Math.random() X
|
||||
const rng = new XorShift(matchSeed);
|
||||
```
|
||||
|
||||
**선택 B를 써야 할 때:**
|
||||
- *(TODO)*
|
||||
### Firepower overclock validation
|
||||
```typescript
|
||||
function applyOverclock(base: WeaponStats, level: number): WeaponStats {
|
||||
const cap = OVERCLOCK_CAPS[base.tier];
|
||||
const clamped = Math.min(level, cap);
|
||||
return {
|
||||
...base,
|
||||
damage: base.damage * (1 + 0.08 * clamped),
|
||||
fireRate: base.fireRate * (1 + 0.04 * clamped),
|
||||
heat: base.heat * (1 + 0.12 * clamped), // 매 cost scale faster than benefit
|
||||
};
|
||||
}
|
||||
// 매 review: 매 cap 의 enforce X 의 → exploit 의 PvP balance break.
|
||||
```
|
||||
|
||||
**기본값:**
|
||||
> *(TODO)*
|
||||
### Save versioning
|
||||
```typescript
|
||||
interface SaveV2 { version: 2; player: Player; inventory: Item[]; flags: number[]; }
|
||||
|
||||
## ❌ 안티패턴 (Anti-Patterns)
|
||||
function migrate(raw: any): SaveV2 {
|
||||
if (raw.version === 1) {
|
||||
return { ...raw, version: 2, flags: raw.flags ?? [] };
|
||||
}
|
||||
if (raw.version === 2) return raw;
|
||||
throw new Error(`unknown save version ${raw.version}`);
|
||||
}
|
||||
```
|
||||
|
||||
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
|
||||
### AI-augmented review (2026)
|
||||
```bash
|
||||
# 매 Claude Code / Cursor 의 first pass
|
||||
claude review --diff main..HEAD --rules .claude/skybound-rules.md
|
||||
|
||||
# .claude/skybound-rules.md
|
||||
# - Flag any allocation in update / draw loops
|
||||
# - Flag Math.random() in sim code (must use seeded RNG)
|
||||
# - Flag hardcoded balance numbers (must be in DataConfig)
|
||||
```
|
||||
|
||||
### Telemetry hook
|
||||
```typescript
|
||||
function fireWeapon(w: Weapon, target: Entity) {
|
||||
const dmg = computeDamage(w, target);
|
||||
target.hp -= dmg;
|
||||
Telemetry.emit("weapon.fire", {
|
||||
weaponId: w.id, dmg, overclock: w.overclock,
|
||||
matchId: GameState.matchId, t: GameState.tick,
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Review focus |
|
||||
|---|---|
|
||||
| Sim / netcode | 매 determinism + seeded RNG |
|
||||
| Update loop | 매 allocation + cache miss |
|
||||
| Balance code | 매 cap enforcement + telemetry |
|
||||
| Save / persist | 매 version migration |
|
||||
| AI-gen asset | 매 validation gate |
|
||||
|
||||
**기본값**: AI first pass + human review on hot path / balance / determinism.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Code-Review]] · [[Game-Development]]
|
||||
- 변형: [[Skybound_Firepower_Overclock_v1.5]] · [[Skybound_Asset_Generation_Roadmap]]
|
||||
- 응용: [[Game-Performance]] · [[Deterministic-Simulation]]
|
||||
- Adjacent: [[AI-Augmented-Review]] · [[Telemetry]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: PR diff 의 first pass, pattern violation 의 detect, balance number 의 sanity check.
|
||||
**언제 X**: subjective game feel, designer intent — human only.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Math.random() 의 sim**: 매 replay 의 break.
|
||||
- **Frame allocation**: 매 GC spike → frame drop.
|
||||
- **Hardcoded balance**: 매 designer 의 iterate 의 X.
|
||||
- **Save without version**: 매 migration impossible.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Skybound internal review log, GDC perf talks).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Skybound code review checklist + patterns |
|
||||
|
||||
Reference in New Issue
Block a user