Slashdot Mirror


Examining Portal's Teleportation Code

Gamasutra is running a story deconstructing the mechanics of Portal's teleportation programming. They present a snippet of Portal's code and a downloadable demo. They ran another article in this series earlier this year with an analysis Mario Galaxy's unique take on physics. We've discussed the development of Portal in the past. "Teleport mechanics in video games are nothing new. Puzzles from the original Gauntlet were memorable -- and more than likely, that wasn't the first game to use teleportation as a gameplay mechanic. The difference between Portal and all those that came before it is that Portal's teleportation acts as a frictionless tube between point A and point B. Physics are still hard at work inside the frictionless tube. Instead of simply repositioning an object from point A to point B, the player enters point A with full velocity and exits point B with the same speed, but moving in a new direction." Update: 8/26 at 19:37 by SS: Dan notes that the code was not directly from Portal; it was written to approximate Portal's physics.

6 of 278 comments (clear)

  1. Re:Portal by Impy+the+Impiuos+Imp · · Score: 5, Informative

    Duke Nukem 3D's teleporters would teleport your weapon shots, too.

    I loved shooting the rocket launcher into it only to hear a buddy die on the other side of the map as the rocket appeared and continued on its way.

    I don't recall if you jumped into the teleporter if you'd exit and continue your jump arc, but there is precident for "movement in progress" teleportation.

    --
    (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
  2. Portalized by TypoNAM · · Score: 2, Informative

    Somebody using Ogre3D has been working on a portal like project for nearly a year and has made pretty damn good progress for somebody who was new to game programming:
    http://www.ogre3d.org/phpBB2/viewtopic.php?t=37376

    He also has a blog which seems quite lacking though.

    --
    This space is not for rent.
  3. Re:My big question by pla · · Score: 2, Informative

    Just put one on top of another and but a steel ball so it keeps passing from one portal to another until it gets so hot to ignites the air.

    The portals don't actually increase the velocity of what passes through them, they just redirect it. So the trick of putting two portals vertically aligned basically simulates "falling" for a much greater distance.

    You would still (if in an atmosphere) reach terminal velocity rather quickly, however, so no vaporized metal (or human) explosions will happen.

  4. Re:My big question by Apache · · Score: 2, Informative

    Your velocity relative to the old portal's frame of reference becomes the velocity relative to the new portal's frame of reference.

    For example, if a person falls straight down into a portal on a platform moving 5 m/s, and the exit portal is on a stationary floor, the person will hurl upward out of the stationary portal with a horizontal component of 5 m/s. Which way the person goes depends on the orientations of the portals. Flip either the exit or entrance portal and you'll go the opposite direction.

    Sounds like a fantastic idea for portal 2. :D

  5. Original source by Anonymous Coward · · Score: 1, Informative

    I'm not a pheasant plucker
    I'm a pheasant plucker's son
    And I'm only plucking pheasants
    Till the pheasant plucker comes!

  6. Re:Damn! by Eli+Gottlieb · · Score: 2, Informative

    Try this. They claim it's 3.5 hours of game time, but the puzzles are *hard*, so it takes more like a day.