Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Ken Hoganson, Kennesaw State University Introduction to the Torque Game Development System.

Similar presentations


Presentation on theme: "Dr. Ken Hoganson, Kennesaw State University Introduction to the Torque Game Development System."— Presentation transcript:

1 Dr. Ken Hoganson, Kennesaw State University Introduction to the Torque Game Development System

2 Dr. Ken Hoganson, Kennesaw State University Elements of a 3-D game Game Engine Graphics, timing, input events, 3-D rendering, networking A basic processing engine (not unlike Gamemaker 7 and its steps) Many libraries Includes graphics libraries that do the math to create 3-D graphics and render objects and textures with lighting effects.

3 Dr. Ken Hoganson, Kennesaw State University Elements of a 3-D game: Scripts The programming language. Torque is like extended C++ (as is Gamemaker and other game script systems) Scripts are the programs and modules that make the game. Torque does not have the “drag and drop” easy interface that Gamemaker uses. Both more powerful, and at times harder to develop in than Gamemaker.

4 Dr. Ken Hoganson, Kennesaw State University Elements of a 3-D game: GUI 3D Models, lighting, shading Texture Music

5 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Flow Control The game-engine cycle (each game “step”) Dispatch Widows mouse movement events to the GUI Process other input events Calculate elapsed time based on the game time scale Manage time processing for server (game) objects Check for server packet transmission Advance game event time Process time for game objects Check for object network packet transmission Render the current frame (draw and paint the screen) Check for network time-outs

6 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Platform Layer Cross-platform (OS & processor) capability Design one game Generate executable for different platforms without revising the game. Windows Xwindows MacOS

7 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Console The compiler & interpreter Both compiler and interpreter Access to functions and libraries that are the building-blocks of Torque games Torque script language: very similar to C++

8 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Input Model Processing of user inputs (mouse, keyboard, joystick, etc) Like Gamemaker 7, inputs can trigger events Scripts and object interactions can also trigger events The “event” is not aware of how it was triggered: indepedence/flexibility. Gamemaker 7 also allows scripts to trigger events as if a key/mouse was pressed. Uses an “action-map” for processing inputs/activating the correct events If an input does not match with a game input, it is handed off to the OS GUI.

9 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Event Categories InputEvent (keyboard) MouseMoveEvent TimeEvent QuitEvent ConsoleEvent PacketReceive-Event ConnectedReceive-Event ConnectedAccept-Event ConnectedNotify-Event

10 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Simulation The internal model of the game Uses time events and steps Image on screen is a projection of the simulation model With platform layer, is platform independent Speed of game/processor/screen resolution used to determine screen refresh

11 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Resource Resource manager Files, bitmaps, shapes, textures, fonts, etc. Data structure/list management for add/delete/access

12 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Graphics Torque uses OpenGL graphics API ◦ Uses basic OpenGL model ◦ Uses OpenGL graphics routines with mods Torque includes extentions to OpenGL Creates Torque-specific powerful game primitives as building-blocks

13 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: 3-D Rendering Modular system Extendable Classes to define the “camera” orientation and field- of-view, define the viewport, Screen image is a projection of the game-simulation translated for 3-D effects Decisions to determine which objects to project, their orientation/shading-lighting etc. Computation intensive – but the programmer does not have to work or program the math for 3-D graphics

14 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Terrain Library functions To render sky, clouds, fog, terrain, water etc. Demo is impressive

15 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Interior Another set of library functions Buildings, caves etc. Lighting, textures Objects inside interiors

16 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Shape & Animation Another set of library functions Animation Rendering Animations are thread driven Not completely independent threads – but threads whose execution/transition is controlled by the Torque simulation engine

17 Dr. Ken Hoganson, Kennesaw State University Torque Game Engine: Networking Client/server model Multi-player – up to 128 clients per server Bandwidth management ◦ Updates objects only when necessary ◦ Changes are sent with minimal data: the bulk of the work is done on the client machine. Transmissions are like event triggers to the clients to update their displays

18 Dr. Ken Hoganson, Kennesaw State University Example Torque Script // ======================================================== // geometry.cs // This program adds calculates the distance around the perimiter of // a quadrilateral, as well as the area of the quadrilateral and outputs the // values. It recognizes whether the quadrilateral is a square or a rectangle // modifies its output accordingly. Program assumes that all angles in the // quadrilateral are equal. Demonstrates the if-else statement. // ========================================================= function calcAndPrint(%theWidth, %theHeight) // ------------------------------------------------------------------------ // This function does the shape analysis and prints the result. // PARAMETERS: %theWidth - horizontal dimension // %theHeight - vertical dimension // RETURNS: none // ------------------------------------------------------------------------

19 Dr. Ken Hoganson, Kennesaw State University Example Torque Script function calcAndPrint(%theWidth, %theHeight) { // calculate perimeter %perimeter = 2 * (%theWidth+%theHeight); // calculate area %area = %theWidth * %theHeight; // first, setup the dimension output string %prompt = "For a " @ %theWidth @ " by " @ %theHeight @ " quadrilateral, area and perimeter of "; // analyze the shape's dimensions and select different // descripters based on the shape's dimensions if (%theWidth == %theHeight) // if true, then it's a square %prompt = %prompt @ "square: "; else // otherwise it's a rectangle %prompt = %prompt @ "rectangle: "; // always output the analysis print (%prompt @ %area @ " " @ %perimeter); }

20 Dr. Ken Hoganson, Kennesaw State University Example Torque Script function main() { // ----------------------------------------------------------------- ------- // Entry point for the program. // ----------------------------------------------------------------- ------- // calculate and output the results for three // known dimension sets calcAndPrint(22, 26); // rectangle calcAndPrint(31, 31); // square calcAndPrint(47, 98); // rectangle }

21 Dr. Ken Hoganson, Kennesaw State University Torque on the Web http://www.garagegames.com/ Claim 25 major games published based on the Torque game engine Resources and etc. Garagegames has an intenational presence, exhibiting at the major game conferences and expos.

22 Copyright © 2008, 2009, Dr. Ken Hoganson End of Lecture End Of Today’s Lecture.

23 CS 8625. Dr. Ken Hoganson, Copyright © 2009 This slide intentionally left blank


Download ppt "Dr. Ken Hoganson, Kennesaw State University Introduction to the Torque Game Development System."

Similar presentations


Ads by Google