Global

Methods

callCreate(functionName, argsopt) → {*}

Description:
  • Dynamically imports the module for a create* function and invokes it with args. Runs identically on the main thread or inside a worker.

Source:
Parameters:
Name Type Attributes Description
functionName String

e.g. "createLocation"

args Object <optional>

the single named-parameters object the function expects

Returns:

whatever the create* function returns

Type
*

callExpand(guid) → {Object|null}

Description:
  • Expands a shimmed location (see createLocation's shim option) in place, by guid. Must run in the same worker that originally created the location, since it looks up the live location object (and its LocationTemplate) by guid in that worker's registries.

Source:
Parameters:
Name Type Description
guid String

the guid of a location previously produced by createLocation

Returns:

the same canonical location object, fully expanded, or null if this worker has no record of that guid

Type
Object | null

callGetLocation(guid) → {Object|null}

Description:
  • Looks up the canonical location object by guid, without expanding a shim.

Source:
Parameters:
Name Type Description
guid String

the guid of a location previously produced by createLocation

Returns:

the canonical location object, or null if this worker has no record of that guid

Type
Object | null

callRegisterLocations(locations)

Description:
  • Repopulates the worker's location registries from a previously-generated location tree (or array of trees) — see registerLocations' own doc comment for why this is needed.

Source:
Parameters:
Name Type Description
locations Object | Array.<Object>

one location tree, or an array of them

(static) createAppearance(character) → {String}

Description:
  • Describe a character's appearance and behavior. This description will be different each time the character is passed to this function.

Source:
Example
createAppearance({ character })
=> "Long brown hair, short stature"
Parameters:
Name Type Description
character Character

The character to describe.

Returns:

A description of the appearance and behavior of the character

Type
String

createBag(paramsopt) → {Bag}

Description:
  • Creates a collection of objects, held in a collection type known as a Bag.

Source:
Example
createBag({ count: 3, tags: "house"}).toString()
=> "A television (5/20), a winter jacket (worn; 0.5/10), and a ceramic bowl (3/1)."
Parameters:
Name Type Attributes Description
params Object <optional>
Properties
Name Type Attributes Default Description
value Number | String <optional>
10

the total value of items to add to the bag. The method will get as close to this value as possible, but may go over. If the value is a string, it is treated as dice notation.

repeat Number <optional>
20

This is the percentage chance that the last item selected will be added again. Can range from 0% (no repeated items) to 100% (only one item, as many as are needed to reach the other specified limits).

count Number <optional>
Number.MAX_VALUE

affects how many items will be added to the bag. The bag will not exceed this number of items.

enc Number <optional>
Number.MAX_VALUE

the maximum encumbrance of the bag. The method will get as close to this value as possible, but may go over.

uncountable Boolean <optional>
false

if true, items in the bag are treated as uncountable.

minValue Number <optional>
0

the minimum value of any items added to the bag (for some applications, like store stock, it is desirable to set this number above 0).

tags String <optional>
"*"

tags that will be used to search for items to add to the bag.

name String <optional>

a name for the bag.

description String <optional>

a description for the bag.

condition String <optional>

if the item selected has the “br” tag and thus has condition, you can fix it’s condition by passing it in to this method.

Returns:

a bag containing items that meet the specified criteria

Type
Bag

createBookTitle(optionsopt) → {string}

Description:
  • Generates a random fictional book title, optionally filtered by genre.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Book title creation options

Properties
Name Type Attributes Description
genre string <optional>

Genre of book to generate, selected from the values returned by getBookGenres(). If not provided, a genre is randomly selected.

Returns:

A generated book title

Type
string

createCharacter(options) → {Character}

Description:
  • Creates a new character with customizable attributes and generated characteristics.

Source:
Parameters:
Name Type Description
options Object

Character creation options

Properties
Name Type Attributes Default Description
kit string <optional>
"None"

Starting possessions or equipment (any value from getKitOptions())

age number <optional>
roll("14+3d12")

Character age in years

traits Object <optional>
{}

Initial trait values (e.g., { Cunning: 2, Strong: 2 })

gender string <optional>

Character gender ("male" or "female"). If not provided, randomly selected.

heritage string <optional>

Character heritage ("latino" or "anglo" lead to specific names, but any heritage can be provided). If not provided, randomly selected.

name string <optional>

Character name. If not provided, a name is generated.

preProfession string | Object <optional>

Character pre-collapse profession/career. Can be a profession name string or profession object, selected from the values returned by the getPreProfessions function. The option ”soldier” will select a military branch as a pre-collapse profession.

postProfession string | Object <optional>

Character post-collapse profession/career. Can be a profession name string or profession object, selected from the values returned by the getPostProfessions function. The option ”soldier” will select a military branch as a post-collapse profession. If “soldier” is selected pre-and post-collapse, the same branch will be used for both.

isChild boolean <optional>
false

Whether to create a child character (affects age and training)

Returns:

A new Character instance with generated or specified attributes

Type
Character

createCharacterName(params) → {CharacterName}

Description:
  • Generate a random name for a mid-century American, of the kind that would be wandering around an atomic era apocalypse. Does not add a nickname.

Source:
Example
createCharacterName({gender: 'female', heritage: 'latino'})
=> {"given": "Elena", "family": "Silva", "gender": "female", "heritage": "latino"}
let girl = createCharacterName({gender: 'female'})
girl.toString()
=> "Ada King"
Parameters:
Name Type Description
params Object
Properties
Name Type Description
gender String

'male' or 'female' name. Optional. If not specified, gender is 50/50.

heritage String

'anglo' or 'latino' (Optional. If not specified, 20% of names are Latino).

given String

set the given name to this name

family String

set the family name to this name

Returns:
Type
CharacterName

createContainer(optionsopt) → {Bag}

Description:
  • Creates a container (e.g., a first aid kit, cabinet, or ammunition box) of a given type, potentially pre-filled with items. Containers may be empty or show signs of prior use.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Container creation options

Properties
Name Type Attributes Description
type string <optional>

Type of container to create, selected from the values returned by getContainerTypes(). If not provided, a type is randomly selected.

Returns:

A new Bag instance (extends Bag) with a name, optional description, and items

Type
Bag

createEventLayer(options) → {void}

Description:
  • Enriches a location map with event-driven narrative content. Compared to the historical layer generator, this one is programmatic because the content is more difficult to integrate.

Source:
Parameters:
Name Type Description
options Object

Event layer options

Properties
Name Type Description
map Map

A location map keyed by location type (e.g. "Farm"). Modified in place.

Returns:
Type
void

createFamily(optionsopt) → {Family}

Description:
  • Creates a multi-generational family with characters, relationships, and a shared family name. The family tree simulates births, deaths, and partnerships over time. A generation is counted when a child is born into the tree.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Family creation options

Properties
Name Type Attributes Default Description
generations number <optional>
1

Number of generations to simulate. Higher values produce larger families with grandchildren and great-grandchildren.

kit string <optional>
None

How to equip members of this family

Returns:

A Family instance rooted at the founding mother, containing the full family tree

Type
Family

createGang(optionsopt) → {Gang}

Description:
  • Creates a gang of characters with a shared type, name, and profession-appropriate traits. Each member is a generated Character. Members may be assigned nicknames depending on gang type.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Gang creation options

Properties
Name Type Attributes Default Description
type string <optional>

Type of gang to create, selected from the values returned by getGangTypes() (e.g. "Biker Gang", "Street Gang", "Raiding Gang", "Cowboy Posse"). If not provided, randomly selected.

count number <optional>
null

Number of gang members to generate. If not provided, a count is rolled based on the gang type's configuration.

Returns:

A new Gang instance containing the generated member characters

Type
Gang

createHistoricalLayer(options) → {void}

Description:
  • Enriches a location map with pre-collapse historical narrative content. Selects locations and modifies them according to history rules: adding descriptions, renaming locations, placing items or containers, and optionally clearing their existing contents.

Source:
Parameters:
Name Type Description
options Object

Historical layer options

Properties
Name Type Description
list Array.<Location>

A list of locations (which are also in a parent/child relationship, as is produced by the createLocation function)

Returns:
Type
void

createHorse(optionsopt) → {string}

Description:
  • Generates a descriptive string for a horse, including its type, optional behavior, coat pattern, and name.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Horse description options

Properties
Name Type Attributes Description
gender string <optional>

Gender of the horse ("male" or "female"). Male horses may be stallions, geldings, or colts; female horses may be mares or fillies. If not provided, randomly selected.

Returns:

A descriptive phrase for the horse (e.g. "a nervous spotted mare named Clover")

Type
string

createItem(optionsopt) → {Item}

Description:
  • Creates a random item from the item database, optionally filtered by name, tags, value range, or encumbrance range. Automatically generates titles for books, magazines, and horses.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Item creation options

Properties
Name Type Attributes Default Description
name string <optional>

Specific item name to look up. If not provided, an item is selected by tags.

tags string <optional>
"*"

Tag expression to filter items (e.g. "firearm", "ammo:22", "food -luxury"). Supports the full tag expression syntax including |, space (AND), and parentheses.

minValue number <optional>
0

Minimum item value (in caps).

maxValue number <optional>
Number.MAX_VALUE

Maximum item value (in caps).

minEnc number <optional>
0

Minimum item encumbrance.

maxEnc number <optional>
Number.MAX_VALUE

Maximum item encumbrance.

condition string <optional>

Item condition: "poor", "fair", "good", "excellent", or "mint". Affects value for items that can break. If not provided, randomly selected by rarity.

itemDb ItemDatabase <optional>

An optional item database to search, if you have a subste of all items that you want to search. This is an optimization and is never required; see createBag for a use case.

Returns:

An Item instance matching the given criteria, or null if no match is found

Type
Item

createKit(params) → {Object}

Description:
  • Generate the possessions that would be on the person of an active NPC (e.g. out on patrol, out for a night on the town, out on a raid or in the middle of criminal activity).

Source:
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
profession String | Profession <optional>

profession name or instance

preProfession String | Profession <optional>

profession name or instance

gender String <optional>

gender of character (male or female)

kit String <optional>

One of three options, “None” (clothing only); “Patrol” (weapons only); and “Travel” (the full amount of equipment a person would carry to explore or travel).

Returns:

An object of two bags, one under the property "clothing" and another under the bag of "possessions".

Type
Object

createLocation()

Description:
  • Create a location. You must supply the type of a location template and an instance tree will be created from that point in the template hierarchy, working downward throw all child nodes templates, returning the resulting instance tree. Tags are not currently used in selection of templates, but may be in the future.

Source:

createLocationName(optionsopt) → {string}

Description:
  • Generates a name for a location node based on its type and its position in the location hierarchy. Supports sequence-based naming (e.g. "Room 1", "Room 2") and type-specific name generation (e.g. street names, building names, geographic features).

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Location name options

Properties
Name Type Description
child Object

The location node to name, with type (string) and parent (Object) properties representing its place in the location hierarchy.

Returns:

A generated name for the location node

Type
string

createMagazineTitle() → {String}

Description:
  • Magazines will be produced as generic items in bags, loot, etc. This method returns a magazine with an auto-generated title, usually pretty silly. The titles are random so these magazines are not considered collectible.

Source:
Returns:

magazine with a title

Type
String

createMap(optionsopt) → {Map}

Description:
  • Fetches an SVG topo map from url, extracts its embedded site/label metadata (via parseSvgMetadata — no DOMParser, so this runs in the worker like every other generator), and generates a shimmed Location for every marker. Returns a Map model carrying every generated Location plus the ordered marker instructions a renderer needs to place them on the SVG.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}
Properties
Name Type Description
url String

the SVG's URL

Returns:

the generated map

Type
Map

createMapEnrichment()

Description:
  • Should be called after all locations have been created in a context, preferably in the worker thread, to enrich the locations after initial presentation. The GUIDS of enriched locations are returned and from there, they can be retrieved via getLocation.

    Takes the full list of locations involved (registerLocations() runs first, as this function's own first step) so callers never have to sequence registration before enrichment themselves — safe to call unconditionally whether or not this worker instance created these locations itself (re-registering an already-registered location is a harmless no-op, same object reference).

Source:

createMemorabilia(optionsopt) → {Item}

Description:
  • Creates a random piece of pre-collapse memorabilia, such as a comic book, trading card, magazine, or movie poster.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Memorabilia creation options

Properties
Name Type Attributes Default Description
type string <optional>
"random"

Category of memorabilia to create. Use getMemorabiliaTypes() to get the full list of valid types.

Returns:

An Item instance representing a piece of memorabilia

Type
Item

createProfession(optionsopt) → {Profession}

Description:
  • Looks up a profession from the profession database by name or tags.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Profession lookup options

Properties
Name Type Attributes Description
name string <optional>

Profession name to look up (e.g. "Scavenger", "Rancher"). The special value "soldier" randomly selects a military branch (Army, Navy, Marine, Air Force).

tags string <optional>

Tag expression to filter professions.

Returns:

A Profession instance matching the given criteria, or null if not found

Type
Profession

createRelationship(optionsopt) → {Relationship}

Description:
  • Creates a pair of related characters (e.g. mother and son, aunt and nephew) with appropriate age differences, shared or independent heritage, and related professions.

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Relationship creation options

Properties
Name Type Attributes Default Description
kit boolean <optional>
true

Whether to equip both characters with traveling possessions.

relation string <optional>

The relationship type for the older character, selected from the values returned by getRelationships() (e.g. "Mother", "Father", "Brother"). If not provided, randomly selected by rarity.

familyName string <optional>
null

An optional family name to assign to the older character. The younger character may inherit it based on the relationship type.

Returns:

A Relationship instance containing both characters and their relationship label

Type
Relationship

createTimeSeries(options) → {Array.<string>}

Description:
  • Generates a series of publication dates for a periodical, within a historical date range. Useful for assigning realistic issue dates to magazines and newspapers.

Source:
Parameters:
Name Type Description
options Object

Time series options

Properties
Name Type Attributes Default Description
period string <optional>
"weekly"

Publication frequency: "weekly", "biweekly", "monthly", or "bimonthly".

dayOfWeek string <optional>

Advance each date to the next occurrence of this day (e.g. "Monday"). If not provided, dates are not adjusted to a specific weekday.

format string <optional>
"full"

Date format: "full" produces "Monday 2 Jan 1956"; any other value produces "Jan 1956".

startDate string | Date <optional>
"1956-01-01"

Start of the date range, as a "YYYY-MM-DD" string or Date object.

endDate string | Date <optional>
"1958-07-14"

End of the date range (exclusive), as a "YYYY-MM-DD" string or Date object.

Returns:

An array of formatted date strings within the given range

Type
Array.<string>

createWeather(optionsopt) → {Weather}

Description:
  • Creates a weather report for a given date and location, including temperature, wind, precipitation, sun/moon times, and game-relevant effects (cold/heat warnings, travel impacts).

Source:
Parameters:
Name Type Attributes Default Description
options Object <optional>
{}

Weather creation options

Properties
Name Type Attributes Default Description
date string <optional>

ISO 8601 date string (e.g. "2026-03-10"). If not provided, defaults to today's date.

lat number <optional>
38.24475

Latitude for sun/moon calculations.

long number <optional>
-98.657227

Longitude for sun/moon calculations.

Returns:

A Weather instance with temperature, wind, precipitation, sky conditions, sun times, moon phase, and gameplay effect warnings.

Type
Weather

createWorkerClient() → {Promise.<{call: function(), expand: function(), terminate: function()}>}

Description:
  • Returns the shared client that runs create* functions (and other worker-side operations) in a separate thread — a Web Worker in the browser, or a worker_threads Worker in Node — via Comlink. Environment is detected automatically so the same call site works in both.

    The underlying worker is created once and reused by every caller: worker-side module state (e.g. the location template registry used to expand shimmed locations) must stay consistent across calls, so different parts of the app can't each get their own worker.

Source:
Example
const client = await createWorkerClient();
const location = await client.call("createLocation", { type: "Farm", history: true });
await client.terminate();
Returns:
Type
Promise.<{call: function(), expand: function(), terminate: function()}>

newLocation(template, parent) → {Location}

Description:
  • Create a location based on a location template. The location constructor follows model conventions and takes a params object, so the copy operation must happen outside of it, and this is the method to do that.

Source:
Parameters:
Name Type Description
template LocationTemplate

to use

parent Location

location of this current location

Returns:

the new location.

Type
Location

parseSvgMetadata()

Description:
  • Extracts the handful of attributes createMap() needs from a topo-map SVG's raw text, with no DOM/DOMParser involved — this must run in a Web Worker or Node worker_threads thread, neither of which has DOMParser. #polygons is parsed (so its escaped data-points JSON attribute is exercised) but intentionally discarded — see notes/Programming/specs/2026-08-03-createmap-topo-refactor-design.md.

Source:

registerLocations()

Description:
  • Repopulates LOCATIONS_BY_GUID from a previously-generated location tree (or array of trees) — the only worker-side registry that needs rehydrating after a reload, since templates are now derived by type (see expandLocation). Used when loading a saved map: its locations were generated (and possibly enriched) in a prior session/worker instance, so this worker's registries start out empty for those guids.

Source:

toLastNameString() → {String}

Source:
Returns:

the family name, with the born (maiden) name if present

Type
String

toString() → {String}

Source:
Returns:

the full name, preferring nickname if present

Type
String