Skip to content

tilttek/character-retirement

✅ published

When a character retires, dies or is lost: its sheet frozen as it stood, the cause, the epitaph its player writes, the memorial of its campaign, and a way back.

tilttek/character-retirement ends a character's story in a campaign without losing it. The sheet comes from tilttek/character-sheet: at the end, the library freezes a copy of it — attributes, every value its rules derive, the charges left, equipment, the fields the campaign kept — and the sheet itself lives on, untouched.

  • An ending. A character retired, died or was lost — vanished, captured, its fate unknown — in a campaign its sheet joined, on a date and at a session. Its cause and its epitaph are written by people, never generated.
  • Private by default. An ending is read by its owner and the game master; its owner shares it with the campaign or with the public when they choose.
  • The memorial. The open endings of a campaign, the latest first, by pages, each viewer reading only what its visibility allows.
  • A way back. A character raised, out of retirement or found comes back: its ending leaves the memorial and stays in the history of its sheet, and the character goes on from its sheet. It can end again later.
  • Nothing to win. No points, badges or rewards come with a death: a tool of play gives nothing for losing a character.

The facts of an ending — ended, changed, returned, erased — go to an observer, each once, by identifiers only. A sheet or a member erased takes its endings with it.

It is a plain PHP library: one service, value objects, ports and a store kept in memory for tests. Its one dependency is tilttek/character-sheet, which keeps the sheets.

Status

PartState
FrozenSheet: a sheet as it stood, computed by its rules, written as plain values and read back checkedImplemented and tested
Ending, Fate, Visibility: an ending, its cause, epitaph, session, visibility and return, bounded and checkedImplemented and tested
CharacterEndings: end, cause, epitaph, share, bring back, history, remove, forget a sheet or an ownerImplemented and tested
Viewer and the memorial: the open endings of a campaign a viewer reads, the latest first, by pagesImplemented and tested
Store\InMemoryEndingStore: the store of the testsImplemented and tested
A Symfony bundle with its Doctrine store and its pagesNot started

Documentation

DocumentWhat it covers
InstallationRequirements, installing and wiring.
EndingsEnding a character, the frozen sheet, cause and epitaph, visibility, the memorial, coming back, forgetting.
Extension pointsThe store, the observer and its events, and who may do what.
ExceptionsCharacterRetirementExceptionInterface and its exceptions.
TestingThe library's tests, its fuzz target and its benchmarks.
ReferenceEvery type of the library, with its role.

Quick start

use Tilttek\CharacterRetirement\CharacterEndings;
use Tilttek\CharacterRetirement\Fate;
use Tilttek\CharacterRetirement\Viewer;
use Tilttek\CharacterRetirement\Visibility;

$endings = new CharacterEndings($store, $sheets, $observer);   // $sheets: a CharacterSheets of tilttek/character-sheet

$endings->end('ending-1', 'sheet-1', 'campaign-7', Fate::Died, $clock->now(), 'Fell at the bridge of Kel', 'session-12');
$endings->writeEpitaph('ending-1', "Here lies Wren,\nwho held the bridge.");
$endings->share('ending-1', Visibility::Campaign);

$endings->memorial('campaign-7', Viewer::member('member-2'));  // Wren's ending, frozen sheet and epitaph
$endings->current('sheet-1');                                  // the open ending: the character is out of play

$endings->bringBack('ending-1', $clock->now());                // raised: out of the memorial, back in play

Requirements

PHP 8.5 or later, with tilttek/character-sheet 0.1.

Contributing

Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.

License

MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Tilttek project. See LICENSE.