---
id: wiki-2026-0508-skybound-protocol-코드리뷰
title: Skybound Protocol 코드리뷰
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Skybound Code Review, Skybound Protocol Review]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [skybound, code-review, game-dev, project]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: typescript
  framework: phaser/unity
---

# Skybound Protocol 코드리뷰

## 매 한 줄
> **"매 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.

## 매 핵심

### 매 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.

### 매 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).

## 💻 패턴

### 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;
  }
}

// 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;
  }
}
```

### 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;
  }
}

// 매 sim 의 single seeded RNG — 매 Math.random() X
const rng = new XorShift(matchSeed);
```

### 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.
```

### Save versioning
```typescript
interface SaveV2 { version: 2; player: Player; inventory: Item[]; flags: number[]; }

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}`);
}
```

### 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]]
- 변형: [[Skybound_Firepower_Overclock_v1.5]] · [[Skybound_Asset_Generation_Roadmap]]
- Adjacent: [[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 |
