Sophie

Sophie

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

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

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

<TITLE>Hacking Xconq - GDL Design Decisions</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_8.html">previous</A>, <A HREF="hacking_10.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
<HR>


<H2><A NAME="SEC9" HREF="hacking_toc.html#SEC9">GDL Design Decisions</A></H2>

<P>
The most fundamental decision is that GDL is declarative rather than
procedural.  This may have advantages in making game definitions
readable or limiting the consequences of buggy GDL, but the key
advantage is that a generic AI can cope with a declarative language.
For example, suppose that a hypothetical game design language had a
procedure that got run to figure out the results of combat.  It is
very powerful and simple: run this procedure, and you know whether the
attacker or defender wins.  But the problem is that pretty much all
you can do with it is run it.  The AI can't reason about what kinds of
units are best as attackers, which are best as defenders, or the like.

</P>
<P>
Having decided on a declarative language, there is still the syntax.
GDL uses an s-expression syntax (which comes from Lisp).  The main
popular alternative to s-expressions these days seems to be XML.  For
example:

</P>

<PRE>
(table mp-to-leave-terrain
  (ground water 99)
  (armor (swamp forest mountains) 99)
  )
</PRE>

<P>
might become

</P>

<PRE>
&#60;table name="mp-to-leave-terrain"&#62;
  &#60;entry&#62;
    &#60;ref&#62;ground&#60;/ref&#62;
    &#60;ref&#62;water&#60;/ref&#62;
    &#60;value&#62;99&#60;/value&#62;
  &#60;/entry&#62;
  &#60;entry&#62;
    &#60;ref&#62;armor&#60;/ref&#62;
    &#60;list&#62;&#60;ref&#62;swamp&#60;/ref&#62;&#60;ref&#62;forest&#60;/ref&#62;&#60;ref&#62;mountains&#60;/ref&#62;&#60;/list&#62;
    &#60;value&#62;99&#60;/value&#62;
  &#60;/entry&#62;
&#60;/table&#62;
</PRE>

<P>
Given the conciseness of the s-expression syntax, it seems unwise to
simply dismiss it as an anachronism.  The real question is what would
be the benefits of an XML syntax - for example would it enable data
exchange, and if so with what (XML editors? Game design
tools?).

</P>
<P>
Also see section <A HREF="hacking_35.html#SEC37">Rationale and Future Directions</A>.

</P>

<HR>
Go to the <A HREF="hacking_1.html">first</A>, <A HREF="hacking_8.html">previous</A>, <A HREF="hacking_10.html">next</A>, <A HREF="hacking_35.html">last</A> section, <A HREF="hacking_toc.html">table of contents</A>.
</BODY>
</HTML>