Torque 3D Game Development Cookbook is Now Available

I am proud to announce that my Torque 3D Game Development Cookbook has recently been published.

2013-01-30-BookCoversLarge

In the Spring of 2012, I was contacted by Packt Publishing to write a cookbook-style book on Torque 3D. For those that don’t know, a technical cookbook is very similar to a food cookbook. It is full of recipes of specific tasks or problem solutions, some short and some long.

When I started writing the book, the MIT licensed version of Torque 3D was only a concept, and the retail version of T3D 1.2 was all that was available. Therefore, the book is based on using Torque 3D from a TorqueScript and built-in editor perspective. It really is amazing how much can be done in Torque 3D without needing to touch the source code.

Since then Torque 3D has gone open source and we saw the release of v2.0 in December 2012. Through the magic of really fast book printing, I was able to make sure my book was updated for the 2.0 open source release, making this the most current Torque 3D book to date.

Note: One recipe in Chapter 2 makes use of the FPS Example template that is currently only available in the retail release of Torque 3D 1.2. However, the concepts in that recipe will easily carry over to all other projects, which has to do with placing decals.

 

Table of Contents

Here is the complete recipe list for the book:

Chapter 1: TorqueScript: The Only Script You Need to Know
Accessing delimited fields within a string
Iterating on words in a string list
Retrieving components of a variable using accessors
Iterating on objects in a SimSet or SimGroup collection
Getting a random object from a SimSet or SimGroup collection
Finding an object in a SimSet or SimGroup collection using its internal name
Executing a method on a SimSet or SimGroup collection
Creating a new SimObject instance
Creating a new internal name only SimObject instance
Creating a new Datablock object
Creating a new singleton
Extending a SimObject instance using the class property
Using a variable to access methods or properties of a SimObject instance
Using call() to call a variable method on a SimObject instance with arguments
Using call() to call a variable function with arguments
Using script arrays as dictionaries
Using ArrayObject and custom script sorting callbacks
Scheduling SimObject methods
Scheduling functions
Activating and deactivating a package

Chapter 2: Working with Your Editors
Setting up fogging of the level
How to cover seams and texture changes using decals placed in the World Editor
Copying the transform of an object to another in the World Editor window
How to change the material of an object in the World Editor
Setting up a glow mask using the Material Editor window
Using a convex shape as a zone
Setting zone-specific ambient lighting
Grouping adjacent zones together

Chapter 3: Graphical User Interface
Creating a password text edit box
Using pushDialog() and popDialog() and setting up the UI file to work with them
Displaying metrics (such as FPS) from the console
Displaying a list of all game objects
Displaying a level at the main menu
Dragging and dropping between two windows

Chapter 4: Camera and Mouse Controls
Locking and hiding the mouse while the right mouse button is down
Clicking on an object in the scene (client-side)
Clicking on an object in the scene (server-side)
Picking up an item in the scene while the mouse is locked and hidden
Changing the camera’s view and control mode
Giving the camera smooth movement
Having the camera follow a path

Chapter 5: Your Graphics Evolved
Using the built-in video recording
Changing the material of a ShapeBase object using script
Building a custom material
Building a custom material using advanced lighting
Building a postFX

Chapter 6: Make That Sound Happen
Playing a quick 2D or 3D sound on all clients
Using SFXEmitter to create networked sound effects
Playing a sound on a ShapeBase object
Playing music while a level is loading
How to have a background sound for a level
How to have music change according to the mood
Triggering an event during sound playback

Chapter 7: Game Objects
Playing an animation sequence on a TSStatic class
Playing an animation sequence on a ShapeBase class
How to make it rain using a Precipitation object
Using the Lightning object to automatically create a thunderstorm
Using the TimeOfDay object to generate events

Chapter 8: Multiplayer Servers
How to start a dedicated server
What ports are needed to be open or forwarded for a multiplayer server
Passing arbitrary parameters from the client to the server
How to become an admin on a server
Kicking and banning people from the server
Stopping a server from restarting when the last player leaves
Accessing the server connection from the client
How to access all client connections from the server
Broadcasting a message to all clients and having it displayed in the center of the screen

Chapter 9: Importance of Networking
Sending a network event from the client to the server
Sending a network event from the server to the client
Connecting as a TCP client
Setting up a TCP server
Connecting as an HTTP client
Using an RSS feed for game news, message of the day, or other client messages
How to activate, deactivate, and use Telnet for console access

Chapter 10: Miscellaneous Gameplay Features
How to have a sprinting player use up energy
Enabling and disabling air control
How to jump jet
Adjusting the fire spread of a weapon
Changing the number of shots fired from a weapon
Making a weapon use energy rather than ammo
Finding objects in range
Using the message producer/consumer system

For most of these recipes I’ve gone into great detail about the topic. For example, in Chapter 5: Your Graphics Evolved I provide a list of all available texture samplers and constants when making your own custom materials. This information is only currently available by going through the source code. The same is true for the postFX recipe, as postFX have a different set of available texture samplers and constants.

 

Sample Chapter

Packt Publishing has a history of providing a sample chapter from each of their books. Chapter 6: Make That Sound Happen was chosen as the sample chapter you may all download and read right now. You can find it by clicking on the Sample Chapters tab on the Packt Publishing page for the book. This sample chapter is in black and white, while the eBook version of Torque 3D Game Development Cookbook has all images in color.

2013-01-30-SampleChapter

Where to Buy the Book

Here are some direct links for purchasing Torque 3D Game Development Cookbook:
Packt Publishing eBook and physical copies
Amazon.com physical copy
Amazon.com Kindle edition
Amazon.ca physical copy
Barnes & Noble physical copy

Thanks for reading!

- Dave