THE BROKEN SEAL
Proposed Game Specification
Revision 0.2 - 1 November 2026

Status: design proposal; no game implementation is implied by this document.
Working title: The Broken Seal (subject to change).

1. PURPOSE

Create an original Linux desktop strategy game inspired by the officer
management, provincial government and diplomacy of classic Koei games.
Players lead rival factions in a fictional empire whose central authority
has collapsed. They recruit followers, govern provinces, negotiate alliances
and command armies in pursuit of a new imperial settlement.

The game must be written in Free Pascal and run as a native graphical Linux
desktop application. Its main view is an illustrated province map inspired
by the strategic map presentation of Bandit Kings of Ancient China. Mouse
and keyboard input, including function hotkeys, are first-class controls.

The desktop edition is single-player against computer factions. Multiplayer
is online only, in the browser edition; the engine can hold several human
factions for it.
Linux is the required platform; DOS, BBS and Windows builds are not required.

The world has NO campaign time limit. Player-controlled turns continue until
a winner emerges or the player starts a new campaign. There is no victory based simply on
having the highest score after a fixed number of turns.

This specification establishes the proposed first release. Numerical balance
values below are initial defaults requiring simulation and playtesting.
Exact combat and economic formulae must be settled and documented before
the implementation is declared complete.

2. SETTING AND IDENTITY

The emperor has disappeared and the Imperial Seal has been lost. Governors,
outlaw captains and military households compete to restore central rule.
The setting uses original names, characters, geography and writing.

Players name their faction and ruler. A faction can begin as a provincial
household or a landless outlaw company. Both can eventually claim the throne.
The missing seal supplies atmosphere; it is not a randomly discovered object
that bypasses the normal victory requirements.

3. CAMPAIGN SCALE

Default world:
  24 provinces, connected by a fixed and clearly displayed route network.
  Six major faction slots, each controlled by a player or the computer.
  Approximately 60 named officers, including rulers.
  Three troop types: infantry, archers and cavalry.
  One designated imperial capital.

Independent provinces may be governed by local computer-controlled rulers.
Map data should permit later scenarios without changing the rules engine.
The initial release needs one balanced scenario.

One completed campaign turn advances one game month. Twelve turns form a
year. Seasons influence harvests and military supply. There is no real-world
clock or scheduled daily maintenance: time advances only through End Turn.
Years continue indefinitely. Dates and counters must not wrap during a
long-running game.

4. PLAYER EXPERIENCE

A typical turn follows this sequence:
  Read a concise summary of the previous turn's events.
  Explore the map and inspect provinces, officers, armies and treaties.
  Assign officers, set policies and prepare military and diplomatic orders.
  Review orders, resolve warnings and select End Turn.
  Watch a skippable map-based summary and inspect the results.

Orders remain editable until the player confirms End Turn. Opening menus,
reading reports or leaving the application does not advance game time.
Save files preserve pending orders as well as the resolved campaign state.

In single-player, End Turn commits the human faction's orders, generates
computer orders and resolves the month. Computer decisions use only the
information available to that faction.

With several human factions (online games), each plans its own orders. Once
every human faction commits, computer orders are generated and the month
resolves. Committed human orders cannot be edited. Diplomacy occurs
through proposals and responses on each faction's planning screen; accepted
agreements take effect in the next resolution's diplomacy phase.

Each officer receives one primary assignment per turn. An army commander
cannot also perform a separate civil assignment during that turn.
Information screens, reports and diplomatic messages consume no assignment.

5. FACTIONS AND OFFICERS

Each faction records its ruler, treasury, grain reserves, legitimacy,
provinces, officers, armies, agreements and standing policies.

Each officer has:
  A name and short biographical description.
  Command, Warfare, Administration and Intrigue ratings, each 1 to 100.
  Loyalty from 0 to 100; a ruler is not subject to ordinary defection.
  A personality trait such as honourable, ambitious, cautious or greedy.
  A small set of friendships and rivalries.
  Location, employer, health, captivity status and current assignment.

Command affects troop organisation and morale. Warfare affects battlefield
performance. Administration affects economic assignments. Intrigue affects
intelligence and recruitment. Personality and relationships modify relevant
decisions; they do not silently override every other factor.

Officers can be recruited from independent courts, travelling candidates and
captives. Recruitment depends on the envoy, target loyalty, relationships,
faction legitimacy and the offered reward. Failure produces an explanation.

Loyalty improves through reliable pay, suitable appointments and rewards.
Unpaid service, reckless losses and broken agreements reduce it. Severe
discontent produces warnings before desertion or defection becomes likely.

Officers do not age or die naturally in the first release. Combat can wound
or capture them; permanent officer execution and combat death are excluded
initially so an indefinite world does not exhaust its roster.

Captives may be recruited, ransomed, exchanged or released. Prisoners cannot
perform assignments. Releasing an officer can improve diplomatic goodwill.
Unused officers remain in the world rather than being deleted.

6. PROVINCES AND GOVERNMENT

Each province records owner, population, public support, farmland, commerce,
fortifications, terrain, garrison, local grain and assigned governor.
Public support ranges from 0 to 100. Provinces have development ceilings.

Civil assignments:
  Develop farmland: improve future harvests.
  Develop commerce: improve tax income.
  Repair fortifications: restore or improve defensive works.
  Recruit troops: exchange population, gold and equipment for soldiers.
  Train troops: improve readiness within a fixed ceiling.
  Relief: spend grain or gold to improve public support.
  Gather intelligence: obtain a dated estimate of a neighbouring province.
  Recruit officer: approach a named candidate.
  Rest: recover health and remain available next turn.

Tax policy is a standing choice: light, normal or heavy. Heavy taxation
increases immediate revenue but damages support and growth. Low support
reduces revenue and can cause unrest; escalating warnings precede revolt.

Gold is held in a faction treasury. Grain is stored locally and transported
along valid routes. The interface must distinguish faction totals from
supplies actually available to an army or province.

Harvests occur in autumn; taxes and upkeep resolve every turn. Recruitment,
development and troop numbers have explicit costs and caps. No player gains
extra resources by opening screens or reloading the interface.

7. ARMIES, MOVEMENT AND SUPPLY

An army has an owner, commander, troop counts, morale, training, carried
grain, location, destination, battle plan and retreat instructions.

One movement order crosses one province connection per turn. Terrain may
increase supply cost but does not create hidden multi-turn movement rules.
Crossing enemy territory requires an attack order. Crossing allied territory
requires military access. Allies retain ownership of their armies.

Armies consume grain every turn. They use carried supplies first and may
draw from an authorised friendly store at their location. Access alone does
not authorise taking an ally's grain. Supply shortages reduce morale and
eventually cause desertion, with clear reports and advance estimates.

Players can dispatch grain shipments over controlled or authorised routes.
Shipments require available stock and a valid route at resolution; failed
shipments retain their stock at origin and report the reason. Initial
shipments resolve in one turn; interception is a later extension.

8. COMBAT AND SIEGES

Combat resolves automatically during End Turn. The map highlights the
location, participants and outcome of each encounter, with an optional
detailed report. Presentation can be accelerated or skipped without changing
the result. Interactive tactical battles are outside the initial scope.

Available battle plans:
  Hold: favour defence and conserving troops.
  Assault: attempt decisive capture with greater exposure to losses.
  Ambush: favour suitable terrain and intelligence, with a failure risk.
  Raid: damage supplies or development, then attempt withdrawal.
  Withdraw: avoid battle where possible and move to a legal refuge.

Plans modify a documented combat model; no plan is universally superior.
Troops, morale, training, supply, terrain, forts and officer abilities matter.
Random variation is bounded and uses the saved campaign random generator.

Players choose a retreat threshold and a legal fallback province. If retreat
is blocked, survivors may surrender and the commander may be captured.
Reports state losses, retreats, captures and the principal deciding factors.

Fortified provinces may require several turns of siege. Besiegers consume
supplies, while isolation limits replenishment for defenders. Assaulting is
optional. Occupation damages local support and may damage development.

Opposing movement across the same route creates an interception battle.
Multiple arrivals at one province form one encounter with separate allied
contingents. Mutually hostile groups fight in deterministic, seeded order;
numeric faction IDs must not confer a persistent initiative advantage.

An attacking coalition names the intended occupying faction before orders
are committed. Every supporting faction sees that choice. If it becomes
ineligible, the attack fails validation rather than silently transferring
ownership to a different ally.

9. DIPLOMACY AND ALLIANCES

Alliances are a core first-release feature, including shared victory.
Agreements require an explicit proposal and acceptance by the other party.
The acceptance screen shows effects, duration and termination rules.

Agreement types:
  Non-aggression: prohibit attacks and hostile officer operations.
  Military access: permit passage through specified partner territory.
  Defensive alliance: enable agreed defensive support and alerts.
  Trade: schedule recurring transfers of gold or grain.
  Coalition: create a named political and military alliance.

Access and trade are separate permissions. A defensive alliance does not
give either player command over the other's officers, troops or treasury.
Defensive standing orders specify which armies may assist, where they may
go and the maximum resources that may be committed.

Gold-for-grain trades execute together if both obligations are affordable
and the grain route is valid. Otherwise neither side transfers resources.
Unfunded recurring trades are skipped with a report, never paid through
negative balances. Gifts are explicitly labelled one-way transfers.

A faction belongs to at most one coalition. Joining requires approval from
all existing members. Coalition members have mutual non-aggression, military
access and shared military intelligence. Intelligence retains its observation
date; joining does not reveal hidden information nobody has obtained.

Each member controls its own forces and approves its own offensive orders.
The coalition leader manages invitations and proposes objectives; leadership
does not permit expelling members or spending their resources unilaterally.
Expulsion requires agreement by all other members and follows normal notice.

Normal withdrawal is announced at turn T and resolves after T+1 combat.
Treaty protections remain in force through that combat. The departing side
cannot attack its former partner until T+2. Neither side can evade notice by
issuing an attack before cancelling an agreement.

Immediate betrayal is a separate, explicitly confirmed order. It ends the
relevant protections before that turn's combat, costs legitimacy and officer
loyalty, cancels shared-victory progress and creates a public historical entry.
The victim receives notice in the resulting turn report. Routine cancellation
does not carry the same penalty as betrayal.

When access ends, stranded armies receive one turn of withdrawal-only access
to leave by a legal route; they cannot attack or replenish from former allies.
If no exit exists, they must negotiate evacuation or surrender.

Human factions can attach short private messages to diplomatic proposals.
Computer factions respond through the same proposal system using documented
acceptance factors. Private messages are excluded from public announcements.

10. LEGITIMACY AND VICTORY

Legitimacy is a public rating from 0 to 100 representing recognised authority.
It increases through stable government, relief, honouring agreements and
releasing captives. Betrayal and abusive government reduce it. Repeatable
actions have caps or diminishing returns to prevent easy score farming.

A solo faction qualifies for victory when it:
  Controls the imperial capital.
  Controls at least two-thirds of all provinces, rounded upward.
  Has legitimacy of at least 70.
  Maintains all three conditions for three consecutive completed turns.

A coalition qualifies using its combined provinces when:
  One member controls the imperial capital.
  Combined control meets the same two-thirds threshold.
  All members explicitly endorse the same member ruler as emperor.
  That ruler's faction has legitimacy of at least 70.
  Each member has legitimacy of at least 40.
  The same membership, nominee and conditions persist for three turns.

Changing members or nominee, withdrawing endorsement, losing the capital or
falling below a threshold resets the three-turn count. Qualification and
progress are public. A pending membership change blocks qualification.

All coalition members share the victory. The historical record identifies
the emperor and each faction's contribution without treating allied players
as losers. One coalition cannot qualify under multiple nominees.

Victory is checked after all turn effects. The completed world is then
frozen for inspection. The player may save its final chronicle and start a
new campaign. Starting a new game does not overwrite existing saves.
There is no automatic reset and no turn-count victory shortcut.

11. DEFEAT, HUMAN FACTIONS AND STANDING ORDERS

Loss of the last province does not automatically remove a player. The ruler
and surviving followers become an outlaw company at a legal refuge.
Outlaws can recruit, negotiate and attempt to establish a new provincial base.
They have restricted upkeep and recruitment capacity, and cannot generate
unlimited free troops, grain or officers by repeatedly losing territory.

A captured landless ruler receives a documented escape or release path;
captivity cannot lock a player out indefinitely. The exact escape delay is a
balance parameter visible to both captor and captive.

At campaign setup the player picks one house; the computer leads the others.
A local save from an older version with several human factions opens with the
faction whose turn it was human and the others computer-controlled, and a
notice says so.

An explicit campaign-management option can transfer a faction between human
and computer control. It must warn when this exposes information. A faction is never silently replaced during play.

Standing orders retain taxation, defensive posture and selected recurring
civil assignments. One-off attacks do not repeat automatically. Sieges can
persist when explicitly ordered. A human player may delegate a turn to the
computer, but inactivity alone does not advance the campaign or delete a
faction.

Computer factions use the same resources, movement and information rules as
human factions. Their behaviour must support diplomacy, coalition membership,
offensive campaigns and attempts to prevent a rival's impending victory.

12. TURN RESOLUTION

End Turn must use an explicit, tested phase sequence:
  1. Snapshot the campaign and committed orders; suspend gameplay input.
  2. Apply diplomacy, betrayals, permissions and coalition changes due now.
  3. Validate assignments and reserve their resource costs.
  4. Resolve authorised trades and supply shipments.
  5. Resolve movement, interceptions, battles, sieges and occupation.
  6. Resolve surviving officers' civil and recruitment assignments.
  7. Resolve income, seasonal harvest, upkeep, support and loyalty.
  8. Resolve bounded events, captivity and outlaw recovery.
  9. Update intelligence, reports, treaty expiry and victory progress.
 10. Commit the complete next state and autosave; present the results.

Orders are validated again against actual conditions. Costs are charged only
according to documented success and failure rules. Later income cannot fund
an assignment that was unaffordable at phase 3. Newly recruited troops cannot
fight in the battle phase that has already occurred.

The interface previews affordability across all orders together. If changing
conditions leave insufficient resources, the player's explicit priority order
decides which assignments proceed. Cancelled assignments explain why.

13. INFORMATION AND REPORTS

The map and route network are public. Province ownership, coalition
membership, legitimacy and a throne claim are public political information.
Enemy troop strengths, stores, loyalty and assignments require intelligence.

Intelligence records its source turn and shows estimates rather than
pretending old observations are current. Allied sharing never reveals enemy
orders or private officer information the ally could not see independently.

Each turn produces a short headline summary and optional detailed reports
for government, officers, diplomacy and combat. A permanent chronicle records
major conquests, coalitions, betrayals and the eventual settlement.

14. DESKTOP INTERFACE AND WORLD MAP

The world map is the primary playing surface, rather than a text menu or a
collection of disconnected management windows. Aim for the illustrated,
province-based strategic character requested from Bandit Kings of Ancient
China, using original geography, artwork, symbols and interface assets.

Show a continuous illustrated landscape with recognisable mountains, rivers,
plains, forests, settlements and passes. Divide it into 24 irregular provinces
with clearly outlined borders. Each province has a readable name or number,
a settlement marker and an owner banner. Legal movement connections must be
explicit, especially where a river or mountain prevents apparent adjacency.
The visual map and the rules' route graph must agree.

Use a restrained historical palette, parchment-like panels and clear faction
colours. Terrain remains visible under ownership tinting. Owner banners,
border patterns or symbols supplement colour so colour alone never carries
essential information. Selected, hovered, allied and hostile provinces have
distinct states. Do not reproduce another game's map, portraits or graphics.

Layout:
  Top bar: date, active faction, gold, grain summary and urgent alerts.
  Main area: the largest available area devoted to the strategic map.
  Side panel: selected province, army or officer and relevant action buttons.
  Bottom strip: event messages, order summary and visible hotkey hints.
  Toolbar: provinces, officers, military, diplomacy, reports and End Turn.

Province selection shows ownership, terrain, support, available intelligence,
garrison and legal actions. Friendly selections show known exact values;
enemy selections preserve intelligence restrictions. Army markers identify
owner and strength only to the extent the active faction knows them.

Map overlays include political ownership, diplomacy, supply and military
intelligence. Pending movement and attacks appear as arrows, with destinations,
expected supply costs and warnings. Show proposed orders distinctly from
completed movement. Events and reports provide a Go To Location action.

Mouse controls:
  Left click: select a province, army, officer or interface control.
  Double click: open the selected object's detailed panel.
  Right click: open legal context actions for the target or cancel targeting.
  Wheel: zoom the map around the pointer.
  Middle-button drag: pan the map; edge scrolling is optional and configurable.
  Hover: show concise tooltips, estimated costs and relevant keyboard shortcuts.

Selecting Move or Attack enters a clear destination-selection mode. Legal
targets are highlighted; clicking one previews the order and its costs before
confirmation. A right click must never silently commit an attack or betrayal.
Every essential action is also available through visible buttons and keyboard
navigation; dragging and double clicking are convenience shortcuts.

Default keyboard controls, rebindable and listed in an in-game reference:
  Arrow keys / WASD: pan the map when no text field has focus.
  Plus / Minus: zoom in or out; Home: fit the world to the viewport.
  Tab / Shift+Tab: cycle focus through interactive controls.
  Enter: activate the focused control or confirm the current ordinary action.
  Escape: cancel targeting, close the top panel, or open the pause menu.
  P: provinces; O: officers; M: military; D: diplomacy; R: reports.
  T: turn-order review; Space: centre on the selected object.
  F1: contextual help; F5: quicksave; F9: confirm loading the quicksave.
  Ctrl+Enter: open End Turn review, then require an explicit confirmation.
  Ctrl+S: save dialog; Ctrl+O: load dialog; F11: toggle fullscreen.

Shortcuts do not fire while entering names or diplomatic text, except normal
text-editing and dialog controls. Modal dialogs receive input before the map.
Closing a panel restores sensible focus.

Support resizable windows and fullscreen. Target a 1280-by-720 minimum layout,
with scalable text and UI for larger displays. Map zoom and UI scale are
independent. Text must remain readable without relying on pixel-perfect
scaling. Resizing must not hide End Turn, confirmations or essential controls.

First launch provides a brief introduction and credits. New campaigns offer a
short guided first turn using highlights and concise explanations. Help and
the full rules remain accessible without leaving the game. Each management
panel explains its purpose briefly; full manual pages are not normal menus.

Consequential actions show clear confirmation and their actual effects,
particularly treaty betrayal, gifts, captive release and coalition withdrawal.
Invalid actions explain the reason and how to satisfy their requirements.

15. IMPLEMENTATION AND STORAGE

Language: Free Pascal. Required build and runtime platform: Linux desktop.
Proposed GUI foundation: Lazarus LCL with a custom-drawn map control and
standard desktop widgets for lists, dialogs and accessible management panels.
Confirm map redraw performance, scaling and input handling in an early
prototype before finalising the widget set and packaging dependencies.

Keep rules, state serialisation, orders, AI and reports separate from the GUI.
The map renderer consumes view data filtered for the active faction; drawing
code cannot expose private state through tooltips or overlays. A headless
simulation runner uses the same rules engine for balance and regression tests.

Store province shapes, terrain artwork, settlement anchors and route links as
scenario assets. Validate polygon hit testing, marker placement and route
connectivity at load. Keep province identifiers stable across artwork changes.
Visual zoom must not change simulation coordinates or movement rules.

Use explicit-width integer fields and documented byte ordering in save files.
Do not persist compiler-native records without controlled serialisation.
Use deterministic integer calculations in economic and combat rules. Bound
resource growth and validate relationships, counts and ownership on load.

Save files contain format version, campaign identity, date, turn number,
random-generator state, world state, pending orders and turn commitment
status. Presentation timing must never change the saved random sequence.
Matching state and orders produce identical outcomes in the GUI and simulator.

Only one running process may write a campaign. Detect an already open save
and offer read-only inspection or a clear error. UI edits operate on the
planning state; resolution operates on a complete snapshot. Disable gameplay
edits during resolution while keeping progress display and window repainting
responsive. Never leave a partially resolved state visible as a playable turn.

Use atomic save replacement and retain the preceding valid save. Autosave
before resolution and after a completed turn, with a configurable bounded
history. A crash must allow recovery of a complete pre-turn or post-turn
state. Loading the pre-turn snapshot reproduces the same results for the same
orders; it must not depend on animation speed or wall-clock timing.

16. CAMPAIGN FILES AND DESKTOP OPERATIONS

Launch from the Linux application menu or command line. Provide a desktop
entry, application icon and documented runtime dependencies. Installation
must not require a BBS, drop files, serial driver, cron job or game server.

Title screen: Continue, New Campaign, Load Campaign, Settings, Rules, Credits
and Quit. New Campaign selects scenario and the player's house (the computer
leads the others),
and clearly describes the victory conditions and absence of a turn limit.

Support named saves, quicksave, manual load, autosave recovery and campaign
archive/export. Store user saves and settings in documented per-user Linux
data and configuration directories, without requiring write access to the
installation directory. Bundled assets are read-only application data.

Settings cover window/fullscreen mode, UI scale, map scrolling, key bindings,
colour aids and resolution animation speed. A mute/audio setting is required
only if audio is included; gameplay must remain fully understandable silently.

Exit prompts to save unsaved planning changes. Loading or starting another
campaign warns about unsaved changes. New Campaign and archive operations
must not overwrite an existing campaign without explicit confirmation.
A completed campaign remains available for map inspection and chronicle export.

The desktop edition does not protect saves from other users of the same
desktop. Network accounts, remote hosting and anti-cheat services are outside
its scope.

17. DOCUMENTATION AND DISTRIBUTION

Provide comprehensive plain-text documentation explaining:
  Every resource, statistic, assignment, cost and cap.
  Economic, recruitment, loyalty, supply and combat formulae.
  Battle plans, retreat, siege and occupation rules.
  Every treaty, notice period, betrayal consequence and coalition permission.
  Solo and coalition victory, including counter resets.
  The exact End Turn sequence and failed-order behaviour.
  Worked examples of a first turn, an allied attack and a supply shortage.
  Mouse controls, keyboard navigation, hotkeys, overlays and accessibility.
  Linux installation, campaign setup, saves, backups and recovery.
  Building the Linux desktop application and the save-file/scenario formats.

Ship a short in-game reference and a separate full player manual. Mechanics
documentation must describe the implemented release, not planned features.

Proposed project licence: GNU GPL version 2 or later, consistent with The Long
Wake. Retain all applicable third-party notices. Credits identify Heisenberg
as creator and retain required contributor attribution. Include complete
corresponding source and licence text with release distributions.

18. FIRST RELEASE AND LATER EXTENSIONS

First release includes the complete basic campaign: officers, government,
three troop types, supply, automated battles, sieges, recruitment, captivity,
computer opponents, outlaw recovery, treaties, coalitions and shared victory.

Possible later additions include family relationships, succession, naval
routes, richer espionage, scenario editing and network multiplayer. These must not
delay or complicate the initial rules. Historical characters, tactical battle
screens and external networking are outside the first-release scope.

19. ACCEPTANCE CRITERIA

Before a release is considered ready:
  The Linux desktop application builds and runs on documented Linux targets.
  GUI resolution and headless seeded simulations produce equivalent state.
  An extended simulation of at least 10,000 turns finds no counter overflow,
  resource underflow, invalid ownership, officer duplication or roster loss.
  Simulations exercise war, coalition victories, betrayals and landless play.
  No fixed turn or year ends a campaign.
  Human and computer factions obey the documented standing-order rules.
  Game time advances only on a confirmed End Turn after all human commitments.
  Repeated clicks cannot resolve the same turn twice or spend resources twice.
  Crash and corruption recovery preserve a complete, validated world.
  Treaty notice, joint occupation and victory resets have explicit tests.
  A first-time player can identify and submit useful orders from the menus.
  Map artwork, province hit regions and legal routes agree at every zoom level.
  Mouse and keyboard can each perform all essential gameplay actions.
  Hotkeys respect text entry and modal dialogs.
  Window resizing and UI scaling preserve readable essential controls.
  Save/load preserves pending orders, turn commitments and random state.
  Installation and launch work without any BBS or scheduled service.
  Documentation agrees with tested rules and includes installation examples.

END OF SPECIFICATION
