Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010

Post on 23-Jan-2016

13 views 0 download

Tags:

description

Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010 http://tinyRealm.com/~efa/papers/. What is a Teleporter?. - PowerPoint PPT Presentation

Transcript of Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010

Teleporters in 3D Games

by

Dr. Edwin F. ArmstrongCGDC, July 15, 2010

http://tinyRealm.com/~efa/papers/

Teleportation is the transfer of matter or energy from one point to another, at speeds faster than the speed of light. Currently, scientists have successfully transported only the quantum information (see quantum teleportation) of atoms and photons, but over distances of at least 600 metres (1,969 ft).[EWD2004]

In 3D game play it is used to move players around the Game. Inside a specific area or connecting other areas or even multiply games together.

What is a Teleporter?

Teleporters have been in many games and movies and we should maintain a good deal of realism to maintain the Emerson quality of the gaming experience.

In most game play Teleporters have two functions: 1. Teleport a person in a by-directional manor –

there and back again. 2. Teleport a person in a one-way manor – only one

way.

Game Teleporters should seem real

The Classic Star Trek Teleporter

Works for both one-way or by-directional

The Classic Star Gate Teleporter

Works for both one-way or by-directional

The Classic Halo-like Teleporter

Works for both one-way or by-directional

The simple Portal Teleporter

Works best as a one-way destination point.

A person disappears at one point and reappears at another.

A person disappears slowly or instantly. There is usually a sound effect during one or both

parts of the process. The forward speed of the person is sometimes

maintained – they exit at the speed at which they entered the Teleporter's beam or portal.

Observer's view of Teleport process

Slowly or quickly cause the person to disappear. Play our enter sound effect – it takes time to play. Stop their forward motion – it really doesn't make

sense to keep their speed, unless they are going through a Star-gate or Worm-whole. Even then the physics is questionable.

Move them to their new destination. Reorient their direction to new-gate's exit direction. Play our exit sound effect – it takes time to play,

might be the same as the enter sound effect.

Internal Teleport process part#1

Slowly or quickly cause the person to reappear. Gently push them out of the Teleporter. This is

especially important with some gates that might want to send them back. I believe the StarGate operates, so that, the mater stream works only in one direction until the gate is re-dialled. Most game Teleporters at activated by just being present and gently pushing them out the exit gate, in the correct direction. It solves a possible Teleport looping problem.

Internal Teleport process part#2

Most of the work in Torque is done in scripting files. We start our efforts by first calling the “scriptExec.cs” file, located in /game/scripts/server/scripts/

The code is shown below:

// Implement Teleporters

exec("./customParticles.cs");

exec("./multiTeleportTrigger.cs");

Creating a Multi-Teleport function using the Torque game engine.

function MultiTeleportTrigger:: onEnterTrigger(%data, %obj, %colObj)

{

if($numTeleports == 0)

{

// Count the number of TeleportTrigger's

// we have in the current map.

$numTeleports = getMultiTriggerCount("TeleportTrigger");

}

Inside multiTeleportTrigger.cs

// Make sure player recently beamed in, otherwise

// he could loop back and forth.

if(%checkname !$= $currMultiTeleTrigger)

{

%target = %obj.dest;

//*** Mod to cause destination trigger (y-axis)

// to act as exit-direction pointer (efa) 2/28/10 ***

%client.player.setVelocity("0 0 0"); //stop player velocity

%pos = getWords(%target.getTransform(), 0, 2);

//get player's position

//get current rotation

%rot = getWords(%target.getTransform(), 3, 6);

//might try %rot = (rot + 180.0 ) mod 360

// This would remove the requirement to

//rotate the trigger to get a proper exit direction

//reset player position and rotation

%client.player.setTransform(%pos SPC %rot);

//schedule teleportation event

$teleSched = schedule(30,0,"goScotty",%client,%target);//changed from 2000 (efa) 3/31/07

//play the sound effect

$teleSound = serverPlay3D(TeleportBuzz,%client.player.getTransform());

//make them invisable

%client.player.setCloaked(true);

// save the target - until the teleported client // leaves it, then reset. Allows for next teleport

$currMultiTeleTrigger = %target;

}//end onEnterTrigger

function MultiTeleportTrigger:: function onLeaveTrigger(%data, %obj, %colObj)

{

%client = %colObj.client;

cancel($teleSched);

%client.player.setCloaked(false);//player visible

$currMultiTeleTrigger = ""; //reset to null

}

// do the teleport

function goScotty(%client, %target)

{

// beam me up!

commandToServer('TeleportPlayer', %client, %target);

}

// find the number of teleport triggers by name

function getMultiTriggerCount(%name)

{

%dataGroup = "MissionGroup";

%triggerCount = 0;

for(%i = 0; %i < %dataGroup.getCount(); %i++)

{

%obj = %dataGroup.getObject(%i);

if(%obj.getClassName() !$= "Trigger")

{

// no trigger!

Continue; }

Realism in game play

You always hear about how people want more realism in game play, but this is only true to a point.

People want only as much realism in a game as is required for them to feel immersed and engaged.

The Teleporters can work anyway that seems right to the player. Don't get hung up on what has been done before.

Put a Teleporter at the bottom of a hole or make it so you must jump up to a low ceiling to Teleport. If it makes sense for your game then do it...

Thank you

I had fun putting together this talk. Can I answer any questions?

Or does anyone have any comments – really, I'd like to know your thoughts.

All the source code, slides and implementation instructions are available at:

http://tinyrealm.com/~efa/papers/ http://tinyrealm.com/~efa/cisc4347