13.Mar.07 Lecture 7
Interiors continued, More complex uv mapping, Blender, programatic movement

Motivate

56 Days Left

We are going to start moving towards working more and more on your own projects. If you have specific topics you would like me to discuss, please send me a request.

Finish Quark Lecture

Render modes

Using a debug version of Torque you can see a lot of extra information about your interiors. (Remember, you will have to compile a debug version of Torque). It should be as simple as bringing up the Torque project in Visual studio and rebuilding in debug mode.

Type: setInteriorRenderMode(#);

in the console using the following mode numbers:

setInteriorRendererMode(0); Normal
setInteriorRendererMode(1); Wireframe
setInteriorRendererMode(2); Detail brushes red, others white
setInteriorRendererMode(3); Ambiguious planes displayed in red.
setInteriorRendererMode(4); Show orphaned polys (blue)
setInteriorRendererMode(5); Show lightmaps to see where shadows fall.
setInteriorRendererMode(6); No lighting, textures only.
setInteriorRendererMode(7); Portal zones (very nice to see if portals are actually working)
setInteriorRendererMode(8); Show ambient (affected by lighting) surfaces.
setInteriorRendererMode(9); Show collision surfaces (shown by red tick marks)
setInteriorRendererMode(10); Triangle strips (to show all triangles that were created in compile process)
setInteriorRendererMode(11); Show null surfaces (will be shown in red).

 

Tunnels and Dungeons

If you want something that tunnels into a map area, you will have to do a little work upfront and create the tunnel first before creating the rest of the underground area.

You will have to create a null space on your map. A good example of this would be the starter.fps sample with the Lighting System Feature Demo.

Go into edit mode and delete the interior. You will see a hole in the map. To create a hole on your own map, in the terriain editor, choose brush size 1x1 and hard brush. Selection Action/Set Empty. Now any squares you click with be set to a hole in the map. You'll have to use a lot of trial and error to get a tunnel interior into this space, but once you have that set you can move ahead and place the rest of the dungeon. Remember, you should probably have a portal at the enterance to your interior.

Null surface texturing for performance improvement

One of the performance improvements you can make is to give surfaces that are not seen (external/internal) a NULL texture. Torque can ignore these surfaces and improve performance.

UV Unwrapping more complex models

Collision areas and models

Createing a collision area is actually quite easy. Simply create an object you would like the avatar to collide with and name it collision-1, collision-2 etc. You should 'hide' the object from the scene so it is not drawn in Torque. Otherwise, it's just a matter of creating the collision area and naming it properly, Torque handles the rest.

Animated collision areas are another matter. I spent numerous hours trying to animate a collision area with the default Torque unsuccessfully. It will require source code changes so I have placed it out of scope for a game I would like to do this semester.

Blender

I want to quickly go through my Blender notes.

Programatic shape movement

Many times it will be best to animate an object by translating or rotating it programatically rather than through the model animations. The way you do this is change the objects transformation matrix slowly (or quickly) over a period of time. You would setup a timer function to change the location or rotation each time the event fires.

Let's look at a move that will popup a target that is lying flat on the ground.

Remember, this is the basic Torque transformation matrix.

“ PosX PosY PoxZ RotX RotY RotZ theta “

You can get this with.

%sceneObject.getTransform();

You can get individual elements out of this with.

%pos_x = getWords(%obj.getTransform(), 0, 0);
%pos_y = getWords(%obj.getTransform(), 1, 1);
%pos_z = getWords(%obj.getTransform(), 2, 2);
%rot_x = getWords(%obj.getTransform(), 3, 3);
%rot_y = getWords(%obj.getTransform(), 4, 4);
%rot_z = getWords(%obj.getTransform(), 5, 5);
%rot_theta = getWords(%obj.getTransform(), 6, 6);

If you want to get the rotation axis as a vector

%rot_axis = getWords(%obj.getTransform(), 3, 5);

Using this, we can save the transform on the first rotate, then change the rotation amount each time the timer fires.

Here is the Popup Target we created in class. It's very raw, but good enough to build something off of.

CPSC240 - Games Development
Chapman University
Instructor: W. Wood Harter
(c) copyright 2006-2007 - W. Wood Harter - All Rights Reserved
Screen shots on banner (c) copyright their resprective owners