Although Xconq is primarily a graphical game system, it is complex enough that the graphics alone are insufficient to describe what is going on.
All text that players see is issued by text generators, which are objects that, when given appropriate inputs, produce text fragments that can be used by the interface to produce a textual display. Each text generator has a number of parameters that may be used to select one of several rules [etc]
[fill in]
[fill in]
One of Xconq's special features is its extensive machinery for generating names of things. You can generate names for sides, units, and geographical features. The possibilities range from a simple list of strings up to context-free grammars and arbitrary code modules. Naming happens throughout the game, as nameable objects are created, but is mostly done during initialization.
Here is a very simple grammar:
(namer (grammar root 40 (root (or 1 (the animal in the thing))) (animal (or cat dog sheep)) (thing (or hat umbrella fold)) ))
It makes phrases like "the cat in the hat"
,
"the dog in the umbrella"
, and "the sheep in the hat"
.
This example is more realistic:
;;; German-like place name generator. ;;; Conventional combos most common, random syllables rare. ;;; Needs more conventional words to combine? (namer german-place-names (grammar root 50 (root (or 95 (name) 5 ("Bad " name) )) (name (or 40 (prefix suffix) 20 (both suffix) 20 (prefix both) 5 (prefix both suffix) 10 (syll suffix) 10 (prefix syll suffix) )) (prefix (or schwarz blau grun gelb rot roth braun weiss wolf neu alt alten salz hoch uber nieder gross klein west ost nord sud ;; from real names frank dussel chem stras mut )) (suffix (or dorf torf heim holz hof burg stedt haus hausen bruck brueck bach tal thal furt ;; these aren't so great ach ingen nitz )) (both (or feld stadt stein see schwein schloss wasser eisen berg )) ;; Generate random syllables (syll (or 40 (startsyll vowel endsyll) 5 (vowel endsyll))) (startsyll (or 30 startcons 10 startdiph)) (startcons (or b k d f g l m n r 5 s 3 t)) (startdiph (or bl kl fl gl 5 sl 3 sch 2 schl br dr kr fr gr 2 schr 3 tr 2 th 2 thr)) (vowel (or 6 a ae 2 au 5 e 2 ei 2 ie 6 i 3 o oe 2 u ue)) (endsyll (or 4 b 5 l 3 n 4 r 4 t bs ls ns rs ts 3 ch 3 ck lb lck lch lk lz ln lt lth ltz rb rck rch rn rt rth rtz ss sz 2 th tz )) ))
This generator usually takes normal German words and glues a couple
together, making names like "Schwarzburg"
, "Nordbruck"
,
and "Bad Salzwasser"
, but it will occasionally make a completely
random syllable using common German phonemes, then glue it into a name,
resulting in names like "Biefeld"
and "Salzgloelthach"
.
Yes, that last one is unpronounceable even for Germans, but the
generator doesn't know that!
Since there is no special handling to ensure non-garbled names, it generally does not work particularly well to try to build names from vowels and consonants. Either random selection from a list or putting together syllables seems to do better, with perhaps a single totally random syllable thrown in. Don't forget that this is a generator, not a recognizer or parser, so you don't have to be able to handle every possible name; just enough to make an interesting variety.
Recursive rules, where a symbol expands into a sequence mentioning that
same symbol, will work, but they are not recommended. Although the
generator has a builtin limiter to keep from looping forever,
in general there is no way to avoid getting awful names like
"Feldbruckbruckbruck"
. Instead, you can just add extra rules,
one for each desired length, so for instance you have a rule for
2-syllable names, one for 3-syllable names, one for 4 syllables, etc.
Another advantage is that you can set the probability of each length of
name separately, and thus lower the probability of longer names, so that
they only appear once in a while and you save the poor players from
being continuously tongue-tangled!