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
shimoption) 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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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