Scoring Engine
Complete reference for all scoring algorithms, formulas, and thresholds.
24,502
Star Systems
scored per cycle
5
Trust Dimensions
per player
6
CHI Sub-Indices
weighted composite
5
Alert Types
anomaly patterns
Consistency Guarantee
scoring.ts), the frontend live data module (liveData.ts), and the Sui smart contract (frontier_pulse.move). This ensures consistent scores regardless of which path produces them.System Health Scoring
Each of the 24,502 star systems receives a health snapshot. When real enrichment data (smart assemblies, killmails) is available from the World API, it drives the scores. Otherwise, a deterministic hash function provides consistent fallback scores.
Real Data Path
Inputs from World API enrichment:
| Input | Source | Description |
|---|---|---|
| playerCount | Smart Assemblies + Killmails | Unique player addresses active in system |
| infraCount | Smart Assemblies API | Number of deployed Smart Assemblies (gates, SSUs, turrets) |
| kills | Killmails API | Recent PvP kill count in this system |
// Step 1: Component scores (0-100 each)
playerScore = min(playerCount * 5, 100)
infraScore = min(infraCount * 3, 100)
combatScore = min(kills * 8, 100)
// Step 2: Activity Level — weighted blend
activityLevel = clamp(
playerScore * 0.4 + infraScore * 0.35 + combatScore * 0.25
)
// Step 3: Trust Level — inverse of combat ratio + infrastructure bonus
combatRatio = playerCount > 0 ? kills / playerCount : 0
baseTrust = clamp(100 - combatRatio * 50)
infraBoost = min(infraCount * 2, 20)
trustLevel = clamp(baseTrust + infraBoost)
// Step 4: Transaction Frequency — activity density proxy
txFrequency = clamp((playerCount * 3 + infraCount * 2 + kills) * 2)
// Step 5: Local CHI — 40% activity + 60% trust (trust-weighted)
localChi = floor((activityLevel * 40 + trustLevel * 60) / 100)players×0.4 + infra×0.35 + combat×0.25
100 - combatRatio×50 + infraBoost
activity×40% + trust×60%
Deterministic Fallback
When no enrichment data exists, a seeded hash function generates consistent pseudo-random scores from the system ID:
function hash(n: number): number {
let h = n ^ 0x5f3759df;
h = Math.imul(h ^ (h >>> 16), 0x45d9f3b);
h = Math.imul(h ^ (h >>> 13), 0x45d9f3b);
h = (h ^ (h >>> 16)) >>> 0;
return (h & 0xffff) / 0xffff; // → 0.0 to 1.0
}
// Same system ID always produces the same vitals:
activityLevel = floor(10 + hash(systemId) * 90) // 10-100
trustLevel = floor(15 + hash(systemId + 7919) * 85) // 15-100
playerCount = floor(hash(systemId + 15373) * 60) // 0-60
infraCount = floor(hash(systemId + 23197) * 20) // 0-20
txFrequency = floor(10 + hash(systemId + 31531) * 90) // 10-100
combatIncidents = floor(hash(systemId + 40343) * 12) // 0-12Player Reputation (Trust Compass)
Each player's on-chain activity is analyzed across 5 behavioral dimensions (0-100 each):
// Inputs from World API aggregation:
// assemblyCount — Smart Assemblies owned by this player
// killCount — Times this player was the attacker
// deathCount — Times this player was the victim
// systemsVisited — Unique systems with activity
totalCombat = killCount + deathCount
aggressionRatio = totalCombat > 0 ? killCount / totalCombat : 0
// 5 Dimensions:
reliability = clamp(40 + assemblyCount * 5 + systemsVisited * 2)
commerce = clamp(30 + assemblyCount * 8)
diplomacy = clamp(50 - aggressionRatio * 40 + systemsVisited * 3)
stewardship = clamp(20 + assemblyCount * 10)
volatility = clamp(totalCombat * 5 + |killCount - deathCount| * 3)Trust Compass Dimension Weights
Composite Trust Score
Weighted combination matching the on-chain formula:
composite = (
reliability * 25 +
commerce * 25 +
diplomacy * 20 +
stewardship * 20 +
(100 - volatility) * 10 // inverted: low volatility = good
) / 100Archetype Classification
First matching rule wins:
| Archetype | Rule | Description |
|---|---|---|
| Civilization Builder | stewardship ≥ 80 AND reliability ≥ 70 | Builds infrastructure for others |
| Trusted Trader | commerce ≥ 80 AND reliability ≥ 70 | Reliable economic participant |
| Diplomat | diplomacy ≥ 75 AND volatility < 30 | Brings people together peacefully |
| Warlord | volatility ≥ 70 AND commerce < 40 | Combat-focused, low trade |
| Wildcard | 50 ≤ volatility < 70 | Unpredictable behavior |
| Newcomer | default | Insufficient data for classification |
Civilization Health Index (CHI)
The global CHI aggregates all system health scores into a single composite (0-100) using 6 weighted sub-indices:
CHI Sub-Index Weights
// Inputs: all system health scores from current cycle
economicVitality = avg(txFrequency) * 0.6 + avg(infraCount * 5) * 0.4
securityIndex = clamp(100 - avg(combatIncidents) * 8)
growthRate = (systemsWithActivity>50 / totalSystems) * 100
connectivity = avg(activityLevel) * 1.1
trustIndex = avg(trustLevel)
socialCohesion = trustIndex * 0.4
+ securityIndex * 0.3
+ min(avg(playerCount) * 3, 100) * 0.3
// Weighted overall (matches on-chain):
overall = (
economicVitality * 20 +
securityIndex * 15 +
growthRate * 15 +
connectivity * 15 +
trustIndex * 20 +
socialCohesion * 15
) / 100Diagnosis Thresholds
| Score | Diagnosis | Meaning |
|---|---|---|
| ≥ 80 | Flourishing | Peak civilization — high activity, high trust, growing |
| ≥ 65 | Thriving | Strong and healthy, minor issues |
| ≥ 50 | Stable | Functional but not exceptional |
| ≥ 35 | Stressed | Cracks showing — trust or security concerns |
| ≥ 20 | Declining | Significant deterioration across metrics |
| < 20 | Collapsing | Civilization is failing |
Anomaly Detection
Each oracle cycle scans system scores against pattern rules. Alerts are emitted as on-chain events (not stored, for gas efficiency).
| Alert Type | Trigger Condition | Severity | On-Chain Code |
|---|---|---|---|
| Blackout | infra > 5 AND activity < 10 | Critical (0) | AnomalyAlertEmitted |
| Trust Collapse | trust < 20 AND players > 5 | High (1) | AnomalyAlertEmitted |
| Combat Hotspot | combatIncidents > 8 | Medium (2) | AnomalyAlertEmitted |
| Trade Spike | tx > 85 AND players > 20 | Warning (3) | AnomalyAlertEmitted |
| Infrastructure Hub | infraCount > 5 | Info (4) | AnomalyAlertEmitted |
liveData.ts also generates additional summary alerts (Population Center, Warzone, Civilization Core, Census Update) from aggregate statistics.Color Mapping
Trust scores map to a consistent color palette across all visualizations:
Trust Level Spectrum
// Trust colors (galaxy nodes, compass, badges)
trust >= 70 → green (#00ff88) // Healthy
trust >= 40 → orange (#ff9800) // Stressed
trust < 40 → red (#ff3d3d) // Hostile
// CHI gauge colors
score >= 70 → green (#00ff88)
score >= 50 → cyan (#00e5ff)
score >= 30 → orange (#ff9800)
score < 30 → red (#ff3d3d)
// Alert severity colors
critical → #ff3d3d | high → #ff6b35 | medium → #ff9800
warning → #ffca28 | info → #00e5ff