v0.29.0: Per-region stat lever (regionChanges) + region-stat hover #48

Closed
opened 2026-10-15 03:07:17 +02:00 by kamilkrzywda · 0 comments
Owner

Summary

PR 2 of 2 for #46. Gives the LLM a fine-grained per-region stat lever (TurnResult.regionChanges) alongside the existing nation-wide stateChanges, and shows each region's own 4 stats in the map hover tooltip.

What changed

  • Protocol: New RegionStatChange type; required TurnResult.regionChanges (default []).
  • Engine: resolveRegionKey (key-first, case-insensitive name, ambiguous→null); validateRegionChanges (resolve refs, clamp set, drop invalid); applyTurnResult applies regionChanges after stateChanges, before the weighted-median recompute (unowned → no-op); isMeaningful includes regionChanges; system prompt + playerRegionStats in user payload.
  • Stub: regionChanges: [] (e2e unaffected).
  • Client: WorldMap hover shows the region's own 4 stats (placeholder when no entry); NationPanel unchanged.

Tests

New unit suites: resolveRegionKey, validateRegionChanges, applyTurnResult regionChanges, prompt contract, isMeaningful, stub. All 256 tests pass. Typecheck + lint + build green.

## Summary PR 2 of 2 for #46. Gives the LLM a fine-grained per-region stat lever (`TurnResult.regionChanges`) alongside the existing nation-wide `stateChanges`, and shows each region's own 4 stats in the map hover tooltip. ### What changed - **Protocol:** New `RegionStatChange` type; required `TurnResult.regionChanges` (default `[]`). - **Engine:** `resolveRegionKey` (key-first, case-insensitive name, ambiguous→null); `validateRegionChanges` (resolve refs, clamp `set`, drop invalid); `applyTurnResult` applies regionChanges after stateChanges, before the weighted-median recompute (unowned → no-op); `isMeaningful` includes regionChanges; system prompt + `playerRegionStats` in user payload. - **Stub:** `regionChanges: []` (e2e unaffected). - **Client:** WorldMap hover shows the region's own 4 stats (placeholder when no entry); NationPanel unchanged. ### Tests New unit suites: `resolveRegionKey`, `validateRegionChanges`, `applyTurnResult` regionChanges, prompt contract, `isMeaningful`, stub. All 256 tests pass. Typecheck + lint + build green.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/History#48