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.

Variable: `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.)

### 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 rejects...

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, and rejects defines what names may not be produced (its exact interpretation depends on the method).

### Naming Methods

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

An implementation is free to define additional naming methods.

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 ([sym] [weight] symbol/string/list [n] ...))

The generation process works by substituting one of the rule's alternatives for the symbol, starting with the root 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.

Strings 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 (passing the same object??) and its result incorporated. A list should be a list of strings and symbols, and the expansion of each will be concatenated.

GlobalConstant: `any`

GlobalConstant: `or`

GlobalConstant: `reject`

A special rule headed by `reject` is a list of substrings that should not appear in a generated name; this is a convenient way to filter out particularly unlovely results.

GlobalConstant: `capitalize`

Directs capitalization of a nonterminal.

Form: `text` [ symbol/id ] method rejects...

### 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-narratives` patterns

This variable is similar, but its text is in the past tense. 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.