Skip to content

feat: troops & armies (existence phase, no combat) - #12

Merged
prayujt merged 2 commits into
mainfrom
feat/troops-armies
Aug 3, 2026
Merged

feat: troops & armies (existence phase, no combat)#12
prayujt merged 2 commits into
mainfrom
feat/troops-armies

Conversation

@prayujt

@prayujt prayujt commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Add troops and armies as a new 5th actor kind. Barracks train troops (4 tier-1 types) which spawn as armies at the barracks tile; armies carve out a capped military share of city population, add food upkeep to the nearest owned city, march tile-by-tile with 8-directional (Chebyshev) movement, and can merge when co-located. Combat is out of scope.

  • domain.Army + TroopType; constants troop stat table + barracks training capacity + MilitaryPopulationFraction
  • armies table (JSONB troops) with sqlc queries + write-behind flush
  • proto: ArmyId/TroopType, Army/TroopStack, EntityBag armies, ArmyService
  • army actor: create/get/move/merge/delete, movement ticker, nearest-city upkeep attribution, tile occupancy
  • barracks producer: FIFO per-barracks training queue + completion timer
  • city: MilitaryPopulation reserve/release, army upkeep map, civilian + army food upkeep in the food tick
  • tile army occupancy; stream/GetMap/StreamState army wiring; setup restore

Add troops and armies as a new 5th actor kind. Barracks train troops
(4 tier-1 types) which spawn as armies at the barracks tile; armies
carve out a capped military share of city population, add food upkeep
to the nearest owned city, march tile-by-tile with 8-directional
(Chebyshev) movement, and can merge when co-located. Combat is out of
scope.

- domain.Army + TroopType; constants troop stat table + barracks
  training capacity + MilitaryPopulationFraction
- armies table (JSONB troops) with sqlc queries + write-behind flush
- proto: ArmyId/TroopType, Army/TroopStack, EntityBag armies, ArmyService
- army actor: create/get/move/merge/delete, movement ticker, nearest-city
  upkeep attribution, tile occupancy
- barracks producer: FIFO per-barracks training queue + completion timer
- city: MilitaryPopulation reserve/release, army upkeep map, civilian +
  army food upkeep in the food tick
- tile army occupancy; stream/GetMap/StreamState army wiring; setup restore

@JJiang28 JJiang28 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ev script

GetArmy now bypasses the vision check when the caller owns the army, so a
player can always inspect an army they've marched out of sight (ListArmies
already returns all owned armies). Adds scripts/troops.py, a Connect
JSON-over-HTTP helper to exercise ArmyService locally without grpcurl.
@prayujt
prayujt merged commit 99123a1 into main Aug 3, 2026
2 checks passed
@prayujt
prayujt deleted the feat/troops-armies branch August 3, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants