User Tools

Site Tools


First Steps: Creating Rooms and Paths

Rooms and Paths

We will now see how we can use PUCK to define a world. The first thing we will do is to create a couple of rooms linked together by a road, so that the player can do something like this:

> look
You are in the eastern bank of the great river Pecos. There are many low trees around you. A precarious wooden bridge crosses westward.
> go west
You walk west through the bridge carefully. The wooden boards that form it creak ominously; but you get safely to the other bank.
You are in the western bank of the great river Pecos. There are a few tall trees around you. A rough wooden bridge crosses to the east.
> go over the bridge
You go through the bridge to the east with care. Its boards creak disturbingly; but you get to the other side uneventfully.
You are in the eastern bank of the great river Pecos. There are many low trees around you. A precarious wooden bridge crosses westward.\\

To do this, the first thing to do is to go to “File - New - Blank world” menu, which will create a new blank world to work on.

By doing this we will see on the left the blank graphical editor, which is where we will place our objects; and to the right the object panel associated with the world. This panel shows a form with a series of world properties. It is advisable to fill in at least the short name and long name that AGE will use to identify the world. The short name should consist of a single word, advisably of no more than twelve characters; while the long name can be a title of whatever length is desired, and is what will be displayed to the player as the name of the game. The other fields (author, version, date …) are merely informative data that player will be shown when loading the game.

If we wish to leave these properties for later, or modify them at any time, it is useful to know that we can return to this panel when we want, by simply clicking on an empty area of the graph editor.

But let's get our hands dirty: we will create the two rooms of the example, one placed to the west of the other, and separated by a path (bridge). To do this we:

  • Click the icon of the create room tool in the toolbar.
  • Move the cursor over the graph editor. We will see that a square (the room we are creating) is moving together with our cursor. Click, and the room will be placed in the editor. On the right we will see its object panel.
  • We will make this room represent the west bank of the great river Pecos. To do this, we fill in the fields in the object panel:
  • In the “Unique Name” field, type a short name such as “West Pecos”. This name will not be displayed to the player, it is used to internally identify the room in the game and distinguish it from others. We will also use it when we want to refer to this room in the future.
  • In the “Descriptions” field, we will need to enter the descriptions of the room, which are what is shown to the player when she types “look” or enters the room. You may be surprised that there is not a single “Description,” but a field for “Descriptions”. This is because a description in AGE is not a static text, but something that may vary under different conditions (for example, the description of a location may be different depending on whether it is day or night). To make this possible, the description that is displayed to the player is put together from separate pieces that can be displayed or not depending on the conditions that are met. In this case, it will be enough to type a static description, which only needs one of these pieces, without any associated condition. To do this, type out the complete room description in the “Description” field:
    You are in the western bank of the great river Pecos. There are a few tall trees around you. A rough wooden bridge crosses to the east.
    And then press the “Add” button. We see that the description that we have typed will appear in the “description” box, preceded by the word “always”. The latter means that this description is displayed whenever a player looks at the room, ie, not subject to any particular condition.
  • At the moment, we do not need to add anything else to this room. It is good to know that, if we want to change its details later, we just need to click on its representation in the graphical editor (when we are not using any tools) to view and modify its object panel again.
  • In the same way as for the previous room, we will create a new one to represent the east bank of the river. To do this, we need to click on “add room” tool again, because each use of the tool serves to add one room. We will place the new room to the right of the previous one, as it is located to the east in the game. If we have not left enough space in the graphical editor to place it in this way, we can use the pan and zoom tools:
  • To use the pan tool, click on its icon in the toolbar:

    Then click the graphical editor, and move the cursor: objects in the editor will move with it. With a second click, we can stop using the tool. Alternatively, the view can also be moved using the mouse wheel (moving the wheel up/down will move the view up/down, or left/right if we hold the Shift key).
  • The zoom tool is used in the same way. After clicking its icon

    and the graphical editor, we can move the mouse upwards to zoom out or downwards to zoom in. Alternatively, the view can be zoomed in or out by moving the mouse wheel while holding down the Ctrl key.
  • We fill the unique name and description for the new room in the same way we had done with the previous one, reflecting that we are east of the Pecos.
  • Now let's create the connection between the two rooms. As we can see in the gameplay log that describes what we want to achieve, both locations must be joined by a bridge which crosses from east to west. The bridge must be traversable in both directions; but it is important to know that paths in age work in one direction. Therefore, to allow traffic in both directions, we need to create two paths: one from west to east and a second one from east to west. Note that, although this may seem uncomfortable for simple cases, it makes the system more powerful: this means that we can control each direction of the path differently, enabling functionality like allowing passage in one direction only, having different descriptions for each direction, making something happen when someone crosses in a given direction, etc.
  • To create the paths, we will use the “add structural relationship” tool in the toolbar, which is identified by this icon:

  • Relationships in AGE are ways to express any relationship, whether permanent or temporary, between two objects. There are two types of relationships: structural relationships and auxiliary relationships. Structural relationships are so called because they are the ones that define the structure of the world: they tell us where objects are. They are also characterized by the fact that an object would be meaningless if it were not (or at least had the possibility of being) connected to the world through structural relationships. Auxiliary relationships are used to define other aspects of the interactions between objects.
  • A path is modeled on AGE as a structural relationship between one room and another, hence it is created with this tool. To create a path between the two rooms, we follow these steps:
  • We click on the “add structural relationship” tool

  • We click on the room representing West Pecos.
  • We click on the other room. An arrow linking the two rooms appears, representing the path from the west room to the east room.
  • Just like objects, we can see that relationships also have associated object panels. Right after creating the relationship, we can see the corresponding panel on the right side of the PUCK window. Some of the fields in the panel are filled automatically, such as source and destination rooms (which are those marked on the map) and the default address, which is a cardinal direction associated with the path. As we placed one room to the right of the other, the path will appear automatically marked with the standard direction “east”. This means that it can be used with commands like “go east”. If, even though you have placed the rooms in this way, this is not the behavior you want, you can change the default address (or remove it in order to not have any) in the panel corresponding to the path object. Similarly, we could change the path source and destination rooms at any time. As we can see, the “unique name” that identifies each room is used for this purpose.
  • Below these fields we can see an initially empty list of custom commands. In this list we can enter all the words that the player can use to refer to this path, apart from the cardinal point given by the standard address. As we want the player to be able to type things like “go bridge” or “go over the bridge,” we will add “bridge”: to this end, we type this word into the field marked as “Command” and click the “Add” button.
  • Then we can see an area for descripciones, which should already be familiar to us. Path descriptions work in exactly the same way as room descriptions, but they are shown when the player crosses the corresponding path. Therefore, to obtain the desired behavior for this path, we must type the following into the “Description” field:
    You go through the bridge to the east with care. Its boards creak disturbingly; but you get to the other side uneventfully.
  • With this, we have all we need at the moment for this path. If at any time you need to modify this object panel again, you only need to click the arrow representing the path in the visual map in order to show the panel again.
  • To create the other path, as you can imagine, you only need to repeat the same process, but clicking on the eastern room first and then on the western one. A second arrow will appear in the map, pointing in the opposite direction, but not physically overlapping with the first arrow so that we can easily click on any of them to access their corresponding object panels. The description and the custom command for this second arrow are entered in the same way as for the previous one.

Creating a Player Character

With the above steps we have created a minimal world to play with, but we lack a necessary element for our game to make sense: a character that can walk through it. In AGE, the players are in the skin of characters that inhabit the world and interact with it (although you can also create non-player characters). Therefore, even in a single player game we need to create at least one character to act as the “avatar” for the player, so that the game is playable. To do this, we will use the “add character” tool from the toolbar:

And we will do the following:

  • To use this tool, we proceed in the same way as when adding rooms to the world: we click on its icon in the toolbar, slide the mouse over the graph editor and click on the point where we want to place the character. It will be convenient to place it near the room where we want the player to appear at the beginning of the game; but -importantly!- **not* inside it. This is because the graphical editor shows a schematic representation of the world where the fact that something is inside a room is not represented by placing its icon within it, but by joining the room to that object by a structural relationship. Representing objects inside other objects in the graph might seem more natural to the naked eye; but it would be cumbersome when representing a room containing many characters and things.
  • Therefore, the next step will be to create the structural relationship from the room (which can be the western or the eastern room, depending on where we want the player to start the game: what we create with PUCK is always the initial state of the world, which can later change when characters move and manipulate objects) and the character. To this end, we use the “create structural relationship” tool that we already know:

    and we first click the room and then the character (the order is important). This will create a structural relationship of type “contains”, meaning that the room contains the character. Contrary to the “path” relationship that we saw before, the “contains” relationship doesn't need to be configured.
  • For everything to work, only one thing is left: we need to specify that the character we have created is a player. To do this, we click on it to get its object panel, and mark the box that says “player”. This means that, when someone starts the game, AGE will place her on the skin of this character (in multiplayer games things are more complicated, as we will eventually see).
  • If we delve into the object panel associated with the character we can see that it has many configurable data, such as names and descriptions. The latter work in the same way as descriptions for rooms and paths, and in this case they would appear if the player looked at themselves. You can fill them in if you want, although they are not strictly necessary for our desired behavior.

Now we do have a full, playable AGE world (although, at the moment, it's not a very exciting one). To play it, we only need to click the Play world tool:

The tool reminds us that, in order to execute the world, it needs to save the file (it will do so automatically) and lets us choose between two user interfaces for playing our game: SDI (simple window) or MDI (window with sub-windows). We can choose either of the two, although for the purpose of testing single-player games, the SDI interface is enough and it is simpler. After making this choice, we push the OK button to start the game.

If we have done everything correctly, we can play the game that we have seen at the beginning of the section.

It wasn't that difficult, was it? Now we are going to improve our game. This will be in the next section of the tutorial: Inert Beings.

en/habitaciones_y_caminos.txt · Last modified: 2014/11/14 19:20 by al-khwarizmi