Game Design Document · Living Document

Heroes of the
Seventh Year

A Wall Defense & Generational Strategy Game
⚔ ✦ ⚔
Version 0.9  ·  Sprint 1 Complete · Sprint 2 Design · World & Culture · Off Season Detail · Class Specialization · Surprise Tactics · Code Audit Corrections
I

Premise & Setting

The player commands the defense of a great wall — the most critical barrier between the kingdom and the forces that would destroy it. Appointed by the king himself, the player holds the second most powerful position in all the realm.

Every year, a new cohort of volunteers arrives at the wall. These are not conscripts — they are ambitious men and women who see service as a path to upward mobility in a world with few such opportunities. The promise is simple: survive and defend for seven years, and you return home a hero. Many will die. A rare few will become legends.

Design Intent The volunteers are not desperate souls — they are people betting on themselves. This gives their deaths weight and their survival meaning. Players should feel both invested in their soldiers and resigned to their loss.

The wall is described as vital to the kingdom's survival. The king has a vested interest in its success and will intervene with additional resources when things go badly — but no resource drop replaces the loss of battle-hardened veterans.

· · ·
II

World & Culture

Geography & Isolation

The kingdom occupies a valley entirely enclosed by impassable mountains. There is one way in and one way out — the valley mouth, where the wall stands. There is no outside world to flee to, no distant ally to call upon, no alternative. The people have always known this. It shapes everything about how they live and what they value.

The kingdom is predominantly agrarian — farmers, herders, and small-holders working land that has been in families for generations. The only settlement of any size is simply called the City. A small middle class of traders, merchants, and craftspeople operates primarily there. The nobility is tiny and largely ceremonial; real power flows from the king and the wall.

Tone

The world is grim but not hopeless. The threat of the raiders is not an abstraction — everyone understands that if the wall falls, the kingdom ends. This understanding sits quietly in the back of every citizen's mind from childhood onward. It does not paralyze them. It makes them serious.

Design Intent The grimness should feel earned and lived-in, not decorative. Characters don't despair — they work, they train, they hope their children won't have to. The wall is not a symbol of fear. It is a symbol of survival and pride.

The Wall in the Cultural Psyche

The wall is the single most important structure in the kingdom — militarily, economically, and psychologically. Every citizen grows up knowing what it is and what it means. Parents tell children about the wall before they can read. Tavern songs recount famous battles. The raiders are referred to simply as the enemy, the invaders, or — in stories told to children — the monsters. They have no other name. They need none.

Adolescents who show promise train and apprentice with the explicit hope of one day qualifying as recruits. Service at the wall is the most direct path to meaningful social advancement in a society with few such paths. To be selected is already an honor.

Seven-Year Heroes

Recruits who survive seven full years of service and are released honorably are known as heroes — not as a courtesy title, but in the fullest sense the culture understands the word. They return home to land grants and property deeds from the crown. Their names are known everywhere. Children ask to hear their stories. Taverns hang their names on the wall. They are the living proof that the wall can be held and that ordinary people can become extraordinary ones.

This hero culture is not incidental — it is the kingdom's primary mechanism for maintaining morale and a steady supply of volunteers across generations. Without it, the wall would not stand.

Key Figures

FigureRoleNotes
King AldricRuler of the kingdomA former wall commander himself. His authority is genuine and his understanding of the wall's needs is firsthand. He appointed the player personally.
The Commander (player)Wall commanderA former seven-year hero, recalled to service and appointed by Aldric. Holds the second most powerful position in the realm. Name supplied by the player at game start.

The Enemy

The forces that assault the wall are referred to as the raiders or the invaders. They have no known name, civilization, or recorded history in kingdom lore — only the pattern of their attacks and the destruction they leave behind. To children they are simply called the monsters. No recruit has ever returned from behind enemy lines. No one knows what lies beyond the valley mouth except death.

Flavor System

Each recruit receives a bespoke bio and greeting organized by gender (M/F) and age (young/old). Approximately 250 bespoke bios are planned, targeting meaningful emotional investment in individual soldiers. This system is in progress.

· · ·
III

Core Gameplay Loop

The game is structured as a series of years. Each year consists of exactly two phases: an Off Season and a Battle. The game runs for 10, 20, or 30 years depending on chosen difficulty.

Phase One

The Off Season

Resource allocation, building construction and upgrades, recruit development, intelligence gathering, and repair of damage from the previous battle. The bulk of long-term strategic decisions happen here.

Phase Two

The Battle

Enemies assault the wall. Combat is largely automated (auto-battler style), with the player making key tactical decisions: initial deployment, timing of reserve deployment, choosing which wall section to reinforce or sortie into, and adjusting targeting preferences mid-battle.

Recruits cycle through multiple generations over the course of the game. Players will outlast several cohorts of soldiers, which creates tension between emotional attachment and strategic detachment.

· · ·
IV

The Off Season

The off season is a pure resource allocation phase — not a spatial building or city-management sim. Players decide how to spend their gold across competing priorities. The phase is structured as a linear wizard with Next and Previous buttons, allowing unidirectional progress while preserving the ability to revisit prior decisions. Gold is spent first, then recruits arrive, then deployments are set.

Gold Economy

Each off season the player receives:

Design Intent Gold income naturally scales with how badly you were hurt. A clean victory gives you 100–200 gold to invest depending on the year's tax roll. A rough year where you took 300 HP of wall damage gives you 400–500 gold — enough to repair and still build. This keeps the game recoverable without making losses feel trivial, since no amount of gold replaces lost veterans.

Recruit Arrival

After all gold is spent, new recruits arrive to fill every empty housing slot across all buildings. The composition is random but skewed to balance the current roster:

Off Season Priorities

CategoryExamplesTrade-off
Wall RepairsRestore damaged wall segmentsInstant repair; Mason capacity limits total HP restored per off season (50 HP per Mason)
Wall UpgradesIncrease wall level per segmentHigher HP and damage reduction bonus for on-wall units
Building ConstructionBarracks, Library, Artisan WorkshopUnlocks new unit types and increases capacity
Building UpgradesLevel up Archery Range, Mage Workshop, etc.Improves unit effectiveness — attack speed, armor, damage
Retention & LoyaltyMonument, veteran stipendsIncreases chances heroes stay past year seven
IntelligenceScout AcademyAdvance knowledge of enemy composition before battle

Off Season Wizard Flow

The off season proceeds as a multi-step wizard. Players navigate with Next and Previous buttons. State is preserved when going back — no choices reset unless explicitly changed. Each step is described below.

Step 1

Honoring the Fallen

Presents all soldiers who died in the most recent battle. See Section V for full specification. Skipped if no soldiers died.

Step 2

Honoring New Seven-Year Heroes

Presents all soldiers who completed their seventh year of service. See Section V for full specification. Skipped if no soldiers reached hero status this year.

Step 3

Gold Summary

Displays the player's current gold total: carryover from the prior season plus any new gold earned from wall damage. Breakdowns for base income, missing-HP bonus, and destroyed-segment bonus are shown separately. This is an informational screen — no choices are made here.

Surprise Tactic Award (Year 2+): The king awards one Surprise Tactic per year, delivered at this step. The flavor text frames it as the king sending one of his generals to train the wall units — with wording that acknowledges last year's battle outcome. The awarded tactic is added to the player's stockpile (maximum 3). If the stockpile is already full, no new tactic is awarded. Year 1's battle begins with no tactics available. See Section VIII-C — Surprise Tactics for the full tactic list and battle mechanics.

Step 4

Wall & Building Investment

The player's full investment screen. Displays the wall in its current state across all three segments (HP, level), alongside the complete building list. Players can spend gold on:

  • — Wall repairs (instant; Mason capacity shown as a constraint)
  • — Wall upgrades per segment
  • — New building construction
  • — Building level upgrades

Buildings the player cannot yet afford or lacks prerequisites for are displayed in a grayed-out state with their prerequisite listed. Current gold total is always visible. Spending decisions are reflected immediately in the running total.

Step 5

Confirm Spending

A confirmation dialogue summarizing all spending choices made in Step 4. The player is reminded that their building decisions will determine which recruit classes arrive at the wall. Confirming here triggers recruit generation. The player can go back to revise spending before confirming.

Step 6 (conditional)

Training & Specialization

Shown when any of the following are true: a unit leveled up during the last battle; a staying veteran's XP bonus caused a level-up; a unit has a pending Level 3 specialization choice. If veterans are on the roster but their XP caused no level-ups and no specialization choices are pending, this step is skipped.

The screen shows three categories of information:

  • Battle Level-Ups — All units that gained a level during the last battle, shown with their old and new level (e.g. "Elara: L2 → L3").
  • Veteran XP — A summary line indicating how many staying veterans awarded XP and to whom, followed by any level-ups that resulted.
  • Specialization Choices — Choice cards for every unit that has reached Level 3 without a specialization. The player must resolve all pending choices before advancing.

Veteran XP (1 XP per staying veteran, awarded to all roster units each off season) is applied at the start of this step. The Hero Departures step (Step 2) handles only the year-7 ceremony — XP distribution happens here.

See Section VIII-B — Class Specialization for full specialization rules.

Step 7

Units & Deployment Assignment

The core personnel management screen. Displays all soldiers — existing roster plus newly arrived recruits — in a single sortable, filterable table. Filter and sort state persists for the duration of this off season and resets at the start of the next.

Table Columns: Name · Class · Year of Service · Level · Assignment

New recruits are visually highlighted (e.g., a distinct row color or badge) to distinguish them from returning soldiers. Each row has a detail button that opens a character sheet. The character sheet opens with the soldier's portrait and a greeting in the format: "Commander [playername], [greeting]" — where the greeting is selected randomly from the pool matching the soldier's class and current year of service. Below the greeting, the sheet shows the soldier's bio and full stats.

The Assignment column is a dropdown per row. Every combatant (all classes except Mason and Scout) must be assigned to one of six deployment groups before the player can proceed:

  • — Wall Left  ·  Wall Center  ·  Wall Right
  • — Reserve Left  ·  Reserve Center  ·  Reserve Right

Assignment choices persist year to year. Only new recruits arrive without assignments — returning soldiers carry their prior assignment forward as the default, which the player can change. Empty groups are permitted. If any group exceeds its hard capacity, a popup warning is shown. Warriors and Captains may only be assigned to reserve groups (enforced by the dropdown — wall options are disabled for these classes).

The player cannot advance to the next step until every combatant has an assignment.

Step 8

Deployment Preview

A visual representation of the upcoming battle deployment based on the assignments set in Step 7. Shows all wall units in position across the three wall sections, and all reserve units staged in their respective reserve zones, mirroring the battle map layout. The player can review the composition visually and go back to Step 7 to revise assignments if needed. Proceeding from here advances to the scout phase (if applicable) or ends the off season.

Step 9 (conditional)

Scout Deployment

Shown only if the player has one or more Scouts available. The player chooses whether to send Scouts out this year. If yes, results are returned after a brief delay (~3 seconds):

  • Success (60%) — Enemy composition revealed. Player may return to Step 7 to revise deployments in light of the intel.
  • Fail (30%) — Scouts found nothing. No intel gained.
  • Captured (10%) — Scout is permanently removed from the roster.

If intel is successfully returned, the player is given the option to go back to Step 7 to revise assignments before proceeding. The Deployment Preview (Step 8) is shown again after any revision.

Character Generation

Recruit generation is triggered after building choices are confirmed in Step 5. The full rules governing class distribution, name assignment, portrait allocation, and bio selection are documented in Section VI — Recruit Generation Rules.

· · ·
V

Honoring the Fallen & Heroes

The off season does not begin with gold counts or building menus. It begins with the dead, and then with the heroes. This is the cultural spine of the kingdom made tangible — the moment the player is asked to hold, however briefly, what the last battle actually cost and what it produced.

The two ceremonies are sequential and separate. Steps 1 and 2 of the off season wizard. Each is skipped automatically if there is nothing to show.

Design Intent These screens exist to create weight. A soldier who dies as a number in a battle log costs nothing emotionally. A soldier whose portrait appears one final time, whose name the Commander reads aloud, whose years of service are recorded — that soldier costs something. The hero ceremony works the same way in the other direction: completion should feel earned, not merely tallied.

Part One — The Fallen

The first screen of every off season (except Year 1, when there has been no prior battle) presents all soldiers who died in the most recent battle as a list. If no soldiers died, this screen is skipped entirely.

Screen Layout

Roll Call of the Fallen

All fallen soldiers are displayed together as a list — not one at a time. Each entry in the list shows the soldier's portrait (at standard size), full name, class, and years of service at time of death.

The list is sorted by years of service, highest to lowest. Ties are broken alphabetically by name.

At the bottom of the list, the Commander's closing line is displayed:

"Let us all take a moment of silence to remember their sacrifice for the kingdom."

The button to advance to the next stage of the off season appears after that line.

Design Intent Sorting by years of service puts the most experienced fallen soldiers first — the ones the player has lived with longest. Veterans who die after six years of service are shown before first-year recruits. The list format lets the player take in the full scope of the loss at once, rather than being forced through it one soldier at a time.

Part Two — The Heroes

Immediately following the fallen ceremony (or opening the off season directly if no one died), the game presents any soldiers who completed their seventh year of service. A soldier who survived their seventh battle is a hero by right. If no soldiers reached hero status this year, this screen is skipped entirely.

Screen Layout

The Hero Departures

All seven-year heroes are displayed together as a list. Each entry shows the soldier's portrait (at standard size), full name, class, and an indication of their outcome — departed or staying.

Each hero has a 25% chance to stay and help train others, and a 75% chance to depart as a hero. Both outcomes count toward the Monument bonus. The outcome is determined at the moment this screen renders and is shown directly on each hero's entry.

The Hero Departures step covers only the year-7 ceremony and retention outcome. The XP bonus that staying veterans award to the roster each off season (1 XP per staying veteran) is applied and displayed in the Training & Specialization step (Step 3), not here.

Heroes who depart show:

"[Name]. [Class]. Seven years of service. A hero of the realm."

Heroes who stay show:

"[Name]. [Class]. Seven years of service. A hero of the realm — and they are staying."

Heroes who stay transition immediately into the active roster as super units. Each staying hero grants every unit on the roster 1 XP per off season for as long as they remain.

The player advances to the gold summary when ready.

Design Intent The hero ceremony is not a reward screen. It is a departure. The wall is losing one of its best soldiers — someone the player has watched grow from a new recruit, someone who has survived battles others did not. The tone should carry that ambivalence: pride in what they achieved, and the quiet cost of losing them. Heroes who stay resolve that tension differently — and should feel like a genuine gift.
· · ·
VI

Recruit Generation Rules

New recruits are generated at the moment the player confirms their building and spending choices (Off Season Step 6). Every empty housing slot across all buildings is filled. The process follows a strict sequence: determine class distribution first, then generate each individual recruit in that class.

Step 1 — Determine Total Incoming Recruits

Count empty housing slots across all buildings after spending is confirmed. Each empty slot produces exactly one recruit. Slot counts are building-type-specific:

Step 2 — Determine Class Split (Barracks & Library)

For buildings that house two classes (Barracks: Warriors/Archers; Library: Mages/Healers), incoming recruits are distributed using a roster-balancing algorithm. Each pairing is calculated independently.

Algorithm: The goal is an even final split within that building's total capacity, ±1 unit per type. Count the current number of living soldiers of each class within the pair. Determine how many of each class are needed to reach an even split of the building's total capacity. Assign the incoming recruits accordingly. The result is that after recruits arrive, each class occupies between (capacity/2 − 1) and (capacity/2 + 1) slots. The same logic applies independently to Mages vs Healers within Library slots.

Design Intent Hard rebalancing feels like the game overriding the player's losses. A soft nudge respects the reality of attrition while gently steering the roster toward a functional composition. Extreme imbalances correct over time — which creates an interesting strategic pressure in years following heavy casualties in a single class.

Step 3 — Generate Each Recruit

Once class counts are determined, each recruit is generated individually in sequence. Portrait is assigned first because the portrait pool is divided by gender and age — drawing a portrait determines those attributes, which then drive name and bio selection.

Attribute 1

Portrait

The recruit's class (from Step 2) determines which portrait category to draw from: Warriors, Archers, and Captains draw from the warrior portrait pools; all other classes (Mage, Healer, Engineer, Mason, Scout) draw from the nonwarrior pools.

A portrait is selected randomly from all available portraits across all gender and age sub-pools within that category. The gender and age of the drawn portrait then determine the recruit's gender and age category for all subsequent attribute generation.

PoolFilesNaming
Warrior / Male / Old7warrior_male_old_portrait1–7.png
Warrior / Male / Young44warrior_male_young_portrait1–44.png
Warrior / Female / Old4warrior_female_old_portrait1–4.png
Warrior / Female / Young55warrior_female_young_portrait1–55.png
Nonwarrior / Male / Old31nonwarrior_male_old_portrait1–31.png
Nonwarrior / Male / Young14nonwarrior_male_young_portrait1–14.png
Nonwarrior / Female / Old16nonwarrior_female_old_portrait1–16.png
Nonwarrior / Female / Young41nonwarrior_female_young_portrait1–41.png

Deck-draw rules: Each portrait is unique among all living soldiers at any given time. Once assigned, it is removed from the available pool. Portraits are never returned to the pool mid-playthrough — not on death, not on hero departure. Only when the entire pool for that category (warrior or nonwarrior) is fully exhausted do portraits from dead or departed soldiers re-enter the pool. The full deck resets at the start of each new playthrough.

Attribute 2

Gender & Age Category

Both are derived directly from the portrait drawn in Attribute 1. No separate random roll is made. Gender drives first name pool selection and bio pool selection. Age category drives bio pool selection only.

Attribute 3

First Name

Selected randomly from the gender-appropriate first name pool. The pool contains 50 male names and 50 female names drawn from Anglo-Saxon and Northern European traditions. No uniqueness check is applied to first names alone — the uniqueness constraint is on the full name combination.

Male pool (50 names): Aldric, Bjorn, Calder, Dagmar, Edrik, Falko, Gunnar, Halvard, Ingvar, Jorvik, Knut, Leif, Magnus, Njord, Oskar, Ragnar, Sigurd, Torsten, Ulfric, Valdis, Wulfgar, Yorick, Alaric, Bertram, Cormac, Draven, Einar, Finn, Godwin, Harald, Ivar, Jokull, Kettil, Lothar, Morven, Norbert, Olaf, Peder, Quindar, Rodrik, Sven, Thane, Ulrik, Vidar, Wulfric, Xander, Yngvar, Zoran, Asmund, Brandr

Female pool (50 names): Astrid, Brynhild, Dagny, Eira, Freya, Gudrun, Helga, Ingrid, Jorunn, Kari, Lofn, Maren, Nora, Oddny, Petra, Ragnhild, Sigrid, Thyra, Ulfhild, Ragnvor, Wulfwyn, Ylva, Alva, Bodil, Cerwen, Drifa, Embla, Frida, Gunnhild, Hilda, Idunn, Jora, Katla, Liv, Marta, Nanna, Olrun, Runa, Signe, Thora, Unn, Vigdis, Wulfrun, Yrsa, Solveig, Bergljot, Catriona, Dalla, Estrid, Finna

Attribute 4

Last Name

Selected randomly from the class-appropriate surname pool. Each class has 25 surnames. After selecting a last name, the full name (first + last) is checked against a per-playthrough set of all names ever generated. If the combination has been used before, re-roll the last name only (not the first name) until a unique combination is found. If all 25 last names for that class have been exhausted in combination with this first name, re-roll the first name and repeat.

ClassSurname ThemeExample Names
WarriorMartial, battle-hardenedIronhelm, Grimwall, Stonefist, Hammerfall, Ravenbrow
ArcherPrecision, distance, natureTrueshot, Eagleeye, Swiftflight, Hawkgaze, Longdraw
MageArcane, ethereal, elementalRuneborn, Ashenveil, Frostmantle, Grimrune, Shadowtongue
HealerGentle craft, herb and handGentlehand, Brightbalm, Mosswick, Dawntouch, Willowmend
CaptainCommand, honor, orderGoldmantle, Crownward, Bannerborn, Ironward, Valorhelm
EngineerCraft, mechanism, structureStonethrower, Ironwright, Cogsworth, Forgewise, Timberfall
MasonStone, mortar, building tradeStonewright, Mortarborn, Wallward, Hammerstone, Keystoneborn
ScoutRanging, stealth, terrainShadowstep, Farwalker, Quietfoot, Windreader, Mistwalker
Attribute 5

Bio

Selected from a pool of 256 complete bios organized by gender (male/female) and age category (young/old), giving four sub-pools of 64 bios each. One bio is selected at random from the appropriate sub-pool. Bios are not tracked for uniqueness — the same bio may appear on multiple recruits across a long playthrough. Each bio is a self-contained paragraph describing the recruit's background, motivation, and character.

Sub-poolCount
Young Male64 bios
Young Female64 bios
Old Male64 bios
Old Female64 bios
Attribute 6

Starting Stats

All recruits begin at Level 1 with base stats as defined in Section VIII — Unit Archetypes. Year of Service is initialized to 0 and increments to 1 after their first battle. XP begins at 0.

Greetings

Each soldier has a greeting drawn from a data table keyed by class × year of service (years 1–7). The greeting is selected randomly from the pool matching the soldier's current class and current year of service. A new greeting is selected each off season — it is not fixed at generation time.

Greetings are displayed on the character detail screen (accessed from the Personnel table in Step 7) in the format:

"Commander [playername], [greeting]"

The greeting pool covers all eight classes across all seven years of service. Year 1 greetings reflect the uncertainty and ambition of a new recruit; later years reflect the weight of experience and survival. The same pool is used regardless of gender or age.

Generation Order & Edge Cases

ConditionHandling
No empty slots (roster full)No recruits generated this year
Building constructed this yearAll slots from the new building are treated as empty; recruits fill them normally
Officer Academy at cap (5 Captains living)No Captain slots generated regardless of building level
All first+last combinations exhausted for a classEdge case — practically impossible with 50 first names × 25 last names = 1,250 combinations per class. No handling required.
Portrait pool exhausted mid-generationAll portraits in that category (warrior or nonwarrior) have been assigned. No dead soldiers' portraits are returned until the pool is fully exhausted — at that point all portraits from dead and departed soldiers re-enter the pool.

Year of Service Tracking

Year of Service is a persistent integer on each soldier object, incremented at the end of each battle they survive. A soldier who arrives at the start of Year 3 and survives through Year 9 has 7 years of service and becomes a hero at the end of Year 9's off season ceremony. The wall's promise is seven survived battles — not seven calendar years of enrollment.

· · ·
VII

The Battle Phase

Each year brings one battle. The wall is divided into three sections. Units assigned to a wall section cannot move during battle — they hold their ground. Warriors and Captains are never assigned to wall sections; they are always held in reserve. The player's real-time tactical decisions come from managing reserves and adjusting targeting preferences.

Map & Wall Layout

The battlefield is 12 tiles wide × 16 tiles tall, rendered at 46 pixels per tile (canvas: 552 × 736 px). The wall sits at row 11 (0-indexed from the top), giving approximately 10 rows of enemy approach space and 4 rows of player territory behind the wall.

SectionTile WidthNotes
Wall Left4 tiles (cols 0–3)Outer edge — often targeted for flanking attacks
Wall Center4 tiles (cols 4–7)Prime ranged position; highest enemy traffic
Wall Right4 tiles (cols 8–11)Outer edge — often targeted for flanking attacks

Wall Protection

The wall is a barrier with HP. Enemies cannot reach player units until the wall is breached (HP reaches zero). Only ranged enemies (Goblins, Catapults) can damage player units directly while the wall stands. Goblins cannot damage the wall itself — they are purely a unit-killing threat.

Melee enemies (Orcs, Ogres, Generals) attack the wall directly. Catapults deal AoE damage that hits both wall HP and player units on the wall; AoE splash does not affect units currently standing on the wall (the wall provides cover).

The wall grants a damage reduction bonus to all player units on it equal to 1% per foot of wall height:

Wall LevelHeightDamage Reduction BonusWall HPUpgrade Cost
110 ft+10%200100
220 ft+20%300200
320 ft+20%400300
430 ft+30%500400
530 ft+30%600500

When the wall falls, all units on it drop to ground level and lose the damage reduction bonus. Breaching enemies then target the nearest ground unit. Engineers and reserve units on the player side become valid targets after any breach.

Targeting Rules

Player Units

UnitDefault Targeting Priority
Warrior / CaptainNearest enemy
ArcherFurthest enemy in range; nearest if none in range
EngineerNearest Catapult in range (highest priority); else largest enemy clump within AoE radius; nearest if none in range
MageNearest elite (Ogre / General / Catapult) in range; else furthest in range
HealerLowest HP% friendly within 2 tiles (heal only — attacks nearest enemy in melee range)

Enemy Units

UnitDefault Targeting Priority
Orc / Ogre / GeneralNearest wall section; on breach (or player unit crosses wall), nearest player unit
GoblinFurthest player unit in range; advances until in range
CatapultNearest wall section (same as melee); on breach (or player crosses wall), furthest player unit in range

Enemy targeting override: if any wall is breached or any player unit crosses into enemy territory, all wall-targeting enemies switch to targeting the nearest player unit instead. This reverts to wall-targeting if neither condition holds.

Targeting Preferences (Player Control)

Players can override default targeting for three groups via dropdowns displayed below the battle canvas. Preferences are saved to localStorage and persist between sessions.

GroupUnits AffectedOptionsNotes
MeleeWarrior, CaptainDefault, Orc, Goblin, Ogre, General, CatapultDefault = nearest enemy
RangedArcher, MageDefault, Orc, Goblin, Ogre, General, CatapultOverrides Mage elite-priority when set
SiegeEngineerDefault, Orc, Goblin, Ogre, General, CatapultDefault = furthest in range

Healer is excluded from targeting preferences — it targets friendly units for healing, not enemies.

Battle Start — Countdown

Each battle begins with a 3–2–1–FIGHT! countdown (1 second per number, 0.7 seconds for "FIGHT!"). The game loop is frozen during the countdown so the player can review and adjust targeting preferences before combat begins.

Slow Motion

A Slow Mo checkbox appears to the right of the targeting controls. When enabled, game time runs at 25% speed. Useful for studying unit behavior and making deployment decisions under pressure. State persists between sessions alongside targeting preferences.

Surprise Tactics

If the player has any tactics stockpiled, a button strip appears below the targeting controls bar. Each available tactic is shown as a button with a distinct icon and label. Buttons are visible from the start of the battle. Activating a tactic consumes it immediately — the button is removed and the effect fires at once. The strip is hidden if the stockpile is empty. See Section VIII-C — Surprise Tactics for full effect descriptions.

Year Win Condition — Enemy Retreat

Enemies retreat (rout) when all Ogres, Generals, and Catapults are dead AND remaining enemy count is below 50% of the year's starting total AND player units outnumber remaining enemies. Retreating enemies run toward the top of the screen and can still be attacked as they flee. The round ends when either:

When rout triggers, all mobile player units (non-stationary, non-reserve) are released from any hold orders so they can give chase, including reinforce-hold warriors waiting behind the wall.

Enemy Compositions

Each year has 3 possible enemy composition variations (options A, B, C) randomly selected at the start of battle. Compositions are defined per year in src/data/compositions.js and include lane assignments, reserve slots, deployment logic, and a scouting report string. Years 1–3 are fully defined; remaining years use a placeholder stress test until authored.

Reserve System

Three reserve slots exist on both the player side (rows 14–15) and enemy side (rows 0–1). Reserve units are inert until deployed — they are skipped by targeting, movement, and attack logic and cannot be targeted by the opposing side.

ParameterValue
Slots per side3 (Left, Center, Right — aligned with wall sections)
Capacity per slotUp to 25 units
Player reserve zoneRows 14–15 (blue highlight)
Enemy reserve zoneRows 0–1 (red highlight)

Player Reserve Deployment

Pre-assigned before battle, deployed via an in-battle Deploy button. Tapping Deploy opens a 2-row selection grid:

RowOptionsBehavior
SortieLeft · Center · RightUnits advance through the wall into enemy territory; normal targeting applies
ReinforceLeft · Center · RightArchers, Mages, and Healers move to just behind the chosen wall section and engage enemies normally. Warriors and Captains advance to behind the wall and hold until breach or rout, then fight freely.

Deployment is one-way — there is no recall. All undeployed player reserves are automatically released on wall breach.

Enemy Reserve Deployment

Enemy reserves deploy based on per-composition logic:

Alarm condition: if any player unit crosses into rows 0–7 (deep enemy territory), all undeployed enemy reserves release immediately.

Engineer Placement

Engineers are stationary and deployed on the player side of the wall (row 12), not on the wall itself. Their range of 11 tiles covers nearly the full map length, allowing them to fire trebuchet-style over the wall at enemies on approach.

Elite Enemy Kill Announcements

When an Ogre, General, or Catapult is destroyed, a kill announcement displays on screen identifying the player unit that landed the killing blow. Killing blow XP for these units is tripled (6 XP).

Design Intent Elites are rare, scary, and satisfying to kill. The announcement and XP bonus make bringing one down feel like a genuine accomplishment — and give players a reason to care about who lands the final hit.

Combat Resolution

Combat is auto-battler style. Each unit follows its targeting rules and behavior patterns; outcomes are driven by matchups, levels, positioning, and building bonuses. The player controls deployment, timing, and targeting preferences — not individual unit actions.

Battle Outcomes

OutcomeResult
Complete SuccessWall holds, minimal casualties, full off-season budget available
Partial LossWall holds but damaged; repair costs eat into next year's budget
Total WipeAll player units dead — game over
· · ·
VIII

Unit Archetypes

Recruits arrive as generalists and specialize based on buildings available. Each archetype is enabled by a corresponding building. Without the building, that unit type cannot be recruited or developed. Attack speed values are given as seconds per attack; the floor is 0.5s regardless of bonuses.

Combat Unit Stats

UnitHPDMGAtk SpeedRangeArmorLvl Up HP/DMGSpecial
Warrior2052s120%+10 / +3Reserve only — never assigned to wall
Archer1032s510%+5 / +2
Mage775s70%+3 / +10Ignores target armor entirely
Healer1035s110%+5 / +1Heals lowest-HP% friendly within 2 tiles to full; fires on first injured ally immediately, then 10s cooldown. Earns 1 XP per 50 HP healed.
Captain2552s120%+15 / +3+25% DMG aura to all friendlies within a 1.5-tile radius circle (additive). Reserve only — never assigned to wall.
Engineer101510s1110%+5 / +10AoE damage; stationary behind wall at row 12; trebuchet-style range covering nearly full map width

Noncombatant Units

UnitRoleNotes
MasonWall repair & constructionRepairs or builds 50 HP of wall damage per Mason per off season
ScoutPre-battle intelligence60% success, 30% fail, 10% permanently captured. Reveals enemy composition when successful.

Visual Indicators

Units within the aura radius of a friendly Captain or enemy General display a dim gold border (postFX glow). This helps players immediately identify which of their units are receiving the damage bonus — and which enemy units are benefiting from a General's presence. The gold glow is temporarily replaced by a blue glow when a Healer heals a unit.

Fully Developed Stats (Level 5, All Buildings Maxed)

For reference — reaching this state requires significant long-term investment across multiple building trees.

UnitHPDPS (base)DPS (fully boosted)Notes
Warrior608.5~51.0Sparring Ground + Weaponsmith + Monument. 55% armor.
Archer305.5~33.0Archery Range + Weaponsmith + Monument. 45% armor.
Mage199.4~23.5Mage Workshop + Monument. Ignores all target armor. Squishy.
Healer301.4~1.4Offensive DPS negligible — value is healing output.
Captain858.5~51.0+25% DMG aura within 1.5-tile radius. Max 5 Captains total.
Engineer305.5~5.8AoE — effective DPS much higher vs grouped enemies. Range 11.
Balance Note High DPS ceilings are intentional but gated behind major building investment. Enemy armor scales with year number, keeping Mages essential throughout the campaign and preventing Warriors and Weaponsmiths from trivializing late-game battles. Weaponsmith damage bonus is applied before the Captain aura calculation.

Experience & Deployment Risk

Units earn XP through combat actions. A killing blow awards 2 XP; an assist (minimum 30% of target HP dealt) awards 1 XP; taking damage awards 1 XP (awarded to surviving units at battle end); Healers earn 1 XP per 50 HP healed. Killing blow XP is tripled (6 XP) when the target is an Ogre, General, or Catapult.

On each level-up, a unit also randomly gains either +1–3 bonus HP or +1–3 bonus DMG (50/50 chance). This bonus is permanent and stacks with the fixed per-level stat increases shown in the table above.

All player units have a 5% base critical hit chance on every attack. A critical hit deals triple damage. Enemies do not crit. Sharpshooter Archers raise their personal crit chance to 30%. On a crit, the target briefly flashes a bright red glow.

Engineers gain a maximum of one level per battle, regardless of XP earned.

LevelXP RequiredFeel
1 → 25 XPFast — first battle usually gets a unit here
2 → 310 XPA few good battles
3 → 420 XPOfficer threshold unlockable
4 → 530 XPTrue veteran — protect at all costs
Core Tension Deploying a veteran to a high-risk position earns more XP and maximizes combat value — but risks losing them permanently. Keeping them in reserve is safer but stunts growth. New recruits sent into dangerous positions offer high-risk, high-reward leveling — some will die, some will shoot up in the ranks.

Attack Speed Floor

Minimum attack interval is 0.5 seconds regardless of building bonuses.

· · ·
VIII-B

Class Specialization

When a unit reaches Level 3, they become eligible to specialize. Specialization is a permanent, one-time choice that meaningfully changes how a unit fights. There are two paths per class, each expressed as an adjective before the class name (e.g. Mounted Warrior, Sharpshooter Archer).

Design Intent Specialization adds a planning and customization layer without overwhelming complexity. Two clear paths per class means the player always has a meaningful choice, and the naming convention ensures the unit's identity is still immediately readable in the field.

How Specialization Works

Visual Identity

Specialized units use a distinct color tint on their sprite so they are recognizable in the field while their base class icon (bow, sword, staff, etc.) remains unchanged. The base class is always readable; the tint communicates which path was chosen.

ClassBase ColorPath A ColorPath B Color
WarriorSteel Blue (0x4472C4)Bright Cobalt (0x6AABFF)Deep Navy (0x1A3A7A)
ArcherForest Green (0x70AD47)Lime Green (0xAAE040)Dark Olive (0x2D6B1A)
MagePurple (0x9B30FF)Lavender (0xCC88FF)Deep Indigo (0x4A0080)
HealerNear-White (0xEEEEEE)Bright Yellow (0xFFFF88)Amber (0xFFAA33)
CaptainGold (0xFFD700)Pale Gold (0xFFF0A0)Bronze (0xB87333)
EngineerOrange (0xFF6600)Red-Orange (0xFF3300)Dark Umber (0x8B3A00)

Specialization Paths

ClassPath AEffectPath BEffect
Warrior MountedDouble move speed HeavyArmor 20% → 40%
Archer Longbow+2 range Sharpshooter+25% crit chance (stacks with base 5%)
Mage ExplosiveAttacks deal AoE damage at 0.75 tile radius on impact Rapid-fireFires a simultaneous second projectile at a second valid target (standard Mage targeting)
Healer AreaHeal radiates 0.75 tiles from the primary target, hitting all friendlies in radius CombatArmor 10% → 30%
Captain InspiringAura radius 1.5 → 2.0 tiles Heroic+50% DMG, +50% HP
Engineer FlameshotAoE radius increased to 1.5 tiles (base 1.0) Anti-siegeAoE radius −25%, DMG +50%
· · ·
VIII-C

Surprise Tactics

Once per year, King Aldric sends one of his generals to the wall to train the defenders in a surprise tactic. This award is presented during the Gold Summary step of the off-season wizard (Step 4), starting with Year 2. The flavor text acknowledges last year's battle outcome — the king is paying attention, and his help is a direct response to what the wall endured.

Design Intent Surprise Tactics give the player a meaningful active decision in battle beyond deployment and targeting. Each tactic is a one-time burst that can swing a moment — but because they carry over and stack up to three, the player also faces a resource management question: save them or use them now?

Stockpile Rules

Battle Activation

All available tactics appear as buttons in a strip below the targeting controls bar. Each button has a distinct icon and label. When a tactic is activated, the button is removed and the effect fires immediately. The strip is hidden when the stockpile is empty.

Surprise Tactic List (V1 — Complete Set)

NameEffect
Mass Sortie All non-Engineer units not currently on the wall receive a 50% move speed boost. Any reserve units still in the holding pattern are immediately force-deployed as a sortie. Units already in the field but not on the wall also receive the speed boost.
Covering Fire All Archers fire one immediate free volley. Does not consume or reset their attack timer.
Barrage All Engineers and Mages fire one immediate free shot. Does not consume or reset their attack timer.
Healing Grace All Healers immediately trigger their heal regardless of cooldown. The heal cooldown resets after firing.
Shield Wall All Warriors and Captains gain +40% armor for 10 seconds. Buff expires automatically and armor reverts.
· · ·
IX

Enemy Types & Tactics

Enemy forces escalate over the course of the campaign, introducing new unit types and tactical approaches that require the player to adapt their defenses year over year.

Design Philosophy Enemies rely on numbers — waves of weaker units punctuated by a few especially tough elites. The goal is never to overwhelm the player with 200 enemies, but to create pressure through volume while making elite units feel genuinely dangerous and rewarding to bring down.

Enemy Unit Stats

UnitHPDMGAtk SpeedMoveArmorRangeYear Up (HP/DMG/Armor)Special
Orc1552sMed20%1+1 / +1 / +1%
Goblin1043sFast10%3+1 / +1 / +0.5%Cannot damage wall; targets furthest player unit in range
Ogre50205sSlow30%1+3 / +2 / +1%Ignores player armor. Elite. Advances immediately at battle start.
General2052sMed20%1+1 / +1 / +1.5%+25% DMG aura to all friendlies within 1 tile. Armor scales fastest. Elite. Buffed allies show gold border glow.
Catapult201510sSlow10%10+3 / +4 / +0.5%AoE damage. Targets nearest wall section. Splash does not affect units on wall. Elite.

Move Speeds

Move speed values in tiles per second (Sprint 1 starting values — subject to playtesting tuning):

Speed ClassTiles / SecondUnits
Slow0.5Ogre, Catapult
Med1.0Orc, General
Fast2.0Goblin

Elite Unit DPS Scaling

UnitDPS Year 1DPS Year 10DPS Year 20Notes
Orc2.57.012.0Steady workhorse
Goblin1.34.37.7Fast; armor scaling to be tuned in playtesting
Ogre4.07.611.6Ignores armor — true DPS vs any player unit
General2.57.012.050% armor by year 20 + aura; highest priority target
Catapult1.55.19.1AoE; effective DPS much higher vs grouped defenders

Enemy Compositions

Each year has three possible enemy compositions (A, B, C) randomly selected at battle start. Each composition defines unit assignments per lane (left, center, right), reserve slot contents, reserve deployment logic, and a scouting report string for the Scout Academy. Compositions for Years 1–3 are implemented in src/data/compositions.js. Years 4 and beyond fall back to a hardcoded stress test until authored.

Elite Kill Announcements

When an Ogre, General, or Catapult is destroyed, a kill announcement is displayed on screen identifying which player unit landed the killing blow. XP awarded for killing blow on these units is tripled (6 XP) instead of the standard 2 XP.

Enemy Battle Strategies

Enemies commit to an overarching strategy per year, then execute adaptively within that plan:

V2 Deferred

Enemy Mages are deferred to V2. Ladder mechanics and wall height gameplay effects also deferred to V2.

· · ·
X

Progression & Legacy Systems

The Seven-Year Arc

Every recruit who survives seven years earns the right to leave as a hero. By default, a veteran has a 25% chance of choosing to stay. The Monument building tracks hero names and applies the attack speed bonus accordingly — each hero who stayed is recorded, making the Monument both a mechanical tracker and a piece of narrative history. Financial incentives (stipends, bonuses) can further raise retention chances.

Veterans Who Stay

Veterans who choose to stay remain on the active roster as high-level soldiers. They are the same unit type they always were, but with accumulated XP, levels, and battle experience. There are no special super-unit mechanics — their value is their combat effectiveness and the XP bonus they provide to the roster each off season.

The Mentorship / Legacy System

Veterans who depart as heroes may leave behind a lasting influence on future recruit cohorts — a passive buff to incoming soldiers in their archetype, a shared technique, or improved early leveling. This ties long-term investment to multi-generational payoff and rewards players who protect and develop their veterans.

Design Note Players should feel attached to their soldiers, but not so attached that losses feel unfair. The high churn rate is the design — loss is expected, heroism is earned, and the wall marches on.

See Section VI for the full XP curve and level thresholds.

· · ·
XI

Buildings & Infrastructure

Buildings are the primary gate for unit types, capacity, and special abilities. They operate on two layers: a dependency/unlock system determines what can be built, and quantity + level are managed separately for each structure type. All building costs are in gold unless otherwise noted.

Building Reference

BuildingPrimary PurposeBonus per LevelCost/LevelPrerequisites
BarracksHouses Warriors & Archers+10 soldier capacity200
Archery RangeSpeeds archer attack-0.2s attack interval150Barracks
Sparring GroundSpeeds warrior & captain attack-0.2s attack interval150Barracks
LibraryHouses Mages & Healers+5 capacity200
Mage WorkshopSpeeds mage attack-0.5s attack interval150Library
HospitalSpeeds healer heal interval-1.0s heal interval150Library
Artisan WorkshopHouses Masons; auto-repairs wall before battle+10 Mason capacity; auto-repairs 50 HP per wall segment per level at the start of each off season (before gold is calculated)100
ArmoryIncreases armor (all units, additive)+7% armor250Artisan Workshop
WeaponsmithIncreases DMG (Warriors, Archers, Captains only)+10% DMG multiplier250Artisan Workshop
Siege WorkshopHouses Engineers+1 Engineer capacity200Artisan Workshop + Archery Range
Officer AcademyHouses Captains+1 Captain capacity (max 5)200Sparring Ground
MonumentBoosts attack speed per inscribed 7-year hero-0.1s attack interval per inscribed hero; max 3 levels at 300g each; hero cap scales with level (Lv1: 5 heroes, Lv2: 10, Lv3: 15 — max bonus −1.5s at Lv3 full)300Officer Academy
Scout AcademyHouses Scouts; reveals enemy composition+1 Scout capacity (max 3 levels)100Archery Range

Building Dependency Tree

Wall Upgrade Levels

The wall is upgraded per segment independently. Ladder mechanics are deferred to V2 — wall height has no gameplay effect in V1 beyond the damage reduction bonus.

LevelHeightThicknessHPUpgrade Cost
110 ft1200100
220 ft1300200
320 ft2400300
430 ft2500400
530 ft3600500
· · ·
XII

Difficulty & Campaign Length

Players choose their difficulty at the start of the game. This primarily determines how many years they must survive, not the speed of enemy escalation. The first ten years are the learning ramp regardless of difficulty — the same threat curve applies, the campaigns simply end at different points.

DifficultyCampaign LengthFeel
Easy 10 Years Learn the systems; first gen of recruits may reach hero status
Medium 20 Years Standard experience; two full recruit generations; true mid-game challenge
Hard 30 Years Full test; severe late-game escalation; requires optimized long-term planning
· · ·
XIII

Replayability & Variance

Two sources of variance ensure each playthrough feels distinct:

Enemy Variance

Each year's enemy composition is randomly selected from three options at battle start. One campaign may emphasize Catapults and Generals; another may rely on Ogre-led assaults with Goblin swarms. Players must read enemy development and adapt their building and recruitment decisions accordingly — no single strategy is universally optimal.

Recruit Variance

The annual recruit pool varies in composition. Some years bring melee-heavy cohorts; others skew toward healers or casters. Players must adapt their building and training priorities to make the most of what they receive.

V2 Consideration Random events and crises (plague, defections, unusual weather, political disruptions) are intentionally deferred to a future version. V1 focuses on core systems done well.
· · ·
XIV

Win Conditions & Scoring

Primary Win Condition: Survive to the end of the campaign. Game over occurs only when all player units are dead (total wipe).

Score: Total number of soldiers who achieved hero status (survived seven full years and were released honorably). This differentiates between "barely survived" and "truly excelled."

OutcomeMeaning
Total Wipe (all units dead)Game over — campaign ends immediately
Survived, 0 HeroesBare survival — the wall held but no one made it seven years
Survived, Some HeroesStandard success — a good campaign
Survived, Many HeroesMastery — the wall produced legends
· · ·
XV

Tech Stack

The game targets browser-native deployment on desktop. Mobile layout is deferred to a later sprint.

Core Technologies

TechnologyRoleRationale
HTML5 Platform & off season UI Browser-native, no install, cross-platform
Phaser 3 (CDN) Battle phase rendering & game loop WebGL renderer handles 50+ simultaneous units comfortably; built-in postFX, tweens, scene management; no build step via CDN
CSS / HTML overlay Off season menus, building screens, resource UI Layered over the Phaser canvas; cleaner and more responsive than Phaser's UI tools for complex menus
JavaScript (shared state) Game state management A shared GameState object bridges the Phaser battle scene and HTML off season UI. All constants centralized in src/data/constants.js — no raw literals elsewhere.

File Structure

File / FolderPurpose
index.htmlProduction entry point — auto-starts Year 1 with random composition
testversion.htmlDevelopment entry point — scenario chooser, key/legend sidebar, stress test
src/state/GameState.jsShared state object bridging battle and off-season
src/battle/BattleScene.jsPhaser scene — update loop, unit tick, combat, reserves, rout
src/battle/Unit.jsUnit class — stats, sprites, XP, postFX glows
src/battle/targeting.jsAll targeting logic for player and enemy units
src/battle/Wall.jsWallSegment class — HP, breach, damage reduction
src/battle/Projectile.jsProjectile class — movement, hit detection, AoE
src/data/units.jsPlayer unit stat definitions
src/data/enemies.jsEnemy stat definitions
src/data/buildings.jsBuilding definitions, costs, prerequisites
src/data/compositions.jsEnemy compositions keyed by year (3 options each)
src/data/constants.jsAll magic numbers — tile size, colors, thresholds, timings

Architecture Pattern

Phaser owns the battle phase canvas entirely. The off season is rendered as standard HTML/CSS positioned alongside the canvas. A central GameState object holds all persistent data — unit rosters, building levels, resources, year count — and is read and written by both layers. Game logic (combat resolution, targeting, XP math) runs in JavaScript; Phaser handles visual playback only.

Battle Phase

Phaser Scene

All unit movement, combat resolution, projectile handling, and rendering handled inside Phaser. Validated at 50+ simultaneous units. Phaser's Scene Manager maps cleanly to the yearly battle cycle. PostFX system used for heal and aura glow effects.

Off Season Phase

HTML / CSS UI

Tabbed navigation, building cards, resource counters, and upgrade flows built in standard HTML and CSS. Reads and writes to shared GameState on confirmation.

· · ·
XVI

Sprint 2 — Off Season Implementation Plan

The following is a suggested build order for implementing the off season UI. Tasks are sequenced to allow each step to be tested in isolation before the next layer is added. Claude Code should treat this as a to-do list and adapt sequencing as needed based on implementation realities.

Phase A — Data & State Foundation

1
Extend GameState.js to support off season state: gold breakdown (base / wall-damage / destroyed-segment), building levels, wall segment HP and level per section, unit roster array (with name, class, gender, level, XP, year, portrait ID, assignment), and per-playthrough used-name and used-portrait sets.
2
Create src/data/names.js — export male and female first-name arrays (Anglo-Saxon / Northern European) and per-class surname pool arrays (combat classes: martial surnames; Mason: trade-craft surnames; Scout: ranger-style surnames).
3
Create src/data/portraits.js — export portrait manifest arrays keyed by gender × type (male-combatant, female-combatant, male-noncombatant, female-noncombatant). Implement deck-draw logic: remove on assignment, return dead soldiers' portraits to the deck.
4
Create src/data/bios.js — pool of modular bio fragments (origin, trait, motivation) that can be combined into a short background paragraph for each recruit at generation time.
5
Implement recruit generation logic in src/offseason/recruitGenerator.js: determine class distribution (capacity-aware, roster-balancing, ±5 variance), generate name (unique-check against playthrough used-names set), assign portrait (deck-draw, unique among living), assemble bio. Expose as a function called after spending is confirmed.

Phase B — Wizard Shell & Navigation

6
Build the off season wizard shell in src/offseason/OffSeasonUI.js (or equivalent HTML/JS module). Implement step tracking, Next / Previous button logic, and step rendering dispatch. The shell should render one step at a time and preserve all step state on back-navigation.
7
Implement Step 1 — Gold Summary screen. Pull gold breakdown from GameState, display base income, wall-damage bonus, destroyed-segment bonus, and running total. Read-only; Next advances to Step 2.

Phase C — Wall & Building Investment

8
Implement Step 2 — Wall & Building Investment screen. Display all three wall segments (current HP, max HP, level, repair cost, upgrade cost). Display full building list: name, current level, cost to upgrade, prerequisite. Gray out and annotate buildings that are locked (prerequisite not met) or unaffordable. Show running gold total updated in real time as choices are made.
9
Implement Step 3 — Confirm Spending dialogue. Summarize all purchases. Warn player that building choices drive which recruit classes arrive. On confirm, write choices to GameState, trigger recruit generation, advance to Step 4.

Phase D — Personnel Table & Assignment

10
Implement Step 4 — Personnel Table. Render all combatants (not Masons or Scouts) in a sortable, filterable table. Columns: Name, Class, Year of Service, Level, Assignment (dropdown). New recruits visually highlighted. Sort and filter state persists within the off season session; resets next year.
11
Implement assignment dropdown logic. Options: Wall Left, Wall Center, Wall Right, Reserve Left, Reserve Center, Reserve Right. Warriors and Captains: wall options disabled. Assignments persist from prior year as defaults for returning soldiers. Block Next button until every combatant has an assignment. Show popup warning if any group exceeds hard capacity.
12
Implement character detail modal. Triggered by a button on each row. Displays: portrait image, full name, class, year of service, level, XP, bio text. Dismissable; does not affect table state.

Phase E — Deployment Preview

13
Implement Step 5 — Deployment Preview. Render a schematic of the wall and reserve zones populated with assigned units (name or class icon). Visually mirrors the battle map layout: wall left/center/right sections, and three reserve zones below. Include a Back button that returns to Step 4 with assignments intact.

Phase F — Scout Phase

14
Implement Step 6 — Scout Deployment (conditional on Scout count > 0). Present option to send Scouts. On confirm: apply 60/30/10 outcome probability, show ~3-second delay, display result message (intel revealed / no intel / Scout captured). On success, offer Back option to return to Step 4 for reassignment, then re-display Step 5 before proceeding.

Phase G — Integration & Handoff

15
Wire the end of the off season wizard to launch the battle phase: write final deployment assignments into GameState so BattleScene.js can read unit positions and reserve group contents on startup.
16
Update testversion.html to support launching the off season wizard directly (alongside the existing battle scenario chooser) so each step can be tested independently.
17
Add a v0.5 entry to the changelog when Sprint 2 is complete.
· · ·
XVII

Open Questions

The following design questions remain unresolved and should be addressed during or after playtesting:

?
How does the mentorship / legacy system work mechanically? Does the buff persist across the whole campaign or just the following year?
?
What are enemy armor values and how do they scale year over year? Needs a defined curve to balance against player DPS ceilings.
?
What is the Monument bonus — how much does each Monument level raise veteran retention or attack speed?
?
How many units fit per wall section (4 tiles wide)? Hard cap or dependent on unit size?
?
Enemy composition spreadsheet — Years 4–30 need to be authored (3 variations per year). Years 1–3 are defined; remaining years fall back to a stress-test placeholder.
?
Move speed values (Slow / Med / Fast) are set at 0.5 / 1.0 / 2.0 tiles/second for Sprint 1 — to be validated and tuned during playtesting.
· · ·
XVIII

Changelog

v0.9 — Code Audit Corrections
2026-06-14
  • Gold economy (Section IV): base tax changed from flat 100g to a random roll of 100, 150, or 200 gold (equal probability) each off season. Design intent callout updated accordingly.
  • Catapult targeting (Section VII): on-breach target corrected from "nearest player unit" to "furthest player unit in range."
  • Enemy reserve deployment (Section VII): clarified that all timed slots (left/center/right_after_delay) share a single 20-second timer and release simultaneously, but each slot advances toward its own designated wall section independently.
  • Engineer targeting (Section VII): updated from simple "furthest in range" to priority system — nearest Catapult first, then largest clump within AoE radius, then nearest.
  • Captain aura (Sections VII, VIII): corrected from "3×3 tile area" to "1.5-tile radius circle" throughout.
  • Experience & leveling (Section VIII): added random per-level-up bonus (+1–3 HP or DMG, 50/50 each level-up); added critical hit system (5% base, ×3 damage, player-only); added Engineer per-battle level cap (max one level gained per battle); clarified that "took damage" XP is awarded only to survivors at battle end.
  • Flameshot Engineer (Section VIII-B): corrected "+25% AoE radius" to "AoE radius set to 1.5 tiles (from base 1.0)."
  • Veteran retention (Section X): corrected "approximately 10%" to the implemented value of 25%.
  • Building costs (Section XI): Artisan Workshop 200g → 100g; Scout Academy 200g → 100g; Armory 200g → 250g; Weaponsmith 200g → 250g.
  • Artisan Workshop (Section XI): primary function expanded — now also auto-repairs 50 HP per wall segment per level at off-season start, before gold is calculated.
  • Monument (Section XI): cost corrected to 300g/level, max 3 levels; hero cap now scales with level (Lv1: 5, Lv2: 10, Lv3: 15 heroes; max bonus −1.5s at Lv3 full).
  • Scout Academy (Section XI): noted max 3 levels.
  • Version header updated to v0.9.
v0.8 — Surprise Tactics
2026-06-10
  • New section VIII-C: Surprise Tactics — king awards one random tactic per year at Gold Summary (Year 2+); stockpile max 3; carry-over between battles; single-use on activation.
  • Complete V1 tactic set defined: Mass Sortie, Covering Fire, Barrage, Healing Grace, Shield Wall.
  • Mass Sortie clarified: force-deploys reserve units as sortie AND applies 50% move speed boost to all non-Engineer non-wall units (including those already in the field).
  • Battle UI: Surprise Tactic button strip added below targeting controls bar; all available tactics shown simultaneously; button removed on use.
  • Gold Summary step (Step 4) updated to describe the annual tactic award and flavor text.
  • Battle phase section updated to describe the Surprise Tactic strip.
  • TOC updated to include Section VIII-C.
  • Version header updated to v0.8.
v0.7 — Class Specialization
2026-06-10
  • New section VIII-B: Class Specialization — two paths per class unlocked at Level 3.
  • Specialization announced in battle ("reached Veteran rank!"); choice deferred to off-season Training & Specialization step.
  • All 12 specialization paths defined with stats: Mounted/Heavy Warrior, Longbow/Sharpshooter Archer, Explosive/Rapid-fire Mage, Area/Combat Healer, Inspiring/Heroic Captain, Flameshot/Anti-siege Engineer.
  • Color tint system defined: two distinct shades per class to visually distinguish specialized units while preserving base class icon readability.
  • New off-season wizard step "Training & Specialization" inserted as Step 3 (conditional); subsequent steps renumbered 4–9.
  • Training step shows: battle level-ups, veteran XP awards and resulting level-ups, specialization choice cards. Blocks Next until all L3 choices resolved.
  • Hero Departures step (Step 2) scoped to year-7 ceremony only; veteran XP distribution moved to Training step.
  • "Personnel & Deployment Assignment" renamed "Units & Deployment Assignment" (Step 7).
  • TOC updated to include Section VIII-B.
  • Version header updated to v0.7.
v0.6 — Honoring the Fallen & Heroes · Recruit Generation Rules
2026-06-01
  • New section V: Honoring the Fallen & Heroes — the two sequential opening ceremonies of every off season.
  • Fallen ceremony specified: portrait-and-reading format, death order (not alphabetical), spare visual treatment, manual advance. Skipped if no deaths occurred.
  • Hero ceremony specified: same portrait-and-reading format, distinct Commander line ("A hero of the realm"), manual advance. Retention outcome revealed during the ceremony itself — not before.
  • Retention resolved before ceremony renders; heroes who stay presented last with distinct phrasing. Player has no agency over retention.
  • Retention probability: 25% base chance to stay. Monument provides additional bonus (exact per-level values TBD during playtesting). Veteran stipend investment also increases retention (TBD).
  • Summary screen specified: appears after both ceremonies, lists deaths / departures / retentions together. Only place both counts appear side by side.
  • Screen routing table added: four conditions mapped to which ceremony screens display.
  • New section VI: Recruit Generation Rules — full specification replacing the brief Character Generation summary previously in the Off Season section.
  • Generation sequence formalized as a 7-step process: determine total recruits → determine class split → generate gender → generate age category → generate first name → generate last name → assign portrait → assign bio → initialize stats.
  • Class split algorithm documented: ±1 cap from even split, applied independently to Warriors/Archers (Barracks) and Mages/Healers (Library). Masons, Engineers, Captains, Scouts fill independently.
  • First name pools documented in full: 50 male names, 50 female names from the data file.
  • Last name pools documented by class with theme and examples. Uniqueness constraint: re-roll last name first, then first name if all combinations exhausted.
  • Portrait deck-draw logic documented: gender × combatant/noncombatant pools, unique among living soldiers. Portraits are never returned to the pool mid-playthrough; only when the entire category pool (warrior or nonwarrior) is fully exhausted do portraits from dead and departed soldiers re-enter the pool.
  • Bio pool documented: 256 complete bios in four sub-pools of 64 (young male, young female, old male, old female). Bios not tracked for uniqueness.
  • Edge case table added: full roster, new buildings, Officer Academy cap, portrait pool exhaustion.
  • Year of Service rule clarified: injured soldiers who miss a battle still increment. Only death ends the count.
  • Off Season section (IV) Character Generation summary replaced with forward reference to new Section VI.
  • All section numbers updated: Battle Phase IV→VII, Unit Archetypes VI→VIII, Enemy Types VII→IX, Progression VIII→X, Buildings IX→XI, Difficulty X→XII, Replayability XI→XIII, Scoring XII→XIV, Tech Stack XIII→XV, Sprint 2 XIV→XVI, Open Questions XV→XVII, Changelog XVI→XVIII.
  • TOC updated to include new sections V and VI.
  • Version header updated to v0.6.
2026-05-31
  • New section II: World & Culture — geography, isolation, social structure, tone, hero culture, key figures, the enemy, and flavor system.
  • Kingdom established as geographically isolated — impassable mountains, one valley, one wall, no outside world.
  • Social structure defined: predominantly agrarian, one city (simply called the City), small merchant middle class, tiny nobility.
  • Tone codified: grim but not hopeless — the stakes are understood by everyone from childhood, but are not paralyzing.
  • Hero culture formalized: seven-year veterans receive land grants, property deeds, and kingdom-wide recognition. Their names are known everywhere. Children grow up on their stories.
  • Adolescent training culture noted: qualifying as a recruit is itself an honor; service is the primary path to social advancement.
  • King Aldric established as a former wall commander — his authority is experiential, not merely inherited.
  • Player established as a former seven-year hero, recalled and appointed by Aldric as commander.
  • The enemy formalized: called the raiders or invaders in general usage; the monsters in children's stories. Nameless by design.
  • Flavor system planned: bios per character, organized by gender (M/F) and age (young/old). 256 complete bios targeting emotional investment. Superseded by Section VI.
  • Off Season section (IV) expanded with full wizard flow specification: 6-step wizard (Gold Summary → Wall & Building Investment → Confirm Spending → Personnel & Assignment → Deployment Preview → Scout Deployment).
  • Recruit generation system specified: class distribution with ±5 variance, Anglo-Saxon / Northern European name pools, class-appropriate surname pools, full-name uniqueness check per playthrough, portrait deck-draw system (dead soldiers' portraits recycled), modular bio fragments.
  • Personnel table design finalized: sortable/filterable, assignment dropdown per row (persists year to year), new recruits highlighted, character detail modal with portrait and bio.
  • Assignment rules documented: Warriors/Captains wall-options disabled; all combatants must be assigned before proceeding; hard-capacity popup warning.
  • Deployment Preview (Step 5) specified as schematic wall visualization.
  • Scout phase (Step 6) specified: conditional on Scout count, 60/30/10 outcome table, ~3s delay, intel triggers optional return to assignment step.
  • Sprint 2 implementation plan added as Section XIV: 17 sequenced to-do tasks organized into 7 phases (Data & State, Wizard Shell, Wall & Building, Personnel Table, Deployment Preview, Scout Phase, Integration).
  • All section numbers updated to accommodate new World & Culture section.
  • TOC and version header updated to v0.5.
v0.3 — Sprint 1 Complete
2026-05-29
  • Battle phase fully implemented and playable. Validated at 50+ simultaneous units.
  • Map: 12×16 tiles, 46px/tile (552×736 canvas). Wall at row 11. Engineers stationary at row 12.
  • Move speeds resolved: Slow = 0.5, Med = 1.0, Fast = 2.0 tiles/second (tunable).
  • Enemy compositions defined for Years 1–3 (3 options each) in src/data/compositions.js.
  • Reserve system implemented: 3 slots per side, rows 0–1 (enemy) and 14–15 (player), capacity 25. Enemy deploy logics: wait_for_breach and timed (20s or breach).
  • Player deploy menu redesigned as 2-row grid: Sortie L/C/R and Reinforce L/C/R. Reinforce sends ranged/healers to wall section; warriors hold until breach or rout.
  • Rout condition finalized: all elites dead AND <50% remaining AND player outnumbers. Mobile player units automatically released to give chase on rout.
  • Targeting preferences: 3 dropdowns (Melee, Ranged, Siege) with Default + 5 enemy types. Healer excluded (N/A). Persisted to localStorage alongside Slow Mo checkbox.
  • Battle countdown: 3–2–1–FIGHT! freezes game loop so player can set targeting before combat.
  • Aura glow visual: units within a Captain or General aura radius show a dim gold postFX border. Healer blue heal glow temporarily suppresses it.
  • Healer behavior: heals immediately on finding first injured ally (no startup delay), then 10s cooldown. Healer XP: 1 per 50 HP healed.
  • Catapult targeting corrected: targets nearest wall section (same as melee), not furthest player unit.
  • Mage targeting corrected: filters to elites actually in range before selecting nearest (was silently falling back to goblins when nearest elite was out of range).
  • Reserve units excluded from all targeting candidates while inert; automatically included on deploy.
  • Two HTML entry points: index.html (production, random Year 1 composition) and testversion.html (scenario chooser, key/legend, stress test).
  • All constants centralized in src/data/constants.js. No raw literals in other source files.
  • Bug fixes: announcement timer no longer hides battle-result text; heal glow callback guarded against destroyed sprite.
v0.2 — Design Complete
2025-05-27
  • Full game design documented: core loop, battle phase, all unit archetypes and enemy types, building dependency tree, progression and legacy systems, difficulty settings, scoring.
  • Tech stack decided: Phaser 3 (CDN) for battle rendering, HTML/CSS for off-season UI, shared GameState object bridging both.
  • All unit and enemy base stats defined and locked.
  • XP system designed: killing blow 2 XP (6 XP for elites), assist 1 XP, took damage 1 XP. Level thresholds: 5 / 10 / 20 / 30.
  • Gold economy defined: 100 base + 1 per missing wall HP + 200 per destroyed segment.
  • Building dependency tree finalized.
  • Reserve system concept established: 3 slots per side, Warriors/Captains reserve-only.
  • Game over condition: total wipe only (not wall breach alone).
v0.1 — Initial Concept
2025-05-01
  • Initial concept: wall defense + generational strategy, 7-year service arc, hero graduation.
  • Platform decision: HTML5 browser game, no install required.
  • Core loop established: alternating off-season and battle phases.