Files
2nd/10_Wiki/Topics/Game_Design/Sector.md
T
2026-05-10 22:08:15 +09:00

5.5 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-sector Sector 10_Wiki/Topics verified self
Map Sector
Zone
Region
Hex
none A 0.9 applied
game-design
world-design
mmo
territorial-control
2026-05-10 pending
language framework
typescript postgres-postgis

Sector

매 한 줄

"매 sector 의 territorial unit 의 atomic building block". 매 MMO/strategy game 의 world map 의 partition — ownership, contestation, resource yield, breach event 의 host. 매 EVE 의 system, Foxhole 의 region, Albion 의 cluster 의 abstraction.

매 핵심

매 정의

  • Spatial unit: hex / voronoi / grid cell — 매 game world 의 partition.
  • Properties: owner_alliance, tier, contested_pct, resource_pool, modifier_set.
  • State: contested | controlled | breach_active | locked.

매 핵심 mechanics

  • Ownership: alliance/guild flag — 매 capture 의 trigger.
  • Yield: tick-based resource generation — 매 owner 의 skim.
  • Breach: hostile entry 의 combat encounter trigger.
  • Modifier stack: weather, event, sabotage 의 buff/debuff.

매 응용

  1. Strategic map UI — 매 player decision 의 spatial primitive.
  2. Resource economy 의 spatial heterogeneity.
  3. Alliance war 의 territorial objective.

💻 패턴

Sector schema (PostGIS)

CREATE TABLE sector (
  id UUID PRIMARY KEY,
  name TEXT NOT NULL,
  geom GEOMETRY(Polygon, 4326) NOT NULL,
  tier SMALLINT NOT NULL CHECK (tier BETWEEN 1 AND 5),
  owner_alliance UUID REFERENCES alliance(id),
  contested_pct REAL NOT NULL DEFAULT 0,
  resource_pool JSONB NOT NULL DEFAULT '{}',
  state TEXT NOT NULL DEFAULT 'controlled',
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX sector_geom_gix ON sector USING GIST (geom);
CREATE INDEX sector_owner_idx ON sector(owner_alliance);

Adjacency query

-- 매 adjacent sector 의 lookup (touching polygons)
SELECT b.id, b.name, b.owner_alliance
FROM sector a
JOIN sector b ON ST_Touches(a.geom, b.geom)
WHERE a.id = $1;

Capture state machine

type SectorState = 'controlled' | 'contested' | 'breach_active' | 'locked';

export function transition(current: SectorState, event: string): SectorState {
  const table: Record<SectorState, Record<string, SectorState>> = {
    controlled:    { hostile_entry: 'contested' },
    contested:     { capture: 'controlled', breach_trigger: 'breach_active', timeout: 'controlled' },
    breach_active: { breach_resolved: 'contested', wipe: 'controlled' },
    locked:        { unlock: 'controlled' },
  };
  return table[current][event] ?? current;
}

Contestation tick

interface Sector {
  id: string;
  contestedPct: number;
  attackerForce: number;
  defenderForce: number;
}

export function tickContestation(s: Sector, dt: number): Sector {
  const delta = (s.attackerForce - s.defenderForce) * 0.0001 * dt;
  const next = Math.max(0, Math.min(1, s.contestedPct + delta));
  return { ...s, contestedPct: next };
}

Resource yield distribution

export async function distributeYield(sectorId: string) {
  const sector = await db.sector.findUnique({ where: { id: sectorId } });
  if (!sector?.ownerAlliance) return;
  for (const [resource, amount] of Object.entries(sector.resourcePool)) {
    await db.allianceVault.upsert({
      where: { allianceId_resource: { allianceId: sector.ownerAlliance, resource } },
      create: { allianceId: sector.ownerAlliance, resource, amount: amount as number },
      update: { amount: { increment: amount as number } },
    });
  }
}

Heat-map render data

export async function sectorHeatmap(layer: 'contestation' | 'tier' | 'wealth') {
  const rows = await db.$queryRaw<{id: string; geom: any; v: number}[]>`
    SELECT id, ST_AsGeoJSON(geom) as geom,
      ${layer === 'contestation' ? 'contested_pct' : layer === 'tier' ? 'tier' : "(resource_pool->>'thorium')::float"} as v
    FROM sector
  `;
  return rows.map(r => ({ id: r.id, geometry: JSON.parse(r.geom), value: r.v }));
}

매 결정 기준

상황 Approach
매 small map (<100 sectors) Hex grid + manual tuning.
매 large open world Voronoi 의 organic look — but harder pathfinding.
매 hardcore PvP Open contestation + breach on entry.
매 PvE 중심 Locked tiers + scheduled breach windows.

기본값: Hex grid + tier-based yield + state machine + PostGIS spatial index.

🔗 Graph

🤖 LLM 활용

언제: sector-name generation, lore stub 의 batch 생성, balance 의 simulation prompt. 언제 X: 매 spatial query (PostGIS deterministic).

안티패턴

  • No state machine: 매 ad-hoc boolean flags — race condition + bug surface.
  • Uniform tier: 매 strategic depth 의 부족 — map 의 flat feel.
  • Owner-only yield: 매 contesting alliance 의 compensation 없음 — passive farming meta.

🧪 검증 / 중복

  • Verified: EVE Online sovereignty mechanics, Foxhole region system, Albion Online cluster design.
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — sector schema + PostGIS + state machine 추가