In this documentation we show a sample of XML files useful to define data in our engine.
Click on each attribute name to go to the documentation for related ObjectPascal property.
In most cases, the values shown for attributes below are their default values (used if you don't specify any value). There are also some cases where attribute is required, these are marked clearly.
Note about attributes that specify URLs: the default value is
always empty string (although sometimes URL is just required,
level.xml). Relative URLs
are always relative to the XML file. In simple cases, you just use
filenames there, and place your data files along the XML files.
Note about attributes that specify sound names: the default value is usually an empty string, meaning "no sound assigned". Sound name is always optional. You should use there a sound name defined in sounds XML file.
Note that the attributes shown are not exhaustive: you can
derive new classes (descendants of
and others) where you read other attributes. Also, for
we show attributes of a
TWalkAttackCreatureResource class (indicated
type="WalkAttack"), but there are also other resources:
TItemWeaponResource. They all share some properties (defined at base
T3DResource, also all creatures have base
all items have base
TItemResource), and also they all have some
specific properties. See the engine API documentation for a complete
list of properties of above classes, (almost) all of them can
be set by a
The data directory of the game is scanned for the special XML files named
resource.xml. This allows you to define new
creatures or items (something that can be picked and carried by the player)
or levels to the game simply by adding an additional subdirectory
to the game data.
file may contain relative URLs for
3D models and images related to this resource.
The idea is that the XML file is kept together with the data of particular
creature, item etc.
So you can trivially add/remove available resources
by simply adding/removing the appropriate subdirectory to the game data.
No recompilation, and no modification of any central file,
are necessary to add e.g. a new creature and a new level using that creature.
In normal circumstances, these xml files are scanned and read only once when the game starts. For easy editing of game data (to not be forced to restart the game after every little tweak in configuration), you can also use add to your game some debug command to reload XML configuration of various things during the game. (Most, but not absolutely all, settings can be changed even while the game is running; exceptions are things that are "heavy" — e.g. changing animation URL may require restarting the level.)
Copyright Michalis Kamburelis and Castle Game Engine Contributors.