AGI for Newbies Chapter 2 - Nuts and Bolts
A peek into an AGI game directory
If you look into the folder of an AGI game, you'll see a lot of files with strange names. "WORDS.TOK?" "LOGDIR?" What the heck is that?
Nearly all of the files you'll find are directly used by AGI during the game. Not all of them, however, are actually parts of the game itself. Let's go through the files one-by-one.
- Saved Games -- These files have names like "SG.3," "KQ3SG.1" or "SQSG.5". (Basically, if it ends in "SG." followed by a number, it's a saved game.) These files are very small (although their actual size depends on the length of the game), and are not part of the game itself.
- OVL Files -- These files are binary code used by the game. Some OVL files are graphics drivers, such as "HGC_GRAF.OVL" or "EGA_GRAF.OVL". Others are drivers for other internal functions, such as "IBM_OBJS.OVL". One of the files, "AGIDATA.OVL" contains some basic AGI code and copy-protection data. None of these files are part of the game itself.
- HGC_FONT -- This file is the font used by AGI with the Hercules Graphics Card. It's not part of the game.
- AGI -- This file contains most of the code for the interpreter. It can be modified to change how the interpreter works. For example, the AGISB patch adds Sound Blaster support to AGI by modifying this file. The "AGI" file is not part of the game.
- SIERRA.COM -- Sometimes the name of this file is changed to match the name of the game, such as "KQ3.COM". However, it is still the same file. This program is the "loader" for the game, and is the only executable file in the game's directory (unless you've installed AGIHack or some other utility). This file is not part of the game.
- OBJECT -- This file contains all the names of the items that the player can pick up. It is part of the game itself.
- WORDS.TOK -- This file contains all the words the game's parser will understand. It is part of the game.
- VOL Files -- These files ("VOL.0", "VOL.1", etc) contain the "meat" of the game: its graphics, sound, and programming.
- VIEWDIR, PICDIR, SNDDIR, LOGDIR -- These files point the interpreter to the places in the VOL files where the game's resources are stored. It categorizes resources by number.
- BAT Files -- These files are neither part of the game nor part of the interpreter. They can be safely ignored or deleted.
If your game is on a floppy disk rather than on your hard drive, DO NOT DELETE OR OVERWRITE ANY FILES. Doing so may cause the game to stop working. To modify the game, first copy the files to your hard drive.
A closer look at the VOL files
The VOL files, as mentioned above, contain most of the game's data. These files contain four different types of game resources:
- View -- The on-screen animated objects are all stored in View resources. A View resource can contain various "cels," all arranged in "loops." We'll discuss Views more in depth later.
- Picture -- The Picture resources provide the visual background for rooms in AGI games. They also tell the interpreter which objects go behind other objects, and where moving objects are allowed to go.
- Sound -- SOUND resources are capable of storing three synchronized musical voices, and one synchronized noise voice. The SOUND format is highly optimized for the IBM PCjr's sound chip, the TI-SN76496A, but can be played on other sound cards, such as the Sound Blaster.
- Logic -- Logic resources are the actual programming of the game. Logic resources will be discussed much more later.
Here's a metaphor you can picture: think of your AGI game as a Broadway-style musical production. The View resources are your actors and props, the Picture resources your set. The SOUND resources are your orchestra pit, and the Logic resources are your technical crew.
A brief introduction to AGI Studio
If you haven't already done so, grab a copy of AGI Studio. It requires Windows.
Now you're in AGI Studio. Right now it will look like just a big empty window with a toolbar on the top and some menus. Let's start a new project.
To start a new AGI game project in AGI Studio, follow these steps:
- From the Game menu, select New/From Template. This will start a new project using the AGI Template that comes with AGI Studio. (We could also create a completely blank game, but using the Template is easier and quicker. Throughout this tutorial, we'll be using the Template.)
- Using the dialog box that popped up, create a directory for your new game. Select the directory and press OK.
- After a short delay, while AGI Studio prepares your new directory, two windows will appear. One is called "Resources" and the other is called "Preview." The Resources window displays all the resources (Views, Pictures, Sounds, and Logics) in your game's VOL files. Currently it should be displaying Views. To change that, use the drop-down box that says "View" to select another resource type.
The Preview window displays a preview of the currently selected resource in the Resources window. Some resources can't be previewed, such as the SOUND and Logic resources. (This may change in a future version of AGI Studio.) Let's try previewing a resource.
* Using the Resources window, select "VIEW.000". * Notice that a picture of loop 0, cel 0 of VIEW.000 appears in the Preview window. This picture should be a man in a blue shirt. * Use the cel forward/back buttons to change cels. Notice that the man appears to walk. This is because each cel holds an image of the man in a different walking position. * Click the loop forward button. Now cycle through the cels using the cel forward button. Notice that the man appears to walk in a different direction. This is because each loop holds cels of the man in different walking positions. Each loop is a different direction.
To run the game, there must be an interpreter in the game's directory. If your template game did not include one, you can copy it from another AGI game, such as on of the AGI Demo Packs or one of the fan games. Copy the following files into your project's directory:
- all OVL files (files ending in .OVL)
Now, let's run the game.
- On the AGI Studio toolbar, click the icon that looks like a red, running stick figure.
- A dialog will pop up asking you to select your game's executable. Click OK.
- Select the file SIERRA.COM in the dialog box. Click OK.
- Now your game will run.
You'll only have to select the executable file the first time you run any game project. After that, clicking on the running man will run the game immediately.
What's up next
In the next chapter, we'll begin to create an AGI game called "DORK: An Interactive AGI Tutorial." Stay tuned for more AGI For Newbies, coming soon to a theater near you.