164 lines
5.5 KiB
Markdown
164 lines
5.5 KiB
Markdown
---
|
|
id: wiki-2026-0508-sector
|
|
title: Sector
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Map Sector, Zone, Region, Hex]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [game-design, world-design, mmo, territorial-control]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: typescript
|
|
framework: 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)
|
|
```sql
|
|
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
|
|
```sql
|
|
-- 매 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
|
|
```typescript
|
|
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
|
|
```typescript
|
|
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
|
|
```typescript
|
|
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
|
|
```typescript
|
|
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
|
|
- 부모: [[4X 시스템 (4X System)]] · [[EVE 온라인]]
|
|
- 변형: [[Sector-Breach-Store]] · [[Sector-Breach-XP]]
|
|
- 응용: [[Alliances-and-Sector-Hegemony]] · [[Descendants-Sector-Control]]
|
|
- Adjacent: [[Procedural-Level-Geometry]] · [[War-Commander-Combat-Ecosystem]]
|
|
|
|
## 🤖 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 추가 |
|