Files
linuxdistro-roguelite/GENTOO_HASKELL_IMPLEMENTATION.md

12 KiB
Raw Permalink Blame History

Gentoo / Haskell expansion

This document describes the implemented expansion. KERNEL_PANIC_BALANCE_ANALYSIS.md is the earlier, pre-expansion audit, not the current content inventory.

Content and registries

  • Gentoo: 5 stars, 55 Uptime / 6 RAM / 3 Cycles, Haskell/C recommendations. Definition: Assets/Data/Distros/Gentoo.asset; passive: Assets/Data/Passives/EmergeWorld.asset; shared purple identity and original Gentoo-inspired terminal art: Assets/Data/Distros/Art/gentoo.txt.
  • Five exclusives in Assets/Data/Cards/Gentoo/: emerge --sync, ebuild, USE flags, make -j4, emerge --world. Existing four-of-five selection is unchanged.
  • Three starter definitions in Assets/Data/Cards/Languages/Haskell*.asset; HaskellDeck.asset contains map x2, foldr x1, thunk x1 (four cards, printed total cost 2).
  • Ten repository-only definitions in Assets/Data/Cards/Shop/Haskell*.asset: filter, fmap, zipWith, maybe, sequence, const, scanl, foldMap, deepseq, ($!).
  • CardDatabase, DistroDatabase and LanguageDeckDatabase register the new assets. Two pre-existing CardDatabase references incorrectly pointing at language decks were corrected to the existing list.append()/async def card assets. Their effects were not changed.
  • Resulting authored inventory: 63 cards, five playable distributions, six language starter decks. No package definitions or enemy values changed.

Authoritative mechanics

CompilationState is independent of combatant flat/magnitude/package buffs. StartWaveSequenced initializes it; GarbageCollect advances it after a completed round. Round IDs make repeat completion calls idempotent. V1/V2 start at 0; V3+ start at 1. V1–V4 cap at 4; V5 caps at 6. Version release labels and cumulative effects live in DistroVersionCatalog; existing Merge costs remain 50/120/250/500.

LazyStackEntry owns immutable target and multiplier snapshots. Pending Haskell count alone selects 100/150/200/250 percent; cloning a CardInstance does not copy a pending execution snapshot. The stack exposes its top-first entries to the UI. Storage does not fabricate resolved events when invoked without a CombatManager.

CombatManager resolves Python FIFO, then Haskell LIFO, then the existing enemy/garbage phases. The guarded evaluator has a finite initial work budget; reentrant evaluation is refused. Each popped card receives one resolving event, actual effects, one unscaled draw rider, one discard, and one resolved event. Drawn cards remain in hand. Dead targets use the existing deferred retargeting rules. Pending revival still blocks victory. Existing enemy exit/spawn sequencing is awaited between operations, with a guard preventing the exit coroutine from advancing the phase underneath the interpreter.

Pending operations are discarded and their target references cleared on victory, defeat, wave initialization and shutdown. Canceled pending cards do not receive false successful-resolution events. No multiplier, Compilation level, or inventory grant is driven by a UI callback.

Modifier provenance and rounding

DamageRequest.FromCard explicitly marks card-origin damage. It captures the current Compilation damage percentage at request construction (effect resolution), not at enqueue. Ordinary DamageRequests for enemy damage, recoil, DOT, package effects and already-scaled spill retain their existing path. Card effects add flat/magnitude once, then the damage pipeline adds existing language bonuses before multiplication. Rust overflow retains its existing special maximum-damage behavior.

For new multipliers, CardScaling combines exact decimal percentage arithmetic and rounds once to nearest integer, midpoint-to-even, matching Unity's RoundToInt tie policy. It clamps before int conversion. Existing crit rounding (ceil x1.5) and resistance rounding occur afterward. Shield uses the same final rounding before existing first-Shield package additions. Saturating additions prevent negative overflow of eligible amounts and Shield totals.

Examples without crit/resistance:

  • thunk, magnitude +2, captured x2.5: (4 + 2) * 2.5 = 15.
  • Same card, Gentoo V5 level 6: 6 * 2.5 * 1.5 = 22.5 -> 22.
  • foldr, x1.5: 3 * 1.5 = 4.5 -> 4 Shield and one draw.
  • emerge --world, x2.5, Compilation 6: 3 * 2.5 * 1.5 = 11.25 -> 11 per enemy; 2 * 2.5 * 1.3 = 6.5 -> 6 Shield.
  • make -j4 at Compilation 6: conditional base 11 becomes 16.5 -> 16, then a critical hit becomes 24. Spill is the remaining amount, without applying Compilation again.

Explicit card Shield includes ShieldEffect-style grants, not Rust overkill, package/status Shield or lethal recovery. Draw, healing, cycles, stacks, durations, number of hits and riders do not receive either new multiplier. Existing generic magnitude semantics are preserved: a +2 magnitude foldr draws three, not one, but never multiplies that draw count by Haskell's stack factor.

Progression and presentation

DistroRarity is the shared classification for gacha and collection: Arch and Gentoo are five-star; existing other distributions remain four-star. The standard pool and selector include both five-star distros. The beginner's final guarantee remains a five-star distro; it may now be Arch or Gentoo. Gentoo is not a selectable four-star beginner starter. Rates, pity, split, prices, duplicate Merge calculations, and version purchase logic are unchanged.

LanguageCatalog now links Gentoo to Haskell/C, not Assembly. Ownership unlocks Haskell globally using the existing rule. No new save fields or enum values were added; existing ID/version persistence handles Gentoo.

Shared distro presentation consumes Gentoo's art/accent in collection, run configuration, neofetch and gacha. Combat shows authoritative Compilation level/cap, damage bonus, and V4+ Shield bonus; it now shows the chosen run languages rather than distro recommendations. The scheduler shows top-first captured multipliers alongside existing active/completed indicators. Upgraded rules text displays changed printed quantities.

Compatibility and balance notes

  • Mint's existing no-multiplicative-damage and foreign-card-buff restrictions remain authoritative, including for Haskell. Haskell is selectable on Mint, but does not override its passive.
  • Maximum new combined damage scaling is x3.75 before other multipliers/crit; explicit Shield reaches x3.25. Multipliers do not compound through spill or repeated evaluation.
  • DNF's existing wave-long additive growth also benefits deferred cards at resolution. A deterministic fixture with max-level DNF, Compilation 6 and four unupgraded map instances deals 95 total damage before crit (14+20+27+34). This is a potential power outlier, not a newly added DNF mechanic. Max-level zram still raises Gentoo's maximum Cycles to 9.
  • Small integer hits can hide the V1 penalty through rounding (2 damage at 85% rounds to 2). No compensation or unrelated rebalance was introduced.
  • Existing repository language filtering also permits matching-language distro-exclusive cards; this existing rule was preserved.

Verification

Follow-up package repair: the earlier full-package import limitation described below has now been resolved. Regenerated GUIDs in the local Unity package metadata were restored from the matching official packages. A new isolated run with the complete installed package set, including URP/Shader Graph, compiled with 0 C# errors and passed 162/162 EditMode tests (Unity exit 0; 8.0090255 seconds test execution). See Tools/README.md for the root cause, backups, recovery script, and full-package result artifacts. The working project package manifest and lock file remain unchanged; a standalone player build and manual production-editor playthrough are still unverified.

Final executed result: 162 passed, 0 failed, 0 skipped, Unity exit code 0, test execution duration 10.5906419 seconds (excluding import/compilation). This includes 81 Gentoo/Haskell combat/content cases, 12 progression cases, and 69 existing regression cases. Runtime and test assemblies compiled successfully in the isolated Unity test environment described below. The earlier run found a narrow-screen multiplier overflow (fixed) and two incorrect test fixtures (corrected to follow existing zombie-reap and defeat rules); the full suite was rerun afterward. A further public new-run boot cleanup regression also passes.

Artifacts are retained at C:/Users/frederik/AppData/Local/Temp/KernelPanicGentoo-40125afe059144ab80f37bca6f1bb860/results-verified.xml and editor-verified.log in that same directory.

Automated coverage is in Assets/Tests/EditMode/GentooHaskellTests.cs and GentooProgressionTests.cs, alongside the existing UI, gacha and wave-completion suites. It exercises every new definition/base effect, version progression/reset, immutable LIFO snapshots, events/disposal/riders, conditional hits, crit, spill, Rust overkill, DOT/recoil exclusions, Rootkit, revival, upgrades, package interactions, pools, unlocks, starter construction, version purchases and the existing JSON save codec.

The combat viewport test builds the actual CombatSceneController views at 1920x1080, 1366x768, 1280x720, 1024x768 and 390x844. It checks Compilation text, top-first multiplier labels, and accessible end-turn bounds. A narrow-layout stack header now sits above its operations so multipliers remain inside the viewport. No automated test writes the player's live save.

Asset integrity checks found 289 unique, valid GUIDs and 63 CardDatabase references pointing to actual CardDefinition assets. Changed source/assets were hash-compared against the isolated validation copy. git diff --check passed (Git only reported the workspace's existing LF/CRLF conversion warnings).

Reproduction and environment limits

The main Unity editor remained open and was not closed or used to mutate the player's session. Tests ran with Unity 6000.4.8f1, graphics enabled, in an isolated copy of Assets/Packages/ProjectSettings:

Unity.exe -batchmode -projectPath <isolated-copy> -runTests -testPlatform EditMode `
  -testResults <isolated-copy>/results-verified.xml `
  -logFile <isolated-copy>/editor-verified.log

The production package manifest was not changed. A fresh copy initially stalled resolving network dependencies; mapping the complete package graph to the local cache then encountered package assembly/type errors in the URP/Collections dependency graph. The successful test environment instead uses Unity built-in modules plus the locally cached Unity Test Framework and NUnit. The game's runtime assembly has no external assembly references; its unchanged source and the actual UI Toolkit views compile and run in that environment. This validates gameplay/content/UI tests, not a full production package import or standalone player build.

Full-scene mouse/keyboard playthroughs and subjective visual/art review in the production editor remain manual checks. Persistence tests exercise the real JSON codec and ownership/version data, not disk writes to the user's live save. Existing saves, currency balances and package manifest were not modified.

File inventory

Created (each Unity asset/script has its matching .meta):

  • Assets/Scripts/Combat/CompilationState.cs
  • Assets/Scripts/Combat/GentooHaskellEffects.cs
  • Assets/Scripts/Data/DistroRarity.cs
  • Assets/Tests/EditMode/GentooHaskellTests.cs
  • Assets/Tests/EditMode/GentooProgressionTests.cs
  • Assets/Data/Distros/Gentoo.asset, Assets/Data/Distros/Art/gentoo.txt
  • Assets/Data/Passives/EmergeWorld.asset
  • Assets/Data/Cards/Gentoo/{EmergeSync,Ebuild,UseFlags,MakeJ4,EmergeWorld}.asset
  • Assets/Data/Cards/Languages/{HaskellDeck,HaskellMap,HaskellFoldr,HaskellThunk}.asset
  • Assets/Data/Cards/Shop/Haskell{Filter,Fmap,ZipWith,Maybe,Sequence,Const,Scanl,FoldMap,Deepseq,DollarBang}.asset
  • This implementation/verification document.

Modified:

  • Combat: CardEffects.cs, CombatContext.cs, CombatManager.cs, DamagePipeline.cs, LazyStack.cs.
  • Data/progression: LanguageCatalog.cs, DistroVersionCatalog.cs, GachaService.cs; CardDatabase, LanguageDeckDatabase and DistroDatabase assets.
  • UI: CombatSceneController.cs, CollectionScreenController.cs, ExecutionTrackView.cs, TerminalTheme.cs, Assets/Resources/KernelTheme.uss.
  • Existing CombatPresentationTests.cs: the obsolete null-context LazyStack test now tests storage/presentation events explicitly; real evaluation is covered by the new integration suite.

Pre-existing unrelated working-tree changes and metadata were preserved.