-
Notifications
You must be signed in to change notification settings - Fork 3
1. Game.xml Explained
The game.xml file defines the structure of the game. While more advanced and granular control of the engine may require scripting, it's possible to create an entire game just by defining and configuring a set of rooms, objects and creatures.
The game.xml file is broken into sections. It's structure will look something like the following ("..." means there are details that have been omitted.)
<?xml version="1.0"?>
<game>
< !-- Section I. Player Configuration -->
<player>
...
</player>
< !-- Section II. Objects -->
<objects>
...
</objects>
< !-- Section III. Creatures -->
<creatures>
...
</creatures>
< !-- Section IV. Rooms -->
<rooms>
...
</rooms>
</game>
It's important that these sections appear in the exact order you find them above. Unfortunately, when I started this project, I added checks for existing objects to the XML parser instead of to the code that constructs the game after the parsing is finished. I'll eventually fix this, as order shouldn't matter, but for now you'll get an error if, for example, you try to define your objects after you define rooms that use those objects.
This section is denoted by the player tag and allows you to configure options related to players in the game. For more details, check out the Player Section.
This section is denoted by the objects tag and is where you'll place definitions of objects in the game. Some examples might be a sword, a shield, a candle, a treasure chest, etc. For more details, check out the Objects Section.
This section is denoted by the creatures tag and is where you will place definitions for all living creatures in the game, friend or foe, human or not. Some examples might be a monster, a salesman or a rabid dog. For more details, check out the Creatures Section.
This section is denoted by the rooms tag. Every individual location in the game is known as a "room." The term is used loosely and can refer to anything. Some examples might be a desert pass, a mountain range, the bank of a river, a room inside a building or a cavern. For more details, check out the Rooms Section.
A sample game.xml can be found as part of the Trogdor distribution. Nevertheless, here's a simple example.
<?xml version="1.0"?> BLAH BLAH BLAH... (Update this...)