Skip to content

Homebrews and adoption

tilttek/homebrew-hub

A homebrew is a set of house rules an author shares on the hub for any table to adopt. Its content is that of a version of a table's rules in tilttek/table-rules — house rules, rule variants of a game system, the game system and a note — with a title, a summary and tags to find it by, and a licence.

Drafts

Draft is what an author publishes, checked before it becomes a release:

PartBounds
The titleOne line, 1 to 120 characters, trimmed.
The summaryOptional, 1 000 characters and 20 lines at most; an empty summary is none.
The tagsUp to 10 identifiers of 48 characters at most, each once, sorted.
The rulesThose of tilttek/table-rules: up to 200 Rule, each identifier once, their texts 100 000 characters together. The identifier of a rule is 79 characters at most.
The variants and the systemIdentifiers, up to 100 variants, each once, sorted.
The noteWhat changed since the last release, optional.
The licenceA Licence.

A draft holds at least one rule or one variant. Every text is valid UTF-8, without control characters nor the characters that reorder the text shown. Draft::fromRelease() starts a draft from a published release: the start of a remix, or of the next release.

Releases

HomebrewHub::publish() makes the homebrew with its release 1 when no homebrew has the identifier — an identifier of 48 characters at most — and publishes the next release of it otherwise. Only its author publishes it. A release is never changed once published; the homebrew takes the title, summary and tags of the latest draft. The same rules, variants, system and licence as the latest release are refused, whatever the note says; a change of licence alone is a release. A homebrew holds 50 releases at most. HomebrewHub::release() reads one, and HomebrewHub::diff() says what changed between two, in either order: the rules added, removed, moved and changed, line by line, the variants and the system.

Licences

LicenceValueSPDXOthers may remix it under
PublicDomaincc0CC0-1.0any licence
Attributioncc-byCC-BY-4.0any licence
AttributionShareAlikecc-by-saCC-BY-SA-4.0cc-by-sa alone
AttributionNonCommercialcc-by-ncCC-BY-NC-4.0cc-by-nc, cc-by-nc-sa or cc-by-nc-nd
AttributionNonCommercialShareAlikecc-by-nc-saCC-BY-NC-SA-4.0cc-by-nc-sa alone
AttributionNoDerivativescc-by-ndCC-BY-ND-4.0none
AttributionNonCommercialNoDerivativescc-by-nc-ndCC-BY-NC-ND-4.0none
AllRightsReservedall-rights-reservednonenone

Licence::permitsRemixUnder() applies the table. The hub keeps the credit of every remix whatever the licence; the application shows it, and reads requiresAttribution() to say that a licence asks for it. The licence is the author's choice: the hub checks how a remix keeps to it, not that the author holds the rights.

Remixes

HomebrewHub::remix() makes a new homebrew from a release of another one. The remix keeps an Origin of the release it starts from — the homebrew, the release, its author, its title and its licence as they were — after those of the homebrew it remixes: its lineage names the original first, and source() the homebrew remixed. A lineage credits 10 homebrews at most: a homebrew that credits 10 is not remixed further.

Someone other than the author of the source remixes it under a licence the source allows, and every later release of the remix keeps to it. An author remixes their own homebrew under any licence. A retired homebrew is not remixed.

Endorsements

HomebrewHub::endorse() records that a member endorses a homebrew; withdrawEndorsement() takes it back. A member endorses a homebrew once: endorsing again, or withdrawing what is not given, changes nothing and tells nothing. An author does not endorse their own homebrew, a retired homebrew takes no new endorsement, and a homebrew holds 10 000 at most.

Retirement

HomebrewHub::retire() retires a homebrew, for good, at the request of its author. A retired homebrew takes no new release, remix, endorsement nor adoption, and a search leaves it out unless it asks for the retired ones. The tables that follow it keep the release they adopted.

HomebrewHub::search() gives the homebrews that answer a HomebrewSearch, as View\HomebrewCard:

  • by game system of the latest release, by tag and by author, each optional;
  • the retired homebrews left out unless includeRetired is set;
  • SearchOrder::MostEndorsed — the most endorsed first, then the latest release the most recent — or SearchOrder::RecentlyReleased, then by identifier;
  • 1 to 100 a page, from 0 to 10 000 in.

A card holds the identifier, the author, the title, the summary, the tags, the number, licence and game system of the latest release, the endorsements, whether the homebrew is retired, and its lineage; toArray() gives it as plain data.

Adoption

Adoption::adopt() adopts a release of a homebrew — the latest when no number is given — into the rules of a table, and the table follows the homebrew:

  • the rules of the release join the table's rules under the identifier of the homebrew, a dot and their own: gritty-healing.rest. The table's own rules and those of other homebrews stay as they are;
  • adopting another release of the same homebrew — later or earlier — puts its rules where the first rule of the release before stood, or after the others when none is left;
  • the variants of the release join those of the table; the game system of the release becomes the table's when the table names none, and a table that plays another game system is refused;
  • the version of the table's rules is published with a note that names the release and the homebrew, and every player accepts it anew; when the rules already hold, nothing is published.

The table's rules and the subscription are kept in one Contract\Transactions, or neither. Adopting the release the table holds is refused, as is a retired homebrew; a table follows 20 homebrews at most. What tilttek/table-rules refuses — too many rules, a variant the game system does not offer, a rulebook changed meanwhile — goes through as its own exception, and nothing is kept.

Adoption::drop() stops following a homebrew and takes its rules out of the table's rules; the variants it brought stay, for the game master to drop with tilttek/table-rules. A table left with neither rule nor variant is refused.

Subscriptions

Adoption::subscriptions() gives the homebrews a table follows, by identifier, as View\SubscriptionView:

View\SubscriptionStateWhenchanges
UpToDateThe table holds the latest release.null
UpdateAvailableA later release is out.What changed from the release adopted to the latest.
RetiredThe homebrew is retired, no longer found, or no longer has the release adopted.null

toArray() gives a view as plain data, with the title and the numbers of the release adopted and of the latest.

Content packs

Codec\DraftJson writes a draft to a JSON document and reads it back, to export a release and import it elsewhere:

{
    "format": "tilttek.homebrew-hub.draft",
    "version": 1,
    "title": "Gritty healing",
    "summary": null,
    "tags": ["grim"],
    "licence": "cc-by-sa",
    "system": "srd-5",
    "variants": ["slow-healing"],
    "note": null,
    "rules": [{"id": "rest", "title": "Rest", "text": "A long rest takes a week.", "category": "healing"}]
}

Reading refuses with InvalidHomebrew a document larger than 512 KiB, nested deeper than the format, of another format or version, with a key the format does not know or a value of the wrong type, and any value out of the bounds of a draft. The optional keys may be left out. The codec never reads a file nor a URL: the application gives it the text.