Skip to content

tilttek/journal

✅ published

A campaign's story in one journal: session summaries drafted from what happened and reviewed before they are published, a character's journal kept by its player, solo play journals, and what players remember of the games they recorded — each block kept from the readers it is not for.

tilttek/journal keeps the entries of a journal — a campaign's, a solo game's, a table's — and reads each of them for one reader at a time. What a reader knows comes from tilttek/player-knowledge: a secret block of an entry is one of its secrets, seen by the players it was revealed to and by the game master.

  • Four genres. A session summary, a character's journal (its subject is the character), a solo game's journal, and what a player remembers of a play recorded in a log of games played (its subject is the play: the entry reads that log, it does not copy it).
  • Drafted from the session. The rolls, the cards drawn, the quests and the loot of a session, as the application sums them up, become a draft in the order they happened, without the events whose secret the writer does not know. Nothing is published on its own: the writer rewrites the draft, then publishes it.
  • Proposed, then reviewed. A block proposed to the writer — a draft written by an assistant, a text offered by another player — keeps the entry from being published until the writer accepts or rewrites it.
  • Rolls and oracles among the text. A block is text, a roll, an oracle answer, a writing prompt or an event of the session, for the application to render each its own way.
  • Who reads what. An entry and each of its blocks are for every reader, for the game master and the author, or for the author alone; a block may also hide behind a secret of the campaign. A draft is read by its author and the game master only.
  • Linked to the world. A block names a page of the campaign's world as [[The Mill]] or [[The Mill|the old mill]]; a directory the application gives — a wiki, a list of characters — says which page each name leads to for each reader.
  • Whose turn to write. WriterRotation names the next writer of a session's summary from the roster and who wrote so far.
  • Exported. Every entry a reader sees, as they see it: arrays for JSON, or one Markdown document.
  • Edited safely. Each change names the version it was made on; an entry changed meanwhile is refused, nothing kept.

The facts — an entry drafted, changed, published, withdrawn, removed — go to an observer, each once, by identifiers only; the publication carries the genre and the author, so that a listener rewards the writer of a summary.

It is a plain PHP library on tilttek/player-knowledge: one service, value objects, ports and a store kept in memory for tests.

Status

PartState
Entry, Genre, EntryState, Audience: entries, their genre, subject, audience and stateImplemented and tested
Block, BlockKind, BlockOrigin: blocks, their kind, audience, secret and originImplemented and tested
Mentions, Mention: [[Name]] and [[Name|text shown]] read in one passImplemented and tested
Journal: draft, assemble, retitle, write, accept, publish, withdraw, remove, read, timelineImplemented and tested
Reader, EntryView, BlockView, Segment: an entry as one reader sees itImplemented and tested
WriterRotation: the next writer of a session's summaryImplemented and tested
Export\MarkdownExport: one Markdown document of the entries a reader seesImplemented and tested
Store\InMemoryJournalStore: the store of the testsImplemented and tested
tilttek/journal-bundle: the Symfony bundle, its Doctrine store, its events and the erasure of a memberImplemented and tested
Pages and the editor of the entriesNot started

Documentation

DocumentWhat it covers
InstallationRequirements, installing and wiring.
The journalGenres, entries, blocks, audiences, drafts, reviews, readers, mentions and exports.
Extension pointsThe store, the directory, the source of events, the observer and who may do what.
ExceptionsJournalExceptionInterface 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\Journal\Block;
use Tilttek\Journal\Journal;
use Tilttek\Journal\Reader;
use Tilttek\PlayerKnowledge\Perspective;

$journal = new Journal($store, $knowledge, $pages, $events, $observer);
$writer = new Reader('ana', $knowledge->snapshot('campaign-7', Perspective::atTable('mira', 'ana')));

$draft = $journal->assemble('summary-12', 'session-12', 'The siege of the mill', $writer);
$entry = $journal->write('summary-12', $draft->version, [
    new Block('b1', 'We held [[The Mill|the mill]] until dawn.'),
    ...$draft->blocks,
]);
$journal->publish('summary-12', $entry->version, $clock->now());

$view = $journal->read('summary-12', new Reader('bo', $knowledge->snapshot('campaign-7', Perspective::atTable('rook', 'bo'))));
// Bo sees the blocks he may see, and a link to the mill if its page is one he may see.

Requirements

PHP 8.5 or later, with the mbstring extension, and tilttek/player-knowledge.

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.