Go to the first, previous, next, last section, table of contents.

## Naming and Text Generation

Xconq can generate names for sides, units, and geographical features. Although most naming happens during game setup, names may be assigned throughout the course of a game, both automatically and by player request.

- Naming Sides
- Namers
- Naming Methods
- Notices and Narratives

### Naming Sides

Side naming is special, because several different but related names have to be produced.

GlobalVariable: `side-library` side-info...

This variable is a weighted list of groups of side properties, each of which may be used to fill in a side.

The form of each side name entry is basically a subset of the side's properties:

    ([ weight ] ... (name <name>) ... (color <colors>) ...)

Each entry can include as many or as few of the attributes as desired; any missing will be filled in from the usual defaults. The optional weight is a number that adjusts the probability of selection of the given side name set; it defaults to 1, and the probability is scaled according to the sum of the weights for all the sides listed. If any property value is a namer, then the namer will be run. (Note that if multiple namers are specified, they cannot be guaranteed to coordinate with each other, so you can end up with a side noun that is inappropriate for its corresponding side name.)

GlobalVariable: `side-color-library` side-info...

This variable is a weighted list of side color schemes, each of which may be used to fill in a side's color scheme. The values from this list are only used if the entry from `side-library` does not supply a color scheme.

### Namers

Since one of the purposes of naming is to identify objects uniquely, any name generator should be able to maintain some memory as to what has been generated already. The objects that do this are namers.

Form: `namer` symbol/id method

This form defines an instance of a namer, with either the symbolic name or numeric id. If either matches the name or id of an existing namer, then the old namer will be overwritten, otherwise a new one will be created. The method must be one of the naming methods listed below.

GlobalVariable: `default-namer` str

This namer may be used when another namer can no longer produce names, such as a random namer that exhausts its list of possibilities. At present, it is used only with the `junky` and `random` naming methods (presumably the `grammar` is inexhaustible!).

### Naming Methods

As with general synthesis, Xconq has a number of naming methods available.

NamingMethod: `random` names ...

This method picks a name from the given list of names and removes that name from the list.

NamingMethod: `junky`

This method produces a gobbledy-gook name, very techy-looking.

NamingMethod: `grammar` root max-length rules...

This method defines a grammar, where root is the root symbol, max-length is a limit on the length of the generated names (in characters), and rules is a list of rules of the form

    (symbol rule-body)

The rule-body can have the following forms:

###

    (rule-body rule-body ...)
    (or [ weight ] rule-body [ weight ] rule-body ...)
    (capitalize rule-body)
    (reject rule-body string-or-sym ...)
    symbol
    string

    The generation process for or works by substituting one of the
    rule's alternatives for the symbol.  The probability of an alternative
    being selected is arrived at by adding up the optional weights
    weight (assuming missing weights to be 1), and choosing
    with a probability of the weight divided by the total sum of weights.
    Thus the weights need not add up to any particular value.

    If the list is not prefixed by any of the special symbols, then each
    rule body in the list is expanded, and the results concatenated.

    Strings and symbols that are not terminals get used directly.  If a
    symbol in the rule's chosen expansion does not appear as the lefthand
    side in any rule, then it will be handled as a string, otherwise it will
    be expanded in turn.  If the symbol matches a namer's name, then that
    namer will be run and its result incorporated.

    GlobalConstant: or
    This designates a list of alternatives.

    Symbol: capitalize
    Directs capitalization of the result generated by the rule body.

    Symbol: reject
    A rule body headed by reject includes a list of substrings that
    should not appear in a generated name; this is a convenient way to
    filter out particularly unlovely results.  This works by retrying
    generation if one of the listed strings appears in the name generated by
    the rule body in the form.

    Notices and Narratives

    GlobalVariable: action-notices patterns
    This variable is a list of patterns that an interface may use to
    generate textual notices of unit actions.
    Defaults to ().

    GlobalVariable: action-movies patterns
    This variable is similar, but instead of generating text, the result
    of a match is a designation of a movie (an animation or sound).
    Defaults to ().

    GlobalVariable: event-notices patterns
    This variable is a list of patterns that an interface may use to
    generate textual notices of historical events.
    Defaults to ().

    GlobalVariable: event-narratives patterns
    This variable is similar, but its text is in the past tense.
    Defaults to ().

    GlobalVariable: event-movies patterns
    This variable is similar, but instead of generating text, the result
    of a match is a designation of a movie (an animation or sound).
    Defaults to ().

    Go to the first, previous, next, last section, table of contents.