Technical Details
This page summarizes game v1.4.0 and competitive rules spec v3.0 in player-readable form. Implementation-grade details live in the Phalanx Duel game repository.
Turn Sequence
Rules spec v3.0 executes a deterministic 8-phase lifecycle, including the optional DeploymentPhase. Attack declaration and combat resolution happen inside that lifecycle, not as a standalone loop.
Gameplay Loop
The game alternates deterministic turns. Each turn emits events for all phases, even if no state changes occur.
Draw 12, alternate deploy] --> T[Turn Trace] T --> U[8 Phase Execution] U --> V{Continue Match?} V -- Yes --> T V -- No --> X[Match Termination]
Statechart
State-level view of the canonical turn lifecycle.
Suit Ability Timing
Suit effects are evaluated at boundaries during attack resolution. Canonical boundary order is Shield -> Weapon -> Clamp.
| Suit | Role | Boundary | Canonical Trigger | Practical Effect |
|---|---|---|---|---|
| Diamonds | Shield | Card -> Card | If the current destroyed card is a Diamond and the next target is a card | Reduces carryover before the next defender takes damage |
| Hearts | Shield | Card -> Player | If the last destroyed card before the player is a Heart | Reduces final player damage (Hearts do not stack) |
| Clubs | Weapon | Card -> Card | If the attacker is Club and this is the first eligible boundary after the first destruction | Doubles carryover once per attack |
| Spades | Weapon | Card -> Player | If the attacker is Spade and carryover reaches the player | Doubles final player damage |
Match Termination Signals (Canonical Concepts)
- Player damage: Attack resolution can reduce player LP when carryover reaches the player boundary.
- Pass limits: Exceeding consecutive or total pass limits results in forfeit.
- System errors: Deterministic invariant violations terminate the match with an unrecoverable error event.
- Important: Rules spec v3.0 uses deterministic draw/liveness semantics; empty draw pile alone is not an automatic loss.
Classic Special Cards
- Classic Aces: A front-rank Ace is destroyable only by a direct Ace attack at target index 0.
- Classic Face Cards: Jack/Queen/King destroy eligibility is rank-restricted (J < Q < K hierarchy).
- Origin attacker is immutable: Destroy eligibility is determined by the original attacker across the full target chain.
Competitive Model (Glicko-2)
- Ratings System: v1.4.0 includes the Glicko-2 matchmaking and ladder surface. (See Competitive Play)
- Ranked Lobbies: Public matches contribute to a global leaderboard with volatility and rating deviation tracking.
- Cross-Platform Rankings: Rankings are unified across Web, CLI (Go), and Mobile clients.
Combat Mathematics
For incoming damage d and target HP h, a normal card transition is absorbed = min(d, h), remainingHp = max(0, h - d), and carryover = max(0, d - h). Classic Ace and Face eligibility are explicit branches, not hidden randomness.
At a Card -> Card boundary, a destroyed Diamond subtracts its shield before an eligible Club doubles the remainder. At Card -> Player, the final destroyed Heart subtracts its shield before an attacking Spade doubles the remainder. All values clamp at zero.
The server records these integer operations as a schema-versioned witness. The same witness drives live events, previews, narration, replay, and the post-match Proof of Damage.
Observability & Verification
- OTel Native: Full OpenTelemetry integration for distributed tracing of match lifecycles.
- Ledger Persistence: Every match is backed by an append-only action ledger, allowing for full state rehydration and crash recovery.
- Scientific Assurance: Rule evidence, mutation checks, liveness properties, replay equivalence, and observer noninterference qualify each correctness claim.
- Combat Reference Proof: An implementation-independent model checks 2,355,388 declared finite cases with a pinned result digest.
Trust Model (Why This Matters Online)
- Phalanx Duel uses a server-authoritative architecture in digital play.
- The server validates actions against the rules engine.
- Turns emit structured events and can be replay-verified with hashes.
- Identical inputs must produce identical outputs under the same spec version.