CS 269/369: TGB Tutorial 1

TGB Tutorial 1


In the Documentation folder of the TGB directory in your Applications folder is an html file. It is the top-level file for a series of tutorials on how to use TGB.

TGB is an interface that lets you build 2D games. The system is built around the following concepts.

Project: the project is your whole game. It consists of a set of directories that contain art, scripts, and level files. These are what you will be creating to build your game. All of the visual elements of the game will be images of some kind, the action of the game is defined by the scripts, and the overall layout is managed by the level files.

All of the code for your project is in a set of directories underneath where your main project file is located. Also in the project directory is a script file called main.cs. That script file is the top level file for the project, and is executed when the project begins. All of your scripts will be located in the game subdirectory, mostly within the gameScripts and behaviors subdirectories within that. All of your images will be in the data subdirectory and folders inside there. Organization of your files is important, so take a look at how things are organized and follow the scheme.

Scene: the scene (also called a level) is a single coherent experience in the game. Levels can be very large or just a single screen. Generally, all of the persistent or significant elements in a level are instantiated up front into the level file. The TGB interface supports creating, placing, and manipulating elements. It also handles reading and writing the level files. Note that you can edit the level files manually, as they are simply text files containing TorqueScript.

Objects: objects are pretty much every separate element in a level. Almost all objects in TGB will have an associated image that defines their visual appearance. You can then attach all sorts of other capabilities to the objects, write scripts for the objects, and manipulate them in TGB.

Resources: TGB comes with an existing set of resources for the tutorials, and just to help you get started. There is a lot of art available that makes it easy to try out game concepts without having to design new images. You can insert or remove resources from your game using the Resources command in the Project menu.

Particle Systems: Most interesting effects in TGB are particle systems. A particle system is basically a set of rules for controlling the creation, movement, and deletion of one or more images. By modifying the rules you can create many different effects such as exhaust, explosions, fire, rain, or snow. They are, by far, the most usual tool for creating interesting visual effects.

Run through the first couple of tutorials to explore how to use the various elements of TGB. Note that, on the macs in the Olin lab, you will need to copy the projects with which you want to work onto either your network drive or your own workspace before you can work with them.