Start by opening up a file, calling it something like g-vs-t.g
,
or some other name appropriate for your type of machine,
and then type this into it:
(game-module "g-vs-t" (title "Godzilla vs Tokyo") (blurb "Godzilla stomps on Tokyo") )
This is a GDL form.
It declares the name of the game to be "g-vs-t"
,
gives it a title that prospective players will see in menus,
plus a short description or blurb.
The blurb should tell prospective players what the game is all
about, perhaps whether it is simple or complex, or whether
it is one-player or multi-player.
Both title and blurb are examples of properties,
which are like slots in structures.
The game-module
form is optional but recommended;
some interfaces use it to add the game to a list of games
that players can choose from.
The general syntax of game-module
form is similar to that
used by nearly all GDL forms;
it amounts to a definition of an "object" (such as a game module or a
unit type) with properties (such as name, description, speed, etc).
Some properties are required, and appear at fixed positions,
while others are optional and can be specified in any order,
so they are introduced by name. The general format, then, looks like
(<object> ... <required properties> ... ... (<property name> <property value>) ... )
There are very few exceptions to this general syntax rule.
Now the first thing you'll need is a monster. In Xconq, each unit has a type, and you define the characteristics attached to the type.
(unit-type monster)
This declares a new unit type named monster
,
but says nothing else about it.
Let's use this more interesting form instead:
(unit-type monster (image-name "monster") (start-with 1) )
This shows the usual way of describing the monster.
In this case, image-name
is a property
that specifies the name of the icon that will be used to display
a monster.
The property start-with
says that each side should start out
with one monster. This isn't quite right, because there should only
be one side with a monster, and this will give each side a monster
to start out with, but we'll see how to fix that later on.
We also need at least one type of terrain for the world:
(terrain-type street (color "gray"))
Streets are to be gray when displayed in color, and get nothing if they are being displayed on a monochrome screen.
These two forms are actually sufficient by themselves to start up a game. (Go ahead and try it.) However, you'll notice that the game is not very interesting. Although each player gets a monster, and an area consisting of all-street terrain is displayed, nobody can actually do anything, since the defaults basically turn off all possible actions.