Contents Up Previous Next

Setting up the game

Now that you know how to create a room, it's time to set up the game-wide settings. These include inventory objects, global messages, palette setup and other things which do not depend on individual rooms.

Palette setup
Inventory
Importing your own sprite graphics
Global Messages
Introduction sequences
Animations
Characters
Conversations
Game options
Cursors
Fonts


Palette setup

The first thing you need to do when you create a new game is to decide whether you want to use 8-bit (palette-based) colour or 16-bit (hi-colour). If you want to use 16-bit colour, you can still use 256-colour backgrounds and sprites if you want to, but the engine will only run in a 16-bit colour resolution, thus slowing it down.

If you want to use 8-bit (because it runs faster), you need to set up the palette. This is because all sprite and background scene imports rely on the palette setup to be the same. You CANNOT use hi-colour sprites or backgrounds in a 256-colour game.

Choose the "Palette" pane. Here you will see the 256-colour palette displayed in a grid. Most of the slots are marked "X" - these are the slots reserved for the background pictures, and will be different in each room. The other colours will be as they look here for the entire game. These fixed colours allow things like the main character graphics, which must be displayed on more than one screen, to work.

If you want, you can assign more or less colours to the backgrounds. To toggle the background assignment on/off, click on the slot, then check the "This colour is room-dependant" box to swap the slot's status.

IMPORTANT NOTE: You must set up the palette as you want it before you start making your game - if you change it later, you will have to re-import all the sprites and background scenes.

You can select multiple colour slots by clicking on the first slot, then shift-clicking on the last slot in the range you want to select. You can then toggle the background status of all the selected slots at once.

The "Export pal" button exports the entire palette to a .PAL or PCX file which you can then use to read back into the Editor in a different game. If you choose to export to a pcx file, then a screen shot of the Palette Editor will be saved as the picture. This way you can see all the game-wide colours in the file.

The "Import pal" button replaces the selected palette entries with those entries from the PAL or PCX file you choose. It can read standard 768-byte PAL files, SCI palette resources (renamed to extension .pal) and JASC PSP palette files.


Inventory

Most adventure games allow the player to carry a set of objects, which he can then use to solve puzzles. Adventure Game Studio makes this inventory easy for you to manage.

Every inventory item which the player may carry during the game at one time or another is listed under the "Inventory" pane. Here, each item also has a number which you use in interactions to identify the object. The left hand side of the screen lists all the items in the game. On the right is the graphic used for the object in the inventory window. To change this, click the "Change image" button, then select the new graphic from the dialog which appears.

If you want the player to start the game with this item in his inventory, check the "Player starts with this item" check-box. To create a new item, click the "New item..." button. You will be asked for the new item's name, and then it will be assigned the next available number.

The last thing to do with the inventory items is to define their interactions: what happens when the player manipulates them in the inventory window. Click the "Interaction" button, which brings up a window which works identically to the hotspot interactions. The available events are described in the reference section.

NOTE: Several limitations apply to the commands you can use in the Inventory interactions. This is because they must run from all rooms, and so cannot have any room-specific commands. In particular, do not use any Object commands, and if you use a "Display message" command, then it must display a global message.

To give the item to the player during the game, you use the "Player - Add inventory" and maybe "Object - Remove object" commands. The inventory number required by the former command is the item number from the list described above. Remember that an inventory item is NOT the same thing as an object.

NOTE: Each character in the game carries their own set of inventory items. This means, if you want to create a game like Day of the Tentacle, where the player can control three different characters, each character will have a separate inventory.

You have two choices about how the inventory is displayed to the player -- a built-in inventory window to get you started, and support for custom inventory windows when you're ready to make your own.

The default option is the Sierra-style pop-up inventory window, which is popped up by clicking on the Bag icon on the icon bar (which uses the text script InventoryScreen function to display it). You can also have the current inventory item displayed in its own button on the icon bar by creating a button on the GUI and setting its text to (INV) which stretches the item picture to the button size, or (INVNS) which draws the inventory item picture straight onto the button with no resizing. Finally, (INVSHR) , probably the best option, will draw it at actual size if it will fit, or shrink it if not.

The other option is a custom inventory window. To use this, you will need to edit the GUI to add it, so I will explain this later on. While you are starting off with AGS, it is recommended to use the supplied standard Sierra-style inventory window.

Finally, you may have noticed a "Draw hotspot dot" checkbox at the bottom of the Inventory pane. If you check this, then when the player selects an inventory item, the mouse cursor for it will have a dot and mini-crosshair drawn on it, to show the player where the hotspot is. You can enter the colour for the centre dot and also for the surrounding 4 pixels.


Importing your own sprite graphics

When you were choosing the graphics for the object earlier in this tutorial, you probably noticed that most of the graphics available didn't look up to much. This is no problem, because you can import your own graphics using the Sprite Manager.

Go to the Sprite Manager pane in the editor. Here, you will see the complete sprite set for the game. There are two ways to import your graphics - either overwrite an existing slot with your graphic, or create a new slot for it.

To overwrite an existing sprite, right-click the sprite and select "Import over this sprite". To import a new slot, right-click on the background to the window and choose "Import new sprite".

When you choose either of these options, a window appears which has a couple of options in it, and a big "Import from File" button. If your game is hi-colour, you also get an option to paste from the clipboard* (see note below).

To import your graphic, click the "Import from File" button. The graphic you choose must be at the same colour depth as your game (ie. if you are using hi-colour backgrounds, your sprites must be hi-colour, and vice versa). The picture is displayed on-screen.

If you move the mouse over the image, you'll notice a rectangle following the cursor around. This is the portion of the image that will be imported when you click the left mouse button. To resize the rectangle, click and drag the right mouse button. Or, you can import the entire image with the "Grab entire image" button.

NOTE (256-colour only): You may well find that the colours on your graphic look slightly strange in the Room Editor. This is because the sprites are only allocated, by default, the first 41 of the palette colours (see the palette section), so your graphic will be remapped to this much smaller palette. If you find that many of your imported sprites look strange, you can increase the number of colours assigned to sprites, at the expense of background colours (again see the section above for information on how to do this).

If your sprite will only be used in one room then alternatively you can use the "use background palette" option, which will remap your graphic to the palette of the room currently loaded, giving much better results. Note, however, that if you do this, and then try and use the sprite on another screen, its colours will most likely be screwed up. To use the room palette, check the "use bkgrnd pal" check-box. Make sure to un-check this box before you import any other sprites.

NOTE: The transparent colour used by AGS is palette index 0 (for 256-colour sprites) and RGB (255,0,255) for hi-color. Any pixels you draw on imported sprites in these colours will be transparent.

You can group imported sprites into folders. This prevents the main sprite list from becoming very long (and you can only have 200 sprites per folder anyway). By default, the Sprite Manager displays the Main folder, which contains some graphics and a sub-folder called "Defaults". Folders work the same way as Windows folders. Right-click on a folder in the tree to rename it or make a sub-folder.

You can move sprites by dragging them into a different folder in the folder list. You can delete a folder by right-clicking on it and selecting the "Delete" option; beware though that this will also delete all the sprites in the folder.

* NOTE: A few people have experienced problems when importing from clipboard, in that the image colours get reversed (red becomes blue, blue becomes red, and so on) when they are running Windows at 24-bit or 32-bit colour. If this happens to you, there are two solutions: (a) turn down your desktop colour depth to 16-bit to run the AGS Editor, or (b) import your sprites from files rather than the clipboard.

Tiled sprite import

You may have noticed a checkbox called "Tiled sprite import". Some people find this a useful way of importing many frames of a character's animation at once.

In order for this to work, you need to have all your sprites lined up on your source bitmap at even intervals. Then, click "Import from file" and import it as usual. Check the "Tiled sprite import" box, and select the upper-left frame.

When you click the left mouse button, the selection rectangle will become un-filled and now you can drag the mouse to define how many frames to import - they'll all be enclosed by selection rectangles. Once you have the correct number, click the left button again and they will all be imported.

Alpha blended sprites

AGS supports alpha blended sprites if your game is 32-bit colour. In this case, you need to import a PNG or TGA image with an alpha channel (you cannot paste alpha-blended images from the clipboard).

When you do so, AGS will prompt you asking whether you want to use the image's alpha channel or not. If you select Yes, then the sprite will be drawn alpha blended in the game if it is used for a character, object, mouse cursor or GUI.

Note that if you use alpha blending, any overall transparency that you set (such as Character.Transparency, Object.Transparency, GUI.Transparency) will be ignored.

NOTE: Currently, alpha blended sprites cannot be antialiased, so if you have the Anti Alias Sprites option turned on in Setup, it will not be applied to alpha-blended characters.


Global Messages

While each room has its own set of messages ("local messages"), in some situations you need to be able to display a message from more than one room, or in a global game interaction which is not related to a room. For this purpose global messages are provided.

Choose the "Global messages" pane. Here you are presented with a list of the 500 available global message slots. By default, they are all empty except messages 983-999 which contain the default messages for actions on the player character, the Save Game dialog box, and so on. Global messages are numbered between 500 and 999 so that they are not confused with local room messages.

To display a global message, simply use its number in any "Display message" command.

You can include a couple of variables into global (and local) messages. You do this by inserting special tokens into the message. When the message is displayed in the game, the engine replaces the token with its value:

 token   replaced by
 @INx@  number of inventory item x that the player has
 @GIx@  the current value of GlobalInt x (used with SetGlobalInt/GetGlobalInt)
The default global messages are used as follows:
983   text when save/load disabled ('sorry, not now' is the default)
984   text for "Restore" button in Restore game dialog
985   text for "Cancel" button
986   the top "Select a game to restore" text
987   text for "Save" button in Save Game dialog
988   the header "Type a name to save as:" text
989   text for "Replace" button when save folder is full
990   header text "The folder is full, you must replace a game"
991   text header "Replace:"
992   header "With:"
993   text for Quit button in Quit dialog
994   text for Play button in Quit dialog
995   header text "Are you sure you want to quit"
996   message displayed if player clicks Inventory but has no items
997   default interaction for talking to player character
998   default interaction for interacting with player character
999   default interaction for looking at player character
You can of course change any of these messages to customize your game.


Introduction sequences

You can easily add intro, outro and cutscene sequences to your game. There is no specific function to do these, but using the provided animation and script commands you can create almost anything you might need.

Normally, the game will start in room 1. However, you can change this to any room you want. Go to the "Characters" pane. Make sure that the main character is selected in the list on the left. You will see on the right hand side "Start in room:" followed by "1". This is the starting room for the player character, and it is this entry that decides which is the first room loaded.

Set the starting room to room 0. Now, when you run the game, the intro will be the first room loaded. In this room, you will probably want to disable the main character (if you want a logo graphic up first). Remember, you do this through Room Editor -> Settings -> Player character visible.

TIP: The starting room facility is also useful when testing your game - you can make the game start in any room, at the point where you are testing it, rather than having to keep playing the game through to get there.

Cutscenes are created using the normal animation script commands, such as Character.Walk, Object.SetView, and so forth. I would suggest you leave this until you are more comfortable with AGS, and can appreciate how things are done.


Animations

In most games you will use some sort of animation during the game, whether it be a flag waving in the breeze or the player bending over to pick something up. The term "animation" refers to the ability to change the look of, and move, objects.

Animations in AGS are managed using Views. A "view" is a set of one or more "loops". A loop is a set of frames which, when put together, give the effect of movement. Each frame in the view can be set a graphic and a speed. Go to the editor's "Views" pane. This is the View Editor. Here you will see the main character's walking view.

Click the "New view" button to create us a new, empty view. Each loop is displayed horizontally with its number at the left hand side, frames going out to the right. To add a frame, click the grey "New frame" button. To delete a frame, right-click it.

To change a frame's graphic, double-left-click it. The sprite list screen will be displayed (you may remember this from the Object graphic selection) where you can choose the graphic you want to use for this frame.

Note that for walking animations, the first frame in each loop is reserved for the standing frame, and when walking it will only cycle through from the second frame onwards.

Below each frame you will see "SPD:0". This is the frame's relative speed, which you can change by clicking on the word "SPD:". The larger the number, the longer the frame stays (ie. the slower it is). When the animation is run, an overall animation speed will be set, so the actual speed of the frame will be: overall_speed + frame_speed . Note that you can use negative numbers for the frame speed to make it particularly fast, for example setting it to -3 means that the frame will stay for hardly any time at all.
Animation speed is specified in Game Loops (ie. animation speed 4 will show the frame for 4 game loops - at 40fps, that would be 0.1 seconds).

You will also see something marked "NO SND". If you click this, you can enter a sound number that will be played when this frame becomes visible on the screen. This is especially useful for footstep sounds.

You run an animation by using the interaction editor or script animation commands, which will be explained in detail later.

To animate an object, you first of all need to set the object's view to the correct view number (use the Object.SetView script command), and then use the Object.Animate script command to actually start the animation.


Characters

Adventure Game Studio makes it easy to add your own non-player characters into the game. A character is similar to an object, except that it can change rooms, maintain its own inventory, and take part in conversations (more on these later). It can also have its own custom animation speed and movement speed.

Go to the "Characters" pane. You will see on the left of the screen a list of all the characters in the game. To create a new character, click the "New character" button.

You will see that there are a lot of options which you can set for each character. First of all, the "This is the player character" check-box allows you to change which character the player will control at the start of the game. When the game starts, the first room loaded will be this character's starting room. By checking this box for one character, it will be de-selected for any other character which was previously set.

Secondly, the "Ignore room area scaling" check-box allows you to specify that this character will not be stretched or shrunk in scaling areas of the screen. This could be useful if you have a character who always stands still in the same place, and you want the graphics on-screen to be the same size as you drew them, even though he is standing on a scaled area.

The "Clickable" check-box tells AGS whether you want the player to be able to click on the character. If Clickable is checked, then the character will be interactable, like the way things worked in Sierra games. If it is not checked then the character works like the main character did in Lucasarts games - if you move the cursor over him or click to look, speak, etc, then the game will ignore the character and respond to whatever is behind him.

To set which room this character starts in, change the number in the "Start in room" box. You can set the character's location within this room by using the "At X:" and "Y:" textboxes, typing in the X,Y co-ordinates you want him to start at. These co-ordinates should be the middle of his feet.

The "Normal view" is where you set what the character looks like. You must create a view in the View Editor, and this view must have either 4 or 8 loops. If you use 4 loops, then when walking diagonally the closest straight direction is used for the graphics. Each loop is used for the character walking in one direction, as follows:

 Loop 0 - walking down (towards screen)
 Loop 1 - walking left
 Loop 2 - walking right
 Loop 3 - walking up (away from screen)
 Loop 4 - walking diagonally down-right
 Loop 5 - walking diagonally up-right
 Loop 6 - walking diagonally down-left
 Loop 7 - walking diagonally up-left
To change the rate at which the character animates, change the Animation Speed box. Here, a smaller number means faster animation. Note that this does NOT effect the speed at which the character actually moves when walking.

NOTE: The first frame in each loop is the standing still frame. When walking, the game will cycle through the rest of the frames in the loop.

The "Movement speed" option allows you to control how fast the character moves when walking. Here, a larger number means he walks faster.

The "Talking colour" option specifies which colour is used for the text when this character is talking. It effects both messages displayed with "Display message" commands which are set to that character, and also conversations. You can find out the colour for each number by going to the "Palette" pane.

The "Idle view" button allows you to set an idle animation for the character. To do this, create a new view, with one or more loops of the character idle (eg. smoking, reading a book, etc). Then, click "Idle view" and type in the view number. If the player stands still for 20 seconds (you can change the timeout with the Character.SetIdleView script function), then the current loop from the view will be played.

On the right of the screen is a button called "Script Name". This sets the name by which the character will be referred to in scripts and in conversation scripting. The difference from the main Name of the character is that the script name may only contain letters A-Z and numbers 0-9 (the first character must be a letter, however).

To set what happens when the player interacts with the character, click the "Interaction" button. You will be presented with the (by now familiar) interaction window. Note that, as with Inventory interactions, you may NOT display a local message or use Object commands. Basically, you need to display global messages or use scripts to handle character interactions.

You can also set a talking view for the character. To set one, click the "Talking view" button. If you set a talking view, then that view will be used to animate the character while they are speaking. You should generally have about 2-3 frames in each loop (the loops are used for the same directions as in the main view).

There is also an available "Blinking view". This is used to play intermittent extra animations while the character is talking. You may want to use this for effects such as blinking (hence the name). If you set a view here, it will play intermittently while the character talks (it is drawn on top of the normal talking view). The default time between playing is 3-4 seconds, but you can change this with the Character.BlinkInterval script property.
NOTE: the blinking view is currently only supported with sierra-style speech.

"Ignore room area lighting" tells AGS that this character will not be affected by light and tint levels set on room regions.

"Do not turn before walking" overrides the General Setting for turning, and tells AGS not to turn this particular character around on the spot before they move.

"Diagonal loops" specifies that loops 4-8 of the character's view will be used for the four diagonal directions. If this option is not checked, the character will only face 4 ways, and you can use loops 4-8 for other purposes.

"Adjust speed with scaling" modifies the character's walking speed in line with their zoom level, as set on the walkable areas.

"Adjust volume with scaling" modifies the volume of any frame-linked sounds on the character's view (eg. footstep sounds) with their zoom level, as set on the walkable areas.

"Solid" specifies that this character is solid and will block other characters from walking through it. Note that both characters must be solid in order for them to block one another.

AGS allows you to export your characters to a file, and then import the file into a different game - so you can share the same main character between games, or create one for distribution on the internet. When you click the "Export char" button, you will be asked what you want to call the file, so type a short name and press ok. The entire character setup, and graphics, will be exported to the file. This includes the character's walking and talking graphics. Then, in the editor later (with any game loaded), click the "Import character" button. The file selector appears, where you should find the CHA file which you exported earlier. A new character slot will be created and all the settings imported.

NOTE: Because importing always creates a new slot, you cannot use it to overwrite an existing character.


Conversations

While the old Sierra games were mainly based on action and not talking, the Lucasarts games took the opposite approach.

If you want to create a game with conversations where the player can choose from a list of optional topics to talk about, you can now with the new Dialog Editor. Go to the "Dialogs" pane.

Conversations are made up of Topics. A "topic" is a list of choices from which the player can choose. You may have up to 30 choices in a topic. However, not all of them need to be available to the player at the start of the game - you can enable various options for conversation once the player has said or done other things. For example, when you talk to the man in the demo game, the first option is just "Hi". Once he has said this, however, a new option becomes available.

The Dialog Editor is quite self-explanatory - you view one topic at a time, using the list on the left to choose the current topic. Then, you see the list of options for the current topic on the right. Each option has a couple of checkboxes to its right:

You control what happens when the player chooses an option by clicking the "Edit script" button. This is NOT the same script language as the main text scripts use - it is a much simplified and easier to understand language specific to dialogs.

Each topic has its own script file. When you click "Edit script" for the first time on a topic, all you will see is a number of lines starting with an '@' symbol. In the dialog script, these signify the starting points of the script for each option. For example, when the player clicks on option 3, the script will begin on the line following "@3". There is also a special starting point, called "@S". This is run when the conversation starts, before any choices are given to the player. This could be used to display a "Hello" message or something similar.

To display some speech, you begin the line with the character's SCRIPT NAME (not full name), followed by a colon, then a space, and then what you want them to say. For example, if my main character's script name is EGO, I would write

ego: "I am very happy today because it's my birthday."
The character name is used by the system to choose the correct colour for the text.

You can also use the special character name "narrator", which displays the text in the pop-up message box instead of as speech text; and the alias "player", which will say it as the current player character - useful if you don't know which character the player will be controlling when they speak the conversation.

If you just use ... as the text for a character to say, the game will pause briefly as if they are stopping to think, and nothing will be displayed.

To signal the end of the script for this option, place a "return" command on the last line of it. For example,

@1
ego: "Hello. How are you?"
narrator: The man looks you in the eye.
otherman: ...
otherman: "I'm fine."
return
This tells the program to go back and display the choices again to the player. If you use "stop" instead of return, then the conversation is ended. You use this after the player saying "Goodbye" or something similar.

The dialog commands available are:

For an example of a dialog script, load the demo game into the editor and look at the script for its topic 0.

Parser input

You'll notice in the dialog editor, a checkbox "Show text parser with this topic". If you check this, a text box is displayed below the predefined options, which allows the player to type in their own input.

If they type in something themselves, then the dialog_request global script function will be run, with its parameter being the dialog topic number that the player was in.

AGS automatically calls ParseText with the text they typed in before it calls dialog_request, so you can use Said() calls to respond. See the text parser section for more info.


Game options

On the Game Settings pane you may have noticed quite a lot of check-boxes. These set gamewide options, and mean the following things. Note that some things listed here are explained later in the documentation, so if you don't understand one of the items in this list, come back to it later.

Most of these options can be changed at runtime with the script command SetGameOption.


Cursors

The Cursors mode of the editor shows you the current mouse cursor modes available in the game. Each cursor mode performs a different action within the game.

The "Standard cursor mode" checkbox tells AGS that this is a 'normal' cursor mode - ie. using this cursor will generate an interaction on whatever is clicked on as usual. This mode applies to the standard Walk, Look, Interact and Talk modes, but you can create others too. Do not tick it for the Use Inventory mode, since this is a special mode.

The "Animate" checkbox allows you to specify that the mouse cursor will animate while it is on the screen. Choose a view number, it will use loop 0 of that view. You can make it animate only when over something (hotspot, object or character) by checking the appropriate box. The "Only when the mouse is moving" box allows you to do a QFG4-style cursor, where it only animates while the player is moving it around.

Three of the cursor modes are hard-coded special meanings into AGS:

For the standard modes,


Fonts

Adventure Game Studio allows you to replace the default font and to add your own. You can use both TrueType (TTF) and SCI fonts (Sierra's font format). SCI fonts can be created in two ways: There are also some fonts available on the AGS website.

Note that SCI fonts are faster to render than TTF fonts, and so may give your game a speed advantage. It's preferable to use a SCI font if you can.

Go to the "Fonts" pane. Here you can see all the current fonts by using the list on the left. You can create a new font slot by clicking the "New font" button. To import your font into the current slot, click the "Import font" button.

Fonts can have outlines. For lucasarts-style speech, outlines are really a necessity since they stop the text blending into the background and becoming un-readable. To outline a font, either click the "Automatic outline" radio button to have AGS do it for you, or you can use a specific font slot as the outline font (it will be drawn in black behind the main font when the main font is used).

NOTE: If you go to your Windows Fonts folder, you will not be able to select any fonts to import, since double-clicking them will open them up in the Windows Font Viewer. Unfortunately there is nothing I can do about this, you must either type the filename in manually, or copy the font to another folder and import it from there.

NOTE: Font 0 is used as the normal text font, and font 1 is used as the speech font. To use any additional fonts, the script functions SetNormalFont and SetSpeechFont can be used at runtime.