Hacking Xconq - Extending GDL

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

## Extending GDL

GDL has been designed so as to be relatively easily extensible. I say "relatively" because although it is quite easy to define a new keyword or table, it is not always so easy to integrate the implementation code into the kernel correctly.

The file ``gvar.def'` defines all the global variables.

The file ``utype.def'` defines all the unit type properties. Similarly for ``atype.def'`, ``mtype.def'`, and ``ttype.def'`, for advance types, material types, and terrain types, respectively.

The file ``table.def'` defines all of the tables.

The file ``keyword.def'` defines keywords, which are just random symbols. Keywords include the names of properties for objects like areas and units, as well as syntactic things used within GDL forms.

The files ``action.def'`, ``goal.def'`, ``history.def'`, ``plan.def'`, and ``task.def'` enumerate the types of actions, goals, historical events, plans, and tasks, respectively.

From time to time, it may be worthwhile to extend unit objects. This should be rare, because games may have thousands of units, and each unit requires at least 100 bytes of storage already, so you should avoid making them any larger. Properties of an individual unit are scattered through ``keyword.def'`. Once the structure slot is added, you just need to add reading and writing of the value, using the `K_xxx` enum that was defined with the keyword. You should attempt to make a reasonable default and use it to avoid writing out the value, so as to save time when Xconq reads a game in.

GDL symbols beginning with `zz-` should be reserved for the use of AI code. You may want to add some of these, either to serve as a convenient place for AIs to cache the results of their analyis of a game, or else as a way for game designers to add "hints" for AIs that know to look at them.

Note that all the ``*.def'` files together are to define the exact set of symbols defined by GDL. You should not add any expedient matching on symbols or searching for particular symbols without adding them to an appropriate ``.def'` file.

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