Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 74fbd0eb33bb08f719b79951bc4e329e > files > 97

xconq-7.5.0-1.20050612.5mdv2009.1.i586.rpm

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.39
     from ./xcdesign.texi on 12 June 2005 -->

<TITLE>Designing Games with Xconq - Naming and Text Generation</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="xcdesign_1.html">first</A>, <A HREF="xcdesign_48.html">previous</A>, <A HREF="xcdesign_50.html">next</A>, <A HREF="xcdesign_61.html">last</A> section, <A HREF="xcdesign_toc.html">table of contents</A>.
<HR>


<H2><A NAME="SEC235" HREF="xcdesign_toc.html#SEC235">Naming and Text Generation</A></H2>

<P>
<I>Xconq</I> 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.

</P>

<UL>
<LI><A HREF="xcdesign_49.html#SEC236">Naming Sides</A>
<LI><A HREF="xcdesign_49.html#SEC237">Namers</A>
<LI><A HREF="xcdesign_49.html#SEC238">Naming Methods</A>
<LI><A HREF="xcdesign_49.html#SEC239">Notices and Narratives</A>
</UL>



<H3><A NAME="SEC236" HREF="xcdesign_toc.html#SEC236">Naming Sides</A></H3>

<P>
Side naming is special, because several different but related names
have to be produced. The use of a <STRONG>side library</STRONG> is a way to gain 
finer control over side names and their associated plural and 
possessive variations than one would have through the use of a 
<CODE>side-namer</CODE>.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>side-library</CODE></B> <I>side-info...</I><P>
<A NAME="IDX608"></A>
This variable is a weighted list of groups of side properties, each of
which may be used to fill in a side.

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

<PRE>
([ weight ] ... (name &#60;name&#62;) ... (color &#60;colors&#62;) ...)
</PRE>

<P>
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
<VAR>weight</VAR> 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.)

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>side-color-library</CODE></B> <I>side-info...</I><P>
<A NAME="IDX609"></A>
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 <CODE>side-library</CODE>
does not supply a color scheme.

</P>



<H3><A NAME="SEC237" HREF="xcdesign_toc.html#SEC237">Namers</A></H3>

<P>
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 <STRONG>namers</STRONG>.

</P>
<P>
<U>Form:</U> <B><CODE>namer</CODE></B> <I>symbol/id method</I><P>
<A NAME="IDX610"></A>
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 <VAR>method</VAR> must be one of the naming methods listed
below.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>default-namer</CODE></B> <I>str</I><P>
<A NAME="IDX611"></A>
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 <CODE>junky</CODE> and <CODE>random</CODE> naming
methods (presumably the <CODE>grammar</CODE> is inexhaustible!).

</P>



<H3><A NAME="SEC238" HREF="xcdesign_toc.html#SEC238">Naming Methods</A></H3>

<P>
As with general synthesis, <I>Xconq</I> has a number of <STRONG>naming methods</STRONG>
available.

</P>
<P>
<U>NamingMethod:</U> <B><CODE>random</CODE></B> <I>names ...</I><P>
<A NAME="IDX612"></A>
This method picks a name from the given list of names and removes that
name from the list.

</P>
<P>
<U>NamingMethod:</U> <B><CODE>junky</CODE></B><P>
<A NAME="IDX613"></A>
This method produces a gobbledy-gook name, very techy-looking.

</P>
<P>
<U>NamingMethod:</U> <B><CODE>in-order</CODE></B> <I>names ...</I><P>
<A NAME="IDX614"></A>
This method pulls names from a list in the order that they appear.

</P>
<P>
<U>NamingMethod:</U> <B><CODE>grammar</CODE></B> <I>root max-length rules...</I><P>
<A NAME="IDX615"></A>
This method defines a grammar, where <VAR>root</VAR> is the root symbol,
<VAR>max-length</VAR> is a limit on the length of the generated names (in
characters), and <VAR>rules</VAR> is a list of rules of the form

<PRE>
(<VAR>symbol</VAR> <VAR>rule-body</VAR>)
</PRE>

<P>
The <VAR>rule-body</VAR> can have the following forms:

<PRE>
(<VAR>rule-body</VAR> <VAR>rule-body</VAR> ...)
(or [ <VAR>weight</VAR> ] <VAR>rule-body</VAR> [ <VAR>weight</VAR> ] <VAR>rule-body</VAR> ...)
(capitalize <VAR>rule-body</VAR>)
(reject <VAR>rule-body</VAR> string-or-sym ...)
symbol
string
</PRE>

<P>

The generation process for <CODE>or</CODE> 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
<VAR>weight</VAR> (assuming missing weights to be <CODE>1</CODE>), 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.

</P>
<P>
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.

</P>
<P>
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.

</P>
<P>
<U>GlobalConstant:</U> <B><CODE>or</CODE></B><P>
<A NAME="IDX616"></A>
This designates a list of alternatives.

</P>
<P>
<U>Symbol:</U> <B><CODE>capitalize</CODE></B><P>
<A NAME="IDX617"></A>
Directs capitalization of the result generated by the rule body.

</P>
<P>
<U>Symbol:</U> <B><CODE>reject</CODE></B><P>
<A NAME="IDX618"></A>
A rule body headed by <CODE>reject</CODE> 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.

</P>



<H3><A NAME="SEC239" HREF="xcdesign_toc.html#SEC239">Notices and Narratives</A></H3>

<P>
<U>GlobalVariable:</U> <B><CODE>action-notices</CODE></B> <I>patterns</I><P>
<A NAME="IDX619"></A>
This variable is a list of patterns that an interface may use to
generate textual notices of unit actions.
Defaults to <CODE>()</CODE>.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>action-movies</CODE></B> <I>patterns</I><P>
<A NAME="IDX620"></A>
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 <CODE>()</CODE>.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>event-notices</CODE></B> <I>patterns</I><P>
<A NAME="IDX621"></A>
This variable is a list of patterns that an interface may use to
generate textual notices of historical events.
Defaults to <CODE>()</CODE>.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>event-narratives</CODE></B> <I>patterns</I><P>
<A NAME="IDX622"></A>
This variable is similar, but its text is in the past tense.
Defaults to <CODE>()</CODE>.

</P>
<P>
<U>GlobalVariable:</U> <B><CODE>event-movies</CODE></B> <I>patterns</I><P>
<A NAME="IDX623"></A>
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 <CODE>()</CODE>.

</P>

<HR>
Go to the <A HREF="xcdesign_1.html">first</A>, <A HREF="xcdesign_48.html">previous</A>, <A HREF="xcdesign_50.html">next</A>, <A HREF="xcdesign_61.html">last</A> section, <A HREF="xcdesign_toc.html">table of contents</A>.
</BODY>
</HTML>