Jump to content

Unity.Shared/SPEC

From MindAttic Docs

Unity.Shared — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

Place in the ecosystem: An engine kit (docs/ECOSYSTEM.md §2.1): the profile, settings, mute and headless code every MindAttic Unity game shares.

Unity.Shared (com.mindattic.unity.shared) is the Unity package every MindAttic game references for the player's profile and its one settings.json, the session mute and the shared --headless mode. It is for MindAttic's Unity games (GridGame.Unity, TownWalker, Unity.Cursory, Unity.Eve, Unity.SpaceGod, UnityRonin and the Unity.Rea.* games) and the developers who build them. A player's name, colour, volumes and language look the same from game to game, a damaged settings file never crashes a game, and game logic that reads settings is testable without Unity. The finished product is release 2: today's package, bug-hunted, compiled by every consumer, with a changelog and a whole-number version.

2. Scope boundary

2.1 In the product

  • Player profiles: list, select, create, rename, delete to trash.
  • One mindattic.settings v1 file per profile, with a typed common block and a free-form game block.
  • A dependency-free JSON codec and atomic file writes.
  • Session switches: -muted and --headless, which never touch the saved file.
  • The standard app icon asset and the package docs.

2.2 Never in the product

  • Renaming to Unity.Rea.Shared (MAU-T15, MAU-T20–T22). It is MindAttic's own package, not reverse-engineered, and 13 manifests reference its path.
  • A save system. Profiles/<Name>/Saves/ belongs to each game (BIBLE §3).
  • Networking or UI. Those are Unity.Multiplayer and MindAttic.Components.
  • Newtonsoft or System.Text.Json. The package carries its own small JSON codec (BIBLE §3).
  • Shared systems no game asked for, such as save formats, input or localisation.

3. Users and roles

  • Player — has one or more profiles whose settings follow them across games.
  • Game developer — reads the profile with one line and keeps game-specific settings in the game block.
  • Automation — runs a game muted or headless for tests and bots.

4. Requirements

Status is built (closed ticket, with evidence) or MS-40, the active milestone, which is also the finished product.

E1. Profiles and session switches — MAU-T38 — built

Player profiles with one settings.json each, the session mute and headless mode.

F1.1 Profiles and settings — MAU-T39 — built

  • S1.1.1 Profiles and settings v1 — MAU-T2 — built As a game developer, I want profiles, mindattic.settings v1, MiniJson and atomic files, so that every game reads and writes the player's settings the same way. Acceptance:
    • Given a settings file with fields a newer game wrote, when an older game loads and saves it, then those fields survive.
    • Given a file that is not JSON, when it loads, then it is renamed .bad-<UTC> and defaults are used. Evidence: c8b90c0, tests/Core.Tests.
  • S1.1.2 Hardened codec and store — MAU-T17 — built As a player, I want odd input never to crash or corrupt my profile, so that settings are always safe. Acceptance:
    • Given a number past the JSON limits or a surrogate pair at the truncation point, when it is read or written, then nothing throws and the text stays valid. Evidence: 3ce3b8a.

F1.2 Session switches — MAU-T41 — built

  • S1.2.1 Session mute — MAU-T11 — built As a CLI or test, I want -muted or MINDATTIC_CLI_MUTED=1 to silence one run, so that automation makes no sound. Acceptance:
    • Given -muted, when a game runs, then it is silent and settings.json is not written. Evidence: d2f188e.
  • S1.2.2 Headless mode — MAU-T18 — built As automation, I want --headless to run a real game muted with no window, so that bots and tests can play it. Acceptance:
    • Given tools/Start-Headless.ps1, when a player starts, then it logs MINDATTIC_HEADLESS_READY <productName>. Evidence: f51d7c5.
  • S1.2.3 One session-switch reader (debt) — MAU-T42 — built As a game developer, I want the session switches read in one place, so that mute and headless parse the command line the same way and the profiles facade holds only profiles. Acceptance:
    • Given -muted, MINDATTIC_CLI_MUTED=1 or --headless, when a game starts, then the session is muted and settings.json is not written, as before; the parsing exists once; Profiles keeps only obsolete forwarders. Evidence: Runtime/Core/SessionSwitches.cs (Muted, MuteRequested, IsTruthy, HasSwitch, CommandLineArgs, read by Headless.Requested and Profiles.OverrideRoot), Runtime/SessionSwitchesBootstrap.cs; forwarders on Profiles are [Obsolete] until after release 2.

F1.3 Shared assets and docs — MAU-T40 — built

  • S1.3.1 Standard app icon — MAU-T14 — built As a game developer, I want the standard Unity app icon as a shared asset, so that every game's build looks the same. Acceptance:
    • Given the package, when a game builds, then it can use the shared icon. Evidence: f4b1c57.
  • S1.3.2 Published docs — MAU-T4 — built As a game developer, I want the package documented where I can read it, so that I use it without reading its source. Acceptance:
    • Given docs/, when published, then the format, API and headless mode are documented. Evidence: b6353d0.

E2. Stable package — MAU-T25 — MS-40

The package is bug-hunted and every consuming game compiles against main.

F2.1 Bug hunt — MAU-T27 — built

  • S2.1.1 Exhaustive bug hunt — MAU-T24 — built As a player, I want the package's real bugs found and fixed, so that release 2 is solid. Acceptance:
    • Given profiles, settings, JSON and headless, when the hunt ends, then every confirmed bug is fixed under its own ticket. Evidence: 1 found, 1 fixed: MAU-T46 (JsonObject.GetFloat gave an infinity for a number beyond float range), 1b6f5dd.

F2.2 Consumers compile — MAU-T28 — MS-40

  • S2.2.1 Consumer compile pass — MAU-T31 — MS-40 As the owner, I want every game that references the package batch-compiled against main, so that release 2 breaks nobody. Acceptance:
    • Given each consuming game, when compiled in batch mode, then it builds with no errors.
  • S2.2.2 Follow GridGame's rename — MAU-T36 — MS-40 (requires GG-T2260) As a reader, I want the package's code and docs to name GridGame by its new name, so that the references stay true. Acceptance:
    • Given GridGame's folder move, when it lands, then CommonSettings.cs, the docs and the brochure use the new name.
  • S2.2.3 Consumers, as named, compile (membrane) — MAU-T45 — MS-40 Acceptance:
    • Given main after MAU-T36 and MAU-T42, when every consumer is batch-compiled, then each builds and the docs' consumer list matches the list compiled. Joins S2.2.1 and S2.2.2.
  • S2.0.1 Hunted package, compiled consumers (membrane) — MAU-T43 — MS-40 Acceptance:
    • Given the hunt and MAU-T45 closed, when their records are cross-read, then the compile ran on a main holding every hunt fix. Joins F2.1 and F2.2.

E3. Polish and release 2 — MAU-T26 — MS-40

The package ships as documented whole-number release 2. This epic is the release's polish and release step.

F3.1 Changelog and version — MAU-T29 — MS-40

  • S3.1.1 Cut release 2 — MAU-T32 — MS-40 (requires MAU-T24, MAU-T31) As a game developer, I want version 2.0.0 with a CHANGELOG.md, so that games build on a known version. Acceptance:
    • Given the package, when released, then package.json is 2.0.0 and CHANGELOG.md describes profiles, settings v1, the mute and headless mode.

F3.2 Docs — MAU-T30 — built

  • S3.2.1 Link the bible, charter and spec — MAU-T33 — built As a reader, I want the overview to link the bible, charter and spec, so that I find the package's rules and scope. Acceptance:
    • Given docs/overview.md, when read, then its Scope section links BIBLE.md, RELEASE.md and SPEC.md. Evidence: MAT-T395 (the README is a generated wiki pointer since MAU-T37, so the links live in the overview).
  • S3.0.1 Release 2 as documented (membrane) — MAU-T44 — MS-40 Acceptance:
    • Given release 2 cut, when package.json, CHANGELOG.md and docs/ are read together, then version, changelog and docs agree and the overview links the changelog. Joins F3.1 and F3.2.

5. Non-functional requirements

  • Engine-free Core (netstandard2.1, C# 9, warnings as errors), covered by tests/Core.Tests (MAU-LAW-5).
  • Loading never throws (MAU-LAW-2); writes are atomic (MAU-LAW-3); deletes go to the trash (MAU-LAW-4).
  • Session switches never touch the saved file (MAU-LAW-6).
  • File format: UTF-8 without BOM, two-space indent, LF.
  • Versioning: whole-number versions (HOUSE-LAW-1).

6. Interfaces and dependencies

  • Platform owners it relies on (docs/ECOSYSTEM.md): none; it is itself the platform for Unity profiles and settings (UI controls stay in MindAttic.Components).
  • Uses: nothing outside Unity; its JSON codec is its own.
  • Used by: GridGame.Unity, TownWalker, Unity.Cursory, Unity.Eve, Unity.SpaceGod, UnityRonin and the Unity.Rea.* games, by file:../../Unity.Shared/unity/com.mindattic.unity.shared; Unity.Multiplayer's front end reads the profile through ProfileIdentitySource.
  • Contract: Profiles.Current.Settings.Common and the mindattic.settings v1 format in the overview.

7. Release sequence

  1. MS-40 — Unity.Shared 2: the stable profile, settings and headless package every game uses (active). Epics MAU-T25 Stable package (900) and MAU-T26 Release 2 (800), its polish-and-release step. Reaching it finishes the product.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from the BIBLE, RELEASE, overview, code and the ticket history; release 2 is the finished product; MAU-T36 seated under MAU-T28; MAU-T33 done in the overview MAT-T395
2026-11-30 MAT-T462 single-source pass: 2 renamed, 0 buckets, 3 requires added; place in the ecosystem and platform owners named MAT-T467
2026-12-01 Build-up plan phase: ledger 19/19 read and seated (R12); debt S1.2.3 (MAU-T42) filed under F1.2 without reopening it (R13), required by MAU-T31, T32 and T45; membranes S2.2.3 (MAU-T45), S2.0.1 (MAU-T43), S3.0.1 (MAU-T44) MAU-T42
2026-12-01 Build phase: S2.1.1 built (one bug, MAU-T46); F2.1 built MAU-T24
2026-12-01 Build phase: debt S1.2.3 built: SessionSwitches owns the mute and the switch parsing; Profiles mute members are obsolete forwarders, to be removed after release 2 MAU-T42
Part of Unity.Shared.
From Unity.Shared/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.