3. Tutorial: a working adventure in few minutes...

3.1 - Creating a new project
3.2 - Rooms, actions and conditions
3.3 - Add a new room
3.4 - Flags and Items
3.5 - Save to disc
3.6 - Playtest
3.7 - Pictures
3.8 - Sound

3.1 - Creating a new project


Double-click on GTAC icon in the directory viewer containing the !GTAC application. The program will run and will install its icon on the icon bar.

To start a new adventure from scratch, click the mouse Menu button on the !GTAC icon bar icon, follow the Project>New Project> submenus: you will be presented a standard RISC OS save box. Type in your adventure name (starting with '!') - let us choose '!MyProject' - and drag its icon into a correct directory viewer. We have just created a new project and three windows will open: we are ready to start.

Please note that, once chosen, the project name cannot be changed anymore, so please take care when deciding.

3.2 - Rooms, actions and conditions


The first window at the top of the screen is called the Text Window. Like almost every adventure game, GTAC adventures are made of a set of locations, called rooms, which can be visited in turn. Each room, identified by a number, has a text description, which is displayed in the Text Window. The Action Window, in the centre of the screen, lists options corresponding to actions that can be performed by the user. Most options will not be available at any time, but only under certain circumstances, as already illustrated in section 1.

The Control Window, at the bottom of the screen, is the main window from which you can define almost every detail of your adventure. It is made of several icons, more of which later, and some information. First of all, there is a number telling us which room we are editing: as at present we have just started, we are in room 1, which is the only room defined, as you can read in the second line.

Let us continue with our adventure. We want something classical at the moment, so suppose we are a Knight and we must kill a terrible Dragon to save our loved Princess. We start at the entrance of a dark cave facing north, with a small path leading west. Move the mouse pointer inside the Text Window and click Select to position the caret. Using the cursor keys, move to the first line and press Control+U to delete its default text. Then enter the following description:

You are by the entrance of a dark cave facing north. A small path leads to the west.

We need now two more locations to explore: one if we decide to follow the path leading west and another if we want to enter the cave. Let us plan that the path will be location number 2 and the cave location number 3, but anything else would have been fine, as long as we plan it accurately and we remember it through the whole process of creating the adventure.

Okay, we must give the player the two opportunities. This can be done by defining two options, which will appear in the Action Window. An option is made of a text, an action and a condition. When its condition is verified, the option is available and its text appears in the Action Window. Users can select it by clicking on its text, in the same way as choosing a menu item in standard RISC OS applications. In the opposite case, when the condition is not verified, the option text is not displayed. Conditions will be examined soon.

Move the pointer onto the Actions icon in the Control Window and click Select. The Action Control Window will open.

This window contains ten separated areas, numbered 0 to 9. Each one has three writable fields, named Text, Action and Condition.

With reference to our adventure, the first option we are offering to the player is to enter the cave, so move the mouse pointer to the first writable field of option 0, click Select to position the caret, press Control+U to delete the default text and type:

Enter cave

now press Return and in the second line, next to 'Action:' type:


This is a GTAC command which will make the player go to room 3, when this action is selected from the Action Window. Press Return and in the third line, next to 'Condition:' type:


This is the constant True value, in Boolean algebra. A condition is verified when its expression evaluates to 1. In this case it is always 1, of course. This means the player, when standing by the cave, will be always offered the opportunity to enter it.

In a similar manner type the following for option number 1:

Follow the path leading west r2 1

This defines the other option. Our room is now ready, so click the Update icon in the Control Window to store these changes. The Action Window will update accordingly.

3.3 - Add a new room


We now need to set room 2 up, the path. Move the pointer on the Add/Copy room icon and click Select. You will be asked to digit the new room number and you will be offered the default number 2. Just press Return. Press Return again for confirmation. We have now a new blank room. As you have just done, write the following description:

You are on a path leading west, where there is the edge of a precipice. The cave lies to your east.

3.4 - Flags and Items


Let us now introduce an object: a sword, which the player will need to kill the Dragon. GTAC uses flags and variables in order to record events during the game. A flag can be either True or False. Every flag is initialised to False at the beginning of every game and after every restart. Every flag can have a text description as well.

We can define the sword item as flag number 0: click Select on the Item icon in the Control Window. The Item Window will open.

Here you can scroll through all flags and define them properly. For our purposes we need to describe flag 0 as:

a metal sword

Then click on the 'Appear in Inventory' field to set its radio icon. This is because GTAC displays items, whose flag is set, in the Inventory Window, which can be displayed by clicking Adjust on the Item icon in the Control Window. When the player will collect the sword - which we are going to define soon - flag 0 will become set and its text description will appear in the Inventory Window.

As we want to reserve some flags for system purposes, for example to record if a door is locked or unlocked without this appearing in the Inventory Window as it is not an item being carried but only a 'system state', every flag has a switch: the 'Appear in Inventory' radio icon. When its switch is set, the flag's description is allowed to appear in the Inventory Window, thus being a real item.

So, let us continue with our adventure. We are in room 2, on the path leading west. Open the Action Control Window and type the following as option 0:

There is a sword. Take it +0 !(?0)

Action '+0' sets flag 0 when the option is selected from the Action Window: the '+' is the set flag command. Its complement is the '-' reset flag command.

Condition '!(?0)' is a bit complex. '?0' tests flag 0 and returns 1 if it is set and 0 if it is reset. '!(...)' toggles the condition inside brackets: it swaps 0 with 1 and viceversa. Thus when we are not carrying the sword, flag 0 is reset, '?0' returns 0 and '!(?0)' is equivalent to '!(0)' which becomes '1'. In this case the whole condition is True.

When we pick the sword up we '+0' set flag 0 so '?0' returns 1 and '!(?0)' becomes equivalent to '!(1)' and then '0'. So the condition is not verified anymore and the 'There is a sword. Take it' option disappears from the Action Window.

Let us now provide the opposite option, i.e. to drop the sword. Position the caret in option 1 and type:

Drop the metal sword -0 ?0

The action is to reset flag 0 and the condition is verified only when flag 0 is set, i.e. when we are carrying the sword.

Let us now give the player the opportunity to go back to the cave. Thus define option 2 as:

Go back to the cave r1 1

Now click the Update icon in the Control Window.

Let us set room 3 up: add a new room by clicking the Add/Copy room icon and press Return twice. By the way, it is named Add/Copy room icon because if you click Adjust instead of Select you will be offered the opportunity to create a new room copying it from another one. You can try it later, now type in room 3:

You are inside the cave. Light comes from a hole in the ceiling. A huge terrible Dragon is in front of you and your loved Princess is lying down on the ground behind him, crying.

now enter the following options:

Attack Dragon r4 !(?0)
Attack Dragon r5 ?0
Escape r1 1

Option 0 and 1 will never appear at the same time. The first one is displayed when the player is not carrying his sword. In this case game play will continue from room 4, where we will say the Knight has been killed by the Dragon.

The second option is displayed when the player is carrying his sword. In this case game play will continue from room 5, where we will say the Knight has killed the Dragon.

The last option allows the player to leave the cave: game play returns to room 1.

Done? Okay, click the Update icon in the Control Window and add the following rooms:

room 4)

You attack the Dragon with your bare hands but get killed. Your adventure ends here.
option 0)
Restart r0 1
room 5)
You attack the Dragon with your hand held high and manage to kill him with your sword. You embrace your loved Princess and leave the cave. Well done!!
option 0)
Restart r0 1

In both cases 'Restart' is followed by 'r0'. Even though room 0 does not actually exist, it is used as a dummy room. When a 'r0' command is executed GTAC resets all flags and variables to the default settings and then resumes game play from room 1. It is useful to restart game play to the beginning.

We have finished our small adventure. How long did it take to you to write it?

3.5 - Save to disc


We have now to save it to disc: just click the Save icon in the Control Window.

3.6 - Playtest


Try playing it: click the Menu button on the mouse inside any GTAC window, follow the Playtest> submenu and click on Restart. Now click in the Action Window to move around our little adventure. If you open the Inventory Window you can watch its list change when you pick up or drop the sword.

We have forgotten something: we have to add our name to the adventure! Click Menu inside any GTAC window and follow the Project>Info> submenus. Click Select in the writable field next to 'Author:' and type your name in. Press Return and save everything to disc.

Whenever you start again GTAC and want to reload this adventure, open the directory viewer containing the !MyProject filer icon and drag this icon onto the GTAC icon bar icon.

3.7 - Pictures


You may want to add some graphics now. GTAC can display pictures, provided that these are saved as Draw files. Draw files can be created with several art packages around, first of all the Acorn !Draw application.

Draw files can also contain bitmap graphics, i.e. Sprites, which can be painted, scanned in and processed in many ways, first of all using the Acorn !Paint application. It is important, however, that Sprites are saved together with their palettes, in order to be correctly displayed.

Draw files can contain text and outline fonts. Anyway you should install the required fonts before running GTAC or its adventure, otherwise the System font will be used. Another solution is to convert to path your text from !Draw, before saving and importing into GTAC. Please refer to your Acorn RISC OSApplication Guide.

Moreover, Draw files can be squashed by the Acorn !Squash application, to make them occupy less space. These will be kept compressed in memory and decompressed on the fly, i.e. one at a time and only when needed, thus reducing memory occupation to the bare minimum. As this operation can introduce some delay, especially on ARM2 machines, files saved in plain Draw format (i.e. not squashed) will be kept in memory unsquashed and no decompression will be carried on, without slowing down the computer. In this way you can choose whether to use Squash or not by saving pictures in Squash or Draw format. For more information about using Acorn !Squash application to squash files, please refer to your Application Guide.

Okay, click the Graphics icon in the Control Window in order to open the Picture Control Window.

Here you can cycle through every picture held in memory. At present, of course, none will be available. Open the GTAC "Pictures" directory, which is in the same directory viewer as GTAC. Drag the "Cave" file into the Picture Control Window: you can see now that it is loaded and occupies 41140 bytes. Click the Show on screen icon to open the Graphics Window. As you can see, this is a simple picture displaying the entrance of a cave and is loaded as picture number 0.

Now click the right arrow next to the Show on screen icon to select picture 1, which is still unloaded. Drag the "Dragon" file into the Picture Control Window: as you can see, it is squashed and occupies 9952 bytes.

Select a 256 - or more - colour mode for better graphics. As you can soon discover, the Graphics Window is fully resizeable. The "Frame" Draw file in the same directory is a frame with the same dimensions as the default sized Graphics Window. You can use it as a basis for your graphical creations.

Click the Close icon to close this window. The Graphics Window will close, but pictures 0 and 1 are still in memory.

By clicking the left and right arrows in the Control Window, select room 1. In our adventure this is set at the cave entrance so we may want to display picture 0: move the mouse pointer onto the writable field next to the "Pic. no.:" and click Select to position the caret. At present you can read "-1", which means "no picture with this room". Delete it and write "0", instead, and press Return: we have just linked picture 0 to room 1.

If the Graphics Window is closed, click the Graphics icon and then the Show on screen icon. Each picture can be linked to several different rooms.

Now select room 3 and link it to picture 1. Then save the adventure.

3.8 - Sound


We are now ready to add some sound. Open the "Samples" directory, which is in the same directory viewer as !GTAC. Here you can find several files: these are relocatable modules and, particularly, voice generators. These files, once loaded, add new voices to the RISC OS Sound System. Sound samples are recorded from microphones, tapes, CDs and other sources but, as your computer is not capable of sampling sounds on its own it needs a special interface. Contact your local Acorn dealer if you want to buy one. Anyway you can find many ready-to-use samples bundled with sound processing software, like Armadeus from Clares or AudioWorks from Computer Concepts.

Once recorded, a sound sample must be converted into a voice generator module, still using your favourite sound processing software.

Click the Samples icon in the Control Window: the Samples Window will open.

As in the Picture Control Window, you can cycle through loaded modules using the left and right arrows at the top. On the right you can read the voice generator name.

Try dragging the "I_am" file from the "Samples" directory into the Samples Window, then click the Play button. Can you hear it?

Clicking on the three slider bars you can fine tune amplitude from 256 (silent) to 383 (loud), pitch from 256 (low) to 32767 (high) and duration from 0 (no sound) to 255 (12.75 seconds). Duration is in 1/20 of seconds, i.e. 20 = 1 second. Please refer to the Acorn RISC OS User Guide for more information under *Sound command.

In our present state the sample is played at too high rate. Choose a lower value for pitch, for example around 5000, then click Play. Now it is too low and too short. Set pitch to 8005 and duration to 31. It is much better now, isn't it?

Close this window. Suppose we want to play this sample when we enter the cave, as if it was shout by the Princess, waiting for us to free her. Open the Action Control Window in room 1 and in the action field of option 0 change




Now click the Update icon and then choose "Enter cave" in the Action Window: the sample will be played and then you will enter the cave!

In fact, 'p0' is the 'play' command and plays sample 0, that we have just fine tuned: GTAC stores our settings accordingly. Again save the adventure.

You can write complete adventures as we have done just now. All you need is fantasy, imagination and accurate project design.

In the "Examples" directory you can find several projects ready for you to load and study. But please read the following sections before going on: many other GTAC features are discussed in details and necessary to completely understand how the examples work.

By the way, you can change the !MyProject filer icon, if you want. This icon is actually a set of sprites created in different screen modes and stored as !Sprites, !Sprites22 and !Sprites23 in the !MyProject directory. Just load in !Paint and edit at your will. For more details please refer to your Application and User Guide.


(C) 1994-2000 Andrea Gallo