Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010
description
Transcript of Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010
![Page 1: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/1.jpg)
Teleporters in 3D Games
by
Dr. Edwin F. ArmstrongCGDC, July 15, 2010
http://tinyRealm.com/~efa/papers/
![Page 2: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/2.jpg)
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?
![Page 3: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/3.jpg)
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
![Page 4: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/4.jpg)
The Classic Star Trek Teleporter
Works for both one-way or by-directional
![Page 5: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/5.jpg)
The Classic Star Gate Teleporter
Works for both one-way or by-directional
![Page 6: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/6.jpg)
The Classic Halo-like Teleporter
Works for both one-way or by-directional
![Page 7: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/7.jpg)
The simple Portal Teleporter
Works best as a one-way destination point.
![Page 8: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/8.jpg)
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
![Page 9: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/9.jpg)
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
![Page 10: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/10.jpg)
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
![Page 11: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/11.jpg)
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.
![Page 12: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/12.jpg)
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
![Page 13: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/13.jpg)
// 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
![Page 14: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/14.jpg)
//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);
![Page 15: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/15.jpg)
//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
![Page 16: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/16.jpg)
function MultiTeleportTrigger:: function onLeaveTrigger(%data, %obj, %colObj)
{
%client = %colObj.client;
cancel($teleSched);
%client.player.setCloaked(false);//player visible
$currMultiTeleTrigger = ""; //reset to null
}
![Page 17: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/17.jpg)
// do the teleport
function goScotty(%client, %target)
{
// beam me up!
commandToServer('TeleportPlayer', %client, %target);
}
![Page 18: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/18.jpg)
// 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; }
![Page 19: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/19.jpg)
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...
![Page 20: Teleporters in 3D Games by Dr. Edwin F. Armstrong CGDC, July 15, 2010](https://reader035.fdocuments.in/reader035/viewer/2022062808/5681529f550346895dc0c4da/html5/thumbnails/20.jpg)
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