informa
2 min read
article

Feature: 'Games Demystified: Portal'

In this neat technical article, Jeremy Alessi deconstructs Valve's Portal -- including a demo and example source code -- to give a clear understanding of the phys
In this neat technical article, Jeremy Alessi deconstructs Valve's Portal -- including a demo and example source code -- to give a clear understanding of the physics principles behind the game's compellingly-executed teleportation mechanics. Though teleport mechanics in video games might seem like nothing new, Portal's deceptively simple implementation of simulated wormholes are still very much worth noting: "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." Before providing a code snippet written in Blitz3D to prototype the game's mechanics, Alessi describes how velocity and surface normals -- rays or unit vectors running perpendicular to a plane -- come into play with the simulated tunnel: "In order to break this down we will visit our old friend velocity, which is a vector. A vector is a magnitude coupled with a direction. Velocity is a vector whose magnitude is representative of speed. When the player collides with a portal we can extract the speed component of our velocity and redirect it to form a new velocity vector. ... When a portal is applied to a wall, floor, or ramp in the game, the surface normal of the surface is communicated to the portal inhabiting it. We then take the velocity we entered a portal with, and break it down into components. To do this we multiply by the surface normals of the exit portal. In the end, Portal uses the traditional teleportation mechanic with a velocity and orientation change." You can read the full technical feature on Portal's mechanics, which includes an associated demo and code sample along with a breakdown on how the code works (no registration required, please feel free to link to this feature from external websites).

Latest Jobs

Treyarch

Playa Vista, California
6.20.22
Audio Engineer

Digital Extremes

London, Ontario, Canada
6.20.22
Communications Director

High Moon Studios

Carlsbad, California
6.20.22
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
6.20.22
Lead UI Programmer
More Jobs   

CONNECT WITH US

Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter

@gamedevdotcom

Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Register
Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Subscribe
Follow us

@gamedevdotcom

Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more