Skip to content

Content catalogs for game modules

A catalog is a table of rows a designer edits in the Dashboard. The module declares its row type in manifest.json and reads the rows of the release; it never writes them.

"content": {
"seasons": {"row": "Season", "key": "key", "window": "window", "exclusive": true},
"tiers": {"row": "Tier", "indexes": ["season"]},
"settings": {"row": "Settings", "single": true, "default": {"xpPerWin": 10}}
}
season, found := seasons.Current()
for _, tier := range tiers.BySeason(season.Key) { ... }
xp := settings.Get().XpPerWin

The name of a catalog is the generated package variable.

OptionMeaningGenerated
rowAn object type of types. Required.All() []T
keyA string property that names each row, unique in the catalog.Get(key) (T, bool)
indexesString or integer properties to look rows up by.By<Field>(value) []T
windowA property of type rudder:window: when the row is active.Active() []T
exclusiveWith window: windows must not overlap.Current() (T, bool)
periodA property whose enum values day, week, month say the row starts again. Shown on the Calendar only.
singleExactly one row: the settings of the module.Get() T
defaultWith single: the row a new install starts from.
  • Rows keep the order the designer gives them; All, By<Field> and Active return that order.
  • A row without the window property is always active. A window is half-open, from start to end; a missing bound is open.
  • A method the catalog does not declare does not exist, so a wrong lookup is a compile error.
  • A single catalog takes no key, indexes or window. Its row is written into the draft from default when the module is installed, and an update adds the properties a new default brings while keeping what an operator saved.

rudder.Window has Open(), Closed() and Finished() at the time of the call, for a window that is a field of a row rather than the window of the catalog:

if !offer.Window.Open() {
return OfferState{}, ErrNotOnSale
}

A row is checked when it is saved and again when a release is published:

  • its type: required properties present and not null, no unknown property;
  • its key: present, a non-empty string, unique in the catalog;
  • its window: the end after the start;
  • every amount, at any depth: a currency of the project, not negative.

What one row cannot tell, such as windows that overlap in an exclusive catalog or a row that stopped fitting after an update, is a problem of the catalog: shown above its rows and refusing a publish until fixed.

Example rows live in samples/<name>.json next to manifest.json, and an operator adds them in a click from the Samples tab of the module:

{
"title": "A potion and a sword",
"description": "Two items to start with.",
"catalogs": {
"items": [
{"key": "potion", "name": "Potion", "kind": "stack", "stack": 99, "tradable": true},
{"key": "sword", "name": "Sword", "kind": "unique", "tradable": true}
]
}
}

A file name is lowercase letters, digits and dashes. A sample has a title and rows of catalogs the module declares, one row at most for a single one. Adding a sample skips a row whose key is taken; a row that fails its checks refuses the whole sample. A sample that names a currency needs that currency in the project first. Samples are uploaded with the module and never reach a release.