Creating a simple game

From QuestWiki
Jump to: navigation, search

Contents

Anatomy of a Quest game

Every Quest game is made up of the following parts. Here are the main ones:

Elements

There are various types of element:

Objects
Objects are the basic building blocks of the game. Everything "physical" in the game is an object - that includes rooms and the player themselves. So in a simple game where the player is in a lounge, and there is a cat and a table in the lounge, there are four objects in total - the lounge, the player, the cat and the table.
Objects can contain other objects. This is done by setting the "parent" attribute. In our simple example, the lounge has no parent - it stands alone. The player is in the lounge, so the player's parent is "lounge". If the cat is sitting on the table in the lounge, then the cat's parent is "table", and the table's parent is "lounge".
Exits
Exits connect objects (usually rooms) together. The exit has a parent, so our simple game might have an exit from the lounge by setting the exit's parent to "lounge". Exits also have a "to" direction, so this exit might point to another room, such as the kitchen. Or, it might point to an object inside the same room, such as a cupboard - this would allow the player to go inside a cupboard in the room.
Commands and Verbs
Commands handle player input. They can exist globally, in which case the command will work everywhere. Commands can also exist inside a particular room, in which case that command will only work in that room. Commands have a pattern, such as "look at #object#". When the player types something, it is compared to all the available command patterns. The best match is then used to process what the player typed in. So if the player typed "look at cat", the "look at" command is matched, and it performs whatever action is necessary to print the description of the cat.
Game
The game itself is a special kind of object - it contains attributes such as the name of the game, options such as how to print room descriptions, and display settings.

Attributes

All element data is stored in attributes. An element can have an unlimited number of attributes. Attributes can store things such as the object description, alternative object names, the behaviour when an object is taken, which objects can be used on the object, and much more. The attribute can be of many types:

String
A sequence of letters/numbers, for example "The cat is sitting quietly on the table". Obviously, strings are very common in text adventure games!
Integer
A whole number, such as 1, 2, 3, 42 or 1 billion.
Script
One or more script commands, which are instructions for Quest to carry out. Everything that happens in a game is controlled by script commands. Script commands can print messages, move objects around, show videos, start timers, change attributes, and much more.
List
Lists of strings or objects
Dictionary
A look-up table of strings or objects

Libraries

Libraries are used to include common functionality in a game. There is a standard "Core" library that is included by default with all Quest games. This is made up of the elements above - commands, scripts and so on - and provides a lot of the standard functionality that players will expect in your game, such as the "look at" command, printing room descriptions, and so on.

Getting started

Don't worry about remembering all of the above information now - it should all become clear as you work your way through the tutorial. Let's get started.

Most of the tutorial is applicable to both the Windows desktop version of Quest, and the web version. Any differences in the two versions will be mentioned as we go along.

Creating a blank game - Windows desktop version

Video Tutorial: Creating a Simple Game with Quest

To create a new game, open Quest and click the File menu, then Create New Game.

Newgamemenu.png

Alternatively, you can switch to the Edit tab and click the "Create a new game" button.

You'll see a screen like this:

Newgame.png

Enter a name like "Tutorial Game". Quest will create a folder and a game file for you. You can change where it puts the file by clicking the "Browse" button - it is recommended that you put your game file in its own folder.

Click OK and you'll see the main Editor screen:

Blankgame.png

On the left is a tree showing you every element of the game. The "game" element is currently selected, so that's what we can see in the pane on the right.

Quest has created a room called "room" for us, and inside this room is the "player" object, so that's where the player will begin when you run the game. You can test the game by clicking the "Play" button on the toolbar, or "Play Game" from the File menu. You can also press the F5 key.

As you'll see, it's a pretty empty game at the moment:

Playblankgame.png

You can go back to the Editor by typing "quit", choosing "Stop Game" from the File menu, or pressing Ctrl+F4.

Creating a blank game - web version

To create a new game, log in to Quest. You'll see the "New game" form.

Enter a name like "Tutorial Game" and click the "Create" button. Click the link which appears, and you'll see the main Editor screen.

On the left is a tree showing you every element of the game. The "game" element is currently selected, so that's what we can see in the pane on the right.

Quest has created a room called "room" for us, and inside this room is the "player" object, so that's where the player will begin when you run the game. You can test the game by clicking the "Play" button at the top of the screen.

Simple Mode

When starting out with Quest, you may find it easier to run in "Simple Mode". This hides much of Quest's more advanced functionality, but still gives you access to the core features.

You can toggle Simple Mode on or off at any time:

Setting up rooms

Video Tutorial: Setting up rooms and exits in Quest

Quest created a room called "room", which isn't a very good name. In this tutorial game, we want to start in a lounge, so select "room" from the tree and change its name.

Renameroom.png

To create a room description, click the "Room" tab. Enter a Description in the text editor - something like "This is quite a plain lounge with an old beige carpet and peeling wallpaper."

Editroomdescription.png

Let's add a second room to the game.

In the Windows desktop version, there are three ways you can do this:

In the web version:

Add a room called "kitchen", and give it a description - use your imagination!

If you play the game at this point, you'll see the player is still trapped in the lounge, with no way out. To be able to get to the kitchen from the lounge, you need to add an exit.

Adding an exit

To do this, click back to the "lounge" room and go to the Exits tab. Then click the "South" exit:

Addexit1.png

To create the exit, choose "kitchen" from the drop-down list on the right. Ensure that "Also create exit in the other direction" is selected, then click the "Create" button.

Addexit2.png

When you click the "Create" button, actually two exits are created - one exit south from to lounge to the kitchen, and another exit north from the kitchen back to the lounge. You can see both exits in the tree.

It is helpful to think of exits as "one way". Each exit is "in" only one parent room (the "from" room), and points "to" one other room. That is why we have one exit in the lounge, pointing to the kitchen. A separate exit is in the kitchen, pointing to the lounge.

Exits, like every object in Quest, can have an alias, which is simply a way of displaying a particular name to the player. Notice how the two exits we just created have aliases of "south" and "north". (We could give our exits any alias - it doesn't have to be a compass direction. If we were setting a game on a ship for example, we might have exits with aliases like "port" and "starboard".)

Play the game and verify that the player can go south and north between the lounge and kitchen.

Adding objects

Video Tutorial: Adding objects in Quest

Now let's add some objects to the lounge, to give the player something to do.

A lounge is barely a lounge without a TV in it, so let's add one now. With the lounge selected, you have four different ways of adding an object to the room. You can:

Use one of these methods to add an object to the lounge. A prompt will appear asking you to enter a name for the object. Enter "TV". Leave the parent as "lounge" and click OK.

Object Names and Aliases

It is important to note the distinction between:

Name: In order to avoid confusion, each object must have a unique name. So, if you have multiple televisions in your game, they must be given different names – like "TV1", "TV2" and so on.

Alias: Of course, this wouldn’t sound natural if these were the names that players saw, which is why Quest lets you set an alias. This is the name of the object that the player sees. In the example of multiple televisions, each of your TV objects could have an alias of "TV".

If you don't set an alias, players will see the object name – so you only usually need to worry about this if you want different objects to have the same displayed name.

So for now, we can leave the Alias box blank for the TV.

Other Names

If you go to the "Object" tab, you'll see an "Other Names" box. This lets you specify additional names that players can use to refer to this object. It is important to note that different players will have different ways of interacting with your game – some players prefer to use the lists that Quest displays on the right-hand side of the window to interact with objects and so on, but many players prefer to use good old-fashioned commands. You want to make it easy for Quest to understand what players type in, so you can add additional, alternative object names to ensure that happens. For example, for our TV object, some players might type in "look at television", and would reasonably expect that to work.

So, add "television" to the list of Other Names for this object. This will ensure that players can type in either "look at TV" or "look at television" to look at this object.

As an exercise, add any other alternative names you think that players might want to use.

Othernames.png

Description

If you run the game and look at the TV, you’ll see that Quest doesn’t have much to say on the subject - it says "Nothing out of the ordinary".

That's a bit boring - it's a sign of a bad game if you can't even be bothered to come up with descriptions for all your objects. We don't want to make a bad game, so let's add a description for this object. To do this, go to the Description drop-down in the bottom half of the object's Setup tab and select "Text".

Objectdescription.png

Now enter the description. You could write something like "The TV is an old model, possibly 20 years old. It is currently showing an old western."

Launch the game again and verify that it now shows you the description when you look at the TV.

Adding a verb

It is a good idea to think about what kinds of things players might try to do to any objects in your game. In our example of the TV, it seems likely that a player might try to type "watch tv", so it would be good if our game came up with a good response, rather than just saying it didn't understand.

To do this, let's add the verb "watch" to our TV object. As you should remember from school, verbs are "doing words", and that's what they are in Quest – verbs let you say what things can be "done" to your object.

Go to the Verbs tab, click the "Add" button and type "watch". You can choose either to print a message or run a script when the player watches the TV. Enter a message. For example, "You watch for a few minutes. As your will to live slowly ebbs away, you remember that you’ve always hated watching westerns."

Addverb.png

Exercises

As an exercise, add the following objects to the lounge:

Launch the game and verify that the objects you've just created have been set up and are working correctly – check that you can watch the TV, try to sit on the sofa, and read the newspaper.

We're now on our way to making our first text adventure game. You may have noticed that, so far, we've only been walking around the game world and looking at things – we've not yet managed to interact with it and change it. We'll start to do that in the next section, where we look at taking and dropping objects.

Tutorial

Beginners

  1. Introduction
  2. Creating a simple game
  3. Interacting with objects

Intermediate

  1. Using scripts
  2. Custom attributes
  3. Custom commands
  4. More things to do with objects
  5. Using containers
  6. Moving objects during the game

Advanced

  1. Using timers and turn scripts
  2. Changing templates
  3. Text formatting
  4. Using lockable exits
  5. Using lockable containers
  6. Using walkthroughs
  7. Multiple choices - using a "switch" script
  8. Debugging your game
  9. Releasing your game

Elite

  1. Creating functions which return a value
  2. Using inherited types
  3. Using libraries
  4. Using Javascript
Personal tools
Namespaces
Variants
Actions
Navigation
Quest Documentation
Toolbox