Torque Resource - Ken Finney’s book 3D Game Programming All-in-One

September 5th, 2006

Torque Tutorials and Game Development Book - 3D Game Programming All In One by Kenneth C. Finney

The Torque Game Engine is a very complex. I purchased it about a year ago this September and feel I am still swimming in the shallow end of Lake Newbian. GarageGames.com has a forum with a lot of people chiming in and discussing a dizzying array of topics. Most of the time, I rarely make heads or tails of what they’re talking about. I just continue to wade in the shallow end. One of the things that obfuscates me mind is a point of reference from which these folks are using. As there are several versions of the Torque Game Engine and with that different versions of the starter files, again, I rarely know what context their examples or code/scripts are referring to.

I find not having a point of reference contributes to confusion and wasted time, especially with tutorials. I know I’ve written some tutorials that had no point of reference that six months later I had no clue what I was trying to say. Pfft! Imagine the reader…doh!

I Finally Get the Point
I got a hold of Ken Finney’s book 3D Game Programming All-in-One (Torque) and it was excellent. For months, I had been scouring and surfing the Web and basically leeching off other people for info about how to do this or how to do that. This book gives you a point of reference and context to work from and the instructions are detailed to the degree that you can create a game with the information being presented. It was good to finally get my own copy.

With My New Found Knowledge - I Wrote My First GG Tutorial
Simple Player Selection
Above: My first official tutorial for my fellow Torque developers posted at GarageGames.com.

As of today, I am still in the first few chapters as I learn about datablocks and basic functions, but I can see myself really understanding how Torque script works as I leverage my previous programming experience. For example, I was able to figure out how to select a player before going into a game. Using the info from Ken’s book and a number of GarageGames.com resources to work from, I wrote Simple Player Selection Torque Tutorial. It’s gotten some good reviews from my fellow Torquers. Writing the tutorial itself was a learning experience. It forced me to slow down and really understand what it was I was trying to do. Therein is a good way to learn. Write a tutorial. Writing a tutorial is good as it helps to document a technique that you may need later on. I know for me, I will typically forget what I’ve made a few months into the year, unless I refer to it frequently. A tutorial helps to remember. Sorta like commenting your code, but much more helpful and informative.

Well, it’s 5:00 am and I have to start my day job in a few hours.

Happy Torquing :)

Torque Tutorials - Getting Rid of the Orcs

August 12th, 2006

Sometimes those Orcs can be really tiresome. So what do you do? Well replace with them with your own character. Maybe a fork (orc -> fork, get it? ha. ha. ha.) or something else. Remember you too can change!

You too can change!

Assuming you already have a character that has been converted to a .dts file, one way of modding the Starter FPS Kit with the GarageGames Torque Game engine is by going to .cs files and also providing your own .dts player file within the scripts.

The two files you want to concern yourself with are both named player.cs. However while they are same named, they are different and are located in different dirctories. Here are their respective locations. One is in:
starter.fps/server/scripts/player.cs and the other one is located in starter.fps/data/shapes/player/player.cs.

Let’s look at starter.fps/data/shapes/player/player.cs. I use TextPad and it allows me to see the line numbers. So in my case, on or about line 10 is the part of this file that I need to change. What needs to change is the location of the new player.dts file. In this example you see that I’ve experimented with a few others. One of them was from a book I picked up by Ken Finney (more on that later) and the other one is a sample character from Obsidian Games (we won’t be using Thom today). Here’s what it looks like:

//starter.fps\data\shapes\player\player.cs

//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

datablock TSShapeConstructor(PlayerDts)
{
//baseShape = “./playerThom/player.dts”;
baseShape = “./playerEmaga/player.dts”;
//baseShape = “./player.dts”;

sequence0 = “./player_root.dsq root”;
sequence1 = “./player_forward.dsq run”;
sequence2 = “./player_back.dsq back”;
sequence3 = “./player_side.dsq side”;
sequence4 = “./player_lookde.dsq look”;
sequence5 = “./player_head.dsq head”;
sequence6 = “./player_fall.dsq fall”;
sequence7 = “./player_land.dsq land”;
sequence8 = “./player_jump.dsq jump”;
sequence9 = “./player_diehead.dsq death1″;
sequence10 = “./player_diechest.dsq death2″;
sequence11 = “./player_dieback.dsq death3″;
sequence12 = “./player_diesidelf.dsq death4″;
sequence13 = “./player_diesidert.dsq death5″;
sequence14 = “./player_dieleglf.dsq death6″;
sequence15 = “./player_dielegrt.dsq death7″;
sequence16 = “./player_dieslump.dsq death8″;
sequence17 = “./player_dieknees.dsq death9″;
sequence18 = “./player_dieforward.dsq death10″;
sequence19 = “./player_diespin.dsq death11″;
sequence20 = “./player_looksn.dsq looksn”;
sequence21 = “./player_lookms.dsq lookms”;
sequence22 = “./player_scoutroot.dsq scoutroot”;
sequence23 = “./player_headside.dsq headside”;
sequence24 = “./player_recoilde.dsq light_recoil”;
sequence25 = “./player_sitting.dsq sitting”;
sequence26 = “./player_celsalute.dsq celsalute”;
sequence27 = “./player_celwave.dsq celwave”;
sequence28 = “./player_standjump.dsq standjump”;
sequence29 = “./player_looknw.dsq looknw”;
};

The parts we need to concern ourselves at this time is in bold. That my friends says that use the base shape that is found in the directory named playerEmaga and in it you will find the player.dts file. Ofcourse, make sure you have the player.dts file in the directory. So make sure you make a directory named playerEmaga with the player.dts file and textures accomanying it. Otherwise it will not work. So that’s a step there.

The other player.cs file located at starter.fps/server/scripts/player.cs needs the following adjustment:

....

datablock PlayerData(PlayerBody)
{
renderFirstPerson = false;
emap = true;

className = Armor;
//shapeFile = "~/data/shapes/player/player.dts";
//shapeFile = "~/data/shapes/player/playerThom.dts";
shapeFile = “~/data/shapes/player/playerEmaga/player.dts”;
cameraMaxDist = 3;
computeCRC = true;

canObserve = true;
cmdCategory = “Clients”;

cameraDefaultFov = 90.0;
cameraMinFov = 5.0;
cameraMaxFov = 120.0;

debrisShapeName = “~/data/shapes/player/debris_player.dts”;
debris = playerDebris;

aiAvoidThis = true;

minLookAngle = -1.4;
maxLookAngle = 1.4;
maxFreelookAngle = 3.0;

….

I’ve just snipped a part of the player.cs file because it is a very very long file. In this case we’ve snipped the PlayerData datablock. In bold is what you need to make sure you change. You will also notice I did some other test just above it. They’ve been commented out so those statements will be ignored.

So once you’ve done those changes in both player.cs files and have also created the playerEmaga directory containing the new player.dts, you should see your new player appear.

See, no more Orcs!

The next thing I want to do is be able to add different players and player types. That’s gonna be a pain because I really don’t know where to start with that one. Help?

FPS Game Tourney at the Meetup

August 4th, 2006

The Brampton Web Design Meetup FPS Tourney

I am a Web designer and programmer and in my near zilch spare time lately, I like to try out some amateur gaming and game development. Just a few days ago a few of my Meetup friends decided to try out a little FPS.

More About Meetup
I operate my business in Brampton and currently do work with companies in and around the GTA. A few months ago the Brampton Web Design Meetup was started up. It’s a very simple board that can help people with similar interests to sign up on-line then eventually meetup in person. It’s actually a great concept. I know the Toronto Graphic Design Meetup was one of the first ones I joined and it would have anywhere from 20 to 30 graphic designers meeting up on a monthly basis. It is great for inspiration and commisertion :)

Anyway, I decided to post my little FPS test game that I put together using the startup files from the GarageGames.com. I know the game was a pretty big hit last year with some of my friends from the How Design Forum and ones I met via the GarageGames.com forums. My initial post didn’t garner as much interest as I had thought it would. Mind you, I didn’t have a lot of members. Last week changed. I got a few people playing and boy was it fun :) A few of the Web designers and mixed bagged technologist from my M
eetup signed up and we played a few rounds of FPS.

So for those possible interested, please check out the download and tourney info from The Brampton Web Design Meetup page.

I hope to see you there sometime!