Files
linuxdistro-roguelite/README.md
T

123 lines
20 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Kernel Panic
A Unity card battler about Linux distributions and programming languages. Native cards resolve immediately; Python uses a FIFO queue, Haskell a LIFO stack, and Go persistent goroutines.
## Open and run
Use Unity **6000.4.8f1**, with Windows build support. Open this directory through Unity Hub, let the complete package set import, and start `Assets/Scenes/MainMenuScene.unity`. New profiles learn the game in a three-wave tutorial, including Cron Job's countdown and a Daemon miniboss. New normal runs have a ten-wave campaign ending with the Kernel Overseer. After clearing wave 10, bank your rewards or continue the same build into endless survival at wave 11.
Keep Unity `.meta` files alongside their assets in version control. `Library`, `Temp`, `Logs`, builds and local recovery scenes are excluded. Do not delete or regenerate metadata to resolve missing references.
In `ls ~/collection/languages`, unlocked playable languages offer **Learn more / practice fight**. C, C++, Rust, Python, JavaScript, TypeScript, Haskell, Java, and Go each have a replayable guided fight with a fixed loan deck, followed by free practice. Exit with Escape or the training button; completion returns to the selected language, with a retry option. Practice does not replace campaign checkpoints, advance daily quests, award currencies, or change mandatory tutorial progress. Languages whose cards are still planned show an availability note instead.
The mandatory tutorial retains the basic queue/stack turn-order demonstration. Python's detailed preparation, automation, modifier and payload lesson now lives in its optional fight, where players perform the combo and watch the captured payload replay.
## Campaign evolutions and combat feedback
Clear all ten campaign waves with **C selected as either run language** to permanently unlock **C++**, or with **JavaScript selected** to unlock **TypeScript**. Selecting both unlocks both. The unlock is saved at the completion boundary, including when continuing into endless survival, and remains available in collection, run setup and practice. Generated cards and distro exclusives do not qualify by themselves; optional training and legacy five-wave campaigns never qualify. Failed saves show a retry action and never announce a saved unlock.
Each evolution has three distinct starter cards (four cards including the duplicate) and eight repository cards, mirroring its base language's costs, rarities and roles. C++ strengthens C's effects, retains its elevated critical chance, transfers all remaining overkill and never causes segfault recoil. Its pointer chains after C++, and its sizeof counts both C and C++ cards in hand. TypeScript uses fixed damage without critical rolls: console.log deals 9, fetch 13, typeof always deals 16, Math.random 20, Promise.all 10 three times, Array.map 6 per enemy, Promise.resolve 5, JSON.parse 9 plus a draw, and eval 30. Its defensive and copy cards also improve. External buffs, distro mechanics and enemy defenses still apply.
The combat workspace includes **Turn resolution**: Go, Python automation, FIFO, Haskell LIFO, enemies and cleanup, with the active action highlighted and a bounded journal of actual damage, Shield and host losses. Completed results remain available during planning. The separate execution preview still shows public estimates rather than guaranteed outcomes. These observers never consume randomness or delay gameplay.
Run reports and recent history now include full-run totals, per-card plays/damage/Shield contributions and the final deck with its upgrades. Contributions group copies by card type and include Go ticks, Python payload replays and overkill spill without counting them as additional plays. Utility effects are not ranked. Statistics survive repository save/resume; older checkpoints explicitly report statistics only since resuming. Original-build loading retains its existing behavior.
New campaigns use encounter revision 3, adding alternate compositions and threat advice for waves 5–9. Old checkpoints retain their saved encounter revision. The boss remains wave 10. Combat repository/report screens, menu history, and collection language panels live in separate controller partial files; reusable turn-resolution and performance views own their own presentation.
## NixOS and Go
NixOS is a standard-pool five-star distro with 60 Uptime, 6 RAM and 3 Cycles. Ownership unlocks Go; Haskell and Go are recommendations, so any two unlocked playable languages remain valid. Select four of its five exclusive cards for the usual twelve-card starting deck. Existing pity, package/distro odds, duplicate Merges and upgrade prices are unchanged.
The host's CPU GOVERNOR controls accept clicks or keyboard focus and Enter. The current-governor shortcut beneath the host name scrolls to the controls and focuses an available policy, including in short windows. Each wave starts in `schedutil`. Switch once per player turn for one Cycle; selecting the active governor or an invalid action spends nothing. Governors apply only to card damage and explicit card Shield, at resolution time. Package Shield, status damage, healing, recoil, draw and duration are unaffected.
| Version | Release | Cumulative benefit |
| --- | --- | --- |
| V1 | 24.05 | performance: +20% damage/-25% Shield; powersave: -20%/+30%; schedutil: +5%/+5% |
| V2 | 24.11 | schedutil: +10%/+10% |
| V3 | 25.05 | First successful switch each wave is free |
| V4 | 25.11 | performance damage +30%; powersave Shield +40%; penalties retained |
| V5 | 26.05 | Switching to performance deals 5, powersave grants 6 Shield, schedutil draws 1 |
V5 bonuses bypass card scaling and card-play/draw riders. Performance uses the selected living enemy, otherwise the first living enemy in process order; without one, the switch is disabled. The Haskell `nixos-rebuild switch` card grants Shield and draws; it does not switch governors.
Go deploys at most three goroutines, each with a stable PID and at most five remaining ticks. A deployed card leaves hand RAM and stays outside draw/discard piles until termination. At Interpret, eligible goroutines tick once in deployment order, then Python FIFO and Haskell LIFO resolve. Deployment-round work does not tick. Extensions change only remaining ticks. Select a scheduler PID before playing a management card, or play the card and then select an eligible PID; Escape cancels selection without spending resources. `rollback` still heals when nothing can be extended.
Each goroutine snapshots its card magnitude once, while governor, Compilation and source damage buffs are read independently at each tick through the existing damage pipeline. Ticks never replay card-play events or equipment hooks. A dead, removed or reviving target is replaced by the first living enemy; no living target means the tick is consumed without damage. Final ticks, cancellation, wave changes, defeat and run termination release the slot and dispose of the source card exactly once. No background threads or animation-driven gameplay timers are used.
Card assets follow one layout: distro exclusives in `Assets/Data/Cards/<Distro>/`, language starters in `Assets/Data/Cards/Languages/<Language>/`, and repository cards in `Assets/Data/Cards/Shop/`. Language deck definitions and their database stay directly under `Languages/`. NixOS and Go use these same folders, alongside `GoDeck.asset`, `NixOS.asset` and `NixRebuildSwitch.asset`, registered in the existing databases. Runtime integration is in `CombatManager.NixGo.cs`, `NixGovernorState.cs`, `GoroutineScheduler.cs` and `GoEffect.cs`; `CombatSceneController.NixGo.cs` supplies the compact governor controls and PID rows. Saves retain the existing schema and language enum values; the Goroutine track is appended without renumbering existing tracks.
`NixGoTests`, `NixGoProgressionTests` and `CombatLayoutTests` cover gameplay, content registration, equipment, progression and UI. A development player can run the isolated UI/combat check with `--kernel-panic-smoke --kernel-panic-nixos-go-smoke --kernel-panic-save-path <absolute-unused-path>`. The equivalent `--kernel-panic-language-training-smoke` checks all nine lessons. Neither harness uses the real profile.
## Repository language coverage
Every playable language has at least eight run-only repository cards: C, Rust, Python, JavaScript, Java and Go each have eight; Haskell retains ten. All shop assets live directly in `Assets/Data/Cards/Shop/`, named `<Language><CardName>.asset` (for example, `CKernelExploit`, `PythonListAppend`, `JavaScriptMathRandom`, and `GoTimeTicker`). Asset names identify the language in the project browser; in-game titles retain their function/command names. Prices, rarity weights, language filtering and starter decks use the existing rules.
The expansion adds 29 cards:
| Language | New cards | Role |
| --- | --- | --- |
| C | memcpy(), memset(), realloc() | Drawing, area damage and corruption repair, with normal C recoil/spill |
| Rust | Vec::push(), Result::Ok, Option::take(), Mutex::lock(), Iterator::collect(), match, Arc::clone(), std::mem::drop() | Reliable hits, overkill Shield, defense, draw, copying and a same-language combo |
| Python | itertools.islice(), collections.deque(), sum(), contextlib.suppress(), map() | Immediate preparation and delayed damage/Shield payloads |
| JavaScript | Array.map(), Promise.resolve(), try...catch, JSON.parse(), eval() | Variable damage, area attacks, cycling and defensive recovery |
| Java | ArrayList.add(), StringBuilder.append(), Objects.requireNonNull(), try...finally, Stream.map(), Class.forName(), System.gc(), JIT.compile() | Two-RAM cards that build JIT warmup, with spill, draw, defense and a turn discount |
Python payload detection reads catalog operations rather than a fixed list of card IDs. New payloads participate in loops, zip and async capture; `map()` draws once on queue resolution, never on repeats or automation replays. `contextlib.suppress()` supplies a pure Shield payload and does not consume zip. Fixed draws remain fixed under magnitude upgrades.
## Test and build
Run the EditMode tests from Unity's **Window > General > Test Runner** window.
Build the game through **File > Build Profiles**, using the scenes configured in the project. The editor entry point `KernelPanic.Editor.PlayerBuild.BuildWindows` is also available for batch-mode Windows development builds; its default output is `Builds/Windows/KernelPanic.exe`.
For seeded balance measurements, use the editor entry point `KernelPanic.Editor.BalanceComparison.RunBatch`. These are bot measurements, not human win rates.
Campaign improvement validation: `Logs/improvements-tests-final.xml` records 998 passing EditMode tests. The additional unlock save-failure/retry check passes with the five settlement tests in `Logs/improvements-unlock-save-tests.xml`; the final responsive resolution panel passes all 23 combat layout tests in `Logs/improvements-layout-tests.xml`. `Logs/improvements-build-final.log` records a successful Windows development build with zero errors at `Builds/Improvements/KernelPanic.exe`. All nine language lessons pass isolated player checks at 1280x720 and 390x844, including actual-resolution captures, retry, exit and unchanged practice progression. Final captures and results are under `Logs/ImprovementsFinalWide-ad85afbdcdb147e69230db196c9c9bb1/` and `Logs/ImprovementsFinalNarrow-47ef11a7be2e4a44960a0ccb3fc3ccdc/`.
## Current run decisions
C balance tuning: C damage now has a 35% critical chance (down from 50%); critical damage remains 1.5x. Each C overkill jump transfers 50% of the remaining excess, rounded down, after the previous target's defenses. For example, 11 excess damage spills 5; if that target consumes 2, the next jump carries 1. Java still transfers all remaining excess, and Rust's overkill-to-Shield is unchanged. Base card damage and segfault rules are unchanged.
- Waves 2–9 offer connected route stops before their seed-selected encounters; wave 10 converges on the boss. Elite detours add a Daemon with a disclosed modifier and award eight Bits plus a draw rider on the first eligible card after clearing the wave (16 Bits total if no card is eligible); repairs restore up to six Uptime. Patch workshops improve a card, sacrifice altars exchange one card for a stronger upgrade, recyclers remove a card for Bits, and caches grant Bits. Previewing routes consumes no combat or shop randomness.
- After waves 2, 4, 6, and 8, choose a magnitude upgrade, a first draw rider on a chosen card, or eight Bits. Rewards last for the current run. The choice and its claim state survive repository saves.
- During normal combat, **prefetch** spends two Cycles to draw one card, once per turn. It requires two free RAM so any possible card fits. It does not bypass the draw order, corruption or card locks.
- Combat sounds have a volume/mute control in Settings. Audio observes events and has no effect on gameplay timing or randomness.
- Daemons hide a fresh action each round: Surge (8–10 damage), Harden (6–8 Shield), or Bypass (3–4 damage through Shield). Damage, including Shield-only hits, reveals the committed action for that round without rerolling it.
Focusing a hand card reveals its name and Cycles cost, including when its rules are taller than the hand viewport. Cards fit the available hand width on narrow screens; the rules remain freely scrollable.
Checkpoint versions 1–4 still load; older campaigns retain their original encounter timing and wave-five completion choice. New saves use envelope schema 9 and checkpoint version 5, including route topology, event results, travel history and run statistics. Seeded retries require the same game content and action sequence.
## Daily quests
The main menu's compact `[ cron.daily ]` widget sits below neofetch. The entire widget is clickable and reports the reset countdown, completed/claimed counts, three task progress readouts, and the exact number of unclaimed rewards in amber. Its terminal action highlights on hover/focus and switches from `> inspect tasks` to `> claim available rewards` when appropriate. Click it or focus it and press Enter to inspect descriptions and claim individual rewards in a terminal overlay. Escape or the close control restores previous focus. The existing prompt also accepts `cat /etc/cron.daily/quests`, including Tab completion; no extra navigation tab is added. Claims and daily resets update both views immediately. The widget and overlay have no animations.
The wider detail modal keeps its terminal command, reset countdown, and completion summary above the scrolling task list. Fixed-width ASCII bars and aligned numerical progress accompany subdued `[ in progress ]`, amber `> CLAIM REWARD`, or muted-green `[ CLAIMED ]` controls. A successful atomic save produces a two-line `[ OK ]` confirmation with the actual deposited currencies; failed saves never announce success. Focus moves to Close after claiming so repeated Enter does not advance into another reward.
Focus restoration distinguishes input methods: mouse-opened details return to the menu without a persistent widget focus highlight; keyboard-opened details restore the prior keyboard target, and the command alias returns to the prompt. Escape can release the widget's keyboard focus. Selecting a primary command with arrows or pointer hover also releases the widget, keeping Enter consistent with the selected command. Ordinary hover highlighting remains while the pointer is over the widget. This follow-up passes 78 relevant tests (`Logs/daily-quest-focus-tests.xml`), a zero-error Windows build (`Logs/daily-quest-focus-build.log`), and isolated mouse/keyboard player checks at 1280x720 and 390x844 (`Logs/DailyQuestFocusSmoke-16bd1b818f1046de9bbc6780170b64f2/`).
The main menu shows three distinct quests randomly selected from eight options: clear 3 waves, play 25 cards, deal 200 Uptime damage, block 40 damage with Shield, play 15 Native cards, deal 60 damage to enemy Shields, survive 8 enemy rounds, or clear wave 5. Each 24-hour reset picks a new set and never repeats the exact previous trio. The saved selection survives reopening the game and does not consume combat or shop randomness. Existing fixed quests keep their progress and claim status until their next reset.
Progress accumulates across normal runs and is saved as you play. Tutorial combat and self-damage do not count. Shield damage and Uptime damage advance their respective objectives; surviving rounds requires reaching Garbage Collection alive after the enemy phase. Only the three active quests can progress or pay rewards.
Each completed quest has an individual claim button. Rewards scale with the objective's difficulty and expected effort:
| Objectives | Bandwidth | Entropy |
| --- | ---: | ---: |
| Play 25 cards; play 15 Native cards | 75 | 25 |
| Deal 200 Uptime damage; block 40 damage with Shield | 100 | 50 |
| Clear 3 waves; deal 60 damage to enemy Shields; survive 8 enemy rounds | 150 | 75 |
| Clear wave 5 | 250 | 125 |
Quest details and payouts use the same reward table. Existing progress and claimed flags are preserved; already-claimed quests do not pay again when rewards change. Both currencies and the claim flag are saved together, so repeated clicks or saving retries cannot pay twice. Claim rewards before the countdown expires: progress and unclaimed rewards reset every 24 hours, anchored to the first quest initialization using the computer's UTC clock. Closing the game does not pause or restart the countdown.
Validation: `Logs/daily-quests-tests.xml` records 672 passing EditMode tests, including reset boundaries, save/reload, failed-save recovery, reward claims, gameplay events, and menu layouts at standard/large text sizes.
Difficulty reward validation: `Logs/daily-quest-difficulty-tests.xml` records 76 passing EditMode tests, including exact payouts for all eight objectives, duplicate-claim prevention after reload, preservation of previously claimed flat rewards, currency overflow checks, displayed reward amounts, and responsive quest layouts.
Final UI polish validation: `Logs/daily-quest-polish-tests.xml` records 77 passing tests covering all three states, claim counts, keyboard/mouse activation, alias dispatch, focus restoration, save-failure feedback, duplicate claims, countdown/reset updates, and standard/large text layouts. All three quests plus confirmation fit at the requested desktop sizes, including a 1024x576 logical viewport representing 1280x720 at 125% display scaling. Short viewports retain scrolling with a fixed header. `Logs/daily-quest-polish-build.log` records a successful Windows development build with zero errors. Five isolated player checks passed at 1920x1080, 1366x768, 1280x720, 960x400, and 390x844; captures and results are under `Logs/DailyQuestPolishFinal-a25f067715164a92a6b0632f62d06264/`.
Random selection validation: `Logs/daily-quest-variety-tests.xml` records 55 passing focused tests, including 120 daily selections, reload stability, fixed-quest migration, new combat objectives, inactive-quest rejection, and layouts covering all eight quest options.
The `[ cron.daily ]` redesign passes 66 focused tests in `Logs/cron-daily-final-tests.xml`, covering the compact/expanded layouts, mouse and Enter activation, Tab/Shift-Tab, Escape and focus restoration, command completion/dispatch, claims, and live countdown/reset updates. `Logs/cron-daily-final-build.log` records a successful development build. Isolated quest UI player checks passed at 1280x720 and 390x844, with visually inspected captures under `Logs/CronDailyFinal-c61dd55e9648437f81a5d9586900c144/`. Run this focused player check with `--kernel-panic-smoke --kernel-panic-quest-ui-smoke --kernel-panic-save-path <absolute-unused-path>`; it creates a quest fixture only in that isolated save. Earlier full-run smoke passed wide but stopped at the tutorial's `finish-zombie` target on narrow, before reaching quests; the focused quest check avoids that unrelated automation path.