Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Examining Portal's Teleportation Code

Soulskill posted more than 5 years ago | from the wall-to-wall-coverage dept.

Games 278

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.

cancel ×

278 comments

Sorry! There are no comments related to the filter you selected.

Frictionless tube? (5, Funny)

Anonymous Coward | more than 5 years ago | (#24754693)

Your mom has a frictionless tube.

First post?

Re:Frictionless tube? (5, Funny)

Chris Burke (6130) | more than 5 years ago | (#24754753)

For friction to be present, the object being inserted into the tube must be large enough to touch the sides. That must be your problem.

Re:Frictionless tube? (4, Funny)

jollyreaper (513215) | more than 5 years ago | (#24754969)

For friction to be present, the object being inserted into the tube must be large enough to touch the sides. That must be your problem.

THAT'S WHAT SHE SAID! -er, shit. *self pwn*

Re:Frictionless tube? (1)

ndnspongebob (942859) | more than 5 years ago | (#24755555)

the problem was he accidentally played puddle and just got embarrassingly wet

Cake... (1)

AnomaliesAndrew (908394) | more than 5 years ago | (#24756003)

I wonder if that's where the cake got to...

Ahhh (-1, Troll)

Anonymous Coward | more than 5 years ago | (#24754739)

I got a great blow-job last weekend. It was like she was making out with my dick.

It was wonderful.

Re:Ahhh (-1, Offtopic)

Anonymous Coward | more than 5 years ago | (#24754809)

I got a great blow-job last weekend. It was like he was making out with my dick. /fixed that for you, dude

Re:Ahhh (-1, Troll)

Anonymous Coward | more than 5 years ago | (#24754957)

Why are you guys talking, I didn't say you could stop.

Re:Ahhh (-1, Troll)

Anonymous Coward | more than 5 years ago | (#24755429)

let's not all start sucking each others dicks just yet

Re:Ahhh (1, Funny)

MobileTatsu-NJG (946591) | more than 5 years ago | (#24755925)

I got a great blow-job last weekend. It was like she was making out with my dick.

It was wonderful.

And when you were done, did you type 'afk' and light a cigarette?

Portal (4, Funny)

CaptainPatent (1087643) | more than 5 years ago | (#24754751)

Regardless it's a lot better than quantum teleportation. [xkcd.com]

Re:Portal (5, Informative)

Impy the Impiuos Imp (442658) | more than 5 years ago | (#24754865)

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.

Re:Portal (4, Interesting)

pushing-robot (1037830) | more than 5 years ago | (#24755345)

That's not entirely correct, from a programming standpoint.

In most old games, "physics" were limited to jumping (and, occasionally, explosions knocking players around). Rather than try to simulate ballistic trajectories for every object in the game, rockets and other projectiles were simply moved forward a certain distance for every "tick" of game time.

So the transporter didn't preserve the rocket's momentum - it just put the rocket at a new location, and the game then resumed moving the rocket forward.

Re:Portal (0)

Anonymous Coward | more than 5 years ago | (#24755903)

Can anyone make a mod based on the books Eon, Eternity and Legacy (by Greg Bear) with all this information? I'd love to see The Way represented in a game... Watch out for the Jarts!

Re:Portal (4, Funny)

ElizabethGreene (1185405) | more than 5 years ago | (#24755323)

First thought: "Hey, if it can work within or near the event horizon of a black hole we could time travel!".

Second thought: "Wound this violate one of the laws of thermodynamics?"

Third thought: "I need a life."

Re:Portal (1)

ElizabethGreene (1185405) | more than 5 years ago | (#24755561)

Fourth thought: "s/wound/would/g"

Re:Portal (1)

lgw (121541) | more than 5 years ago | (#24755677)

Whether or not that would work is one of the more interesting questions in physics IMO. I think that Portal-style discontinuities "near" a black hole would not create any such weirdness, but sadly the math physisists used to model this stuff is so complex and abstract that the math simply can't model a discontinuity. It's amusing when someone claims it's impossible on the basis that it doesn't fit the model, though.

"Within" black hole ... that would be very weird indeed.

And don't worry, here on /. no one has a life.

But... (5, Funny)

i.r.id10t (595143) | more than 5 years ago | (#24754757)

But... can they telefrag?

I just love the sound of 2 bodies trying to occupy the same space at the same time in the morning... or afternoon... or evening...

Too verbose (5, Funny)

Anonymous Coward | more than 5 years ago | (#24754763)

>>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."

Should be "Speedy thing goes in; speedy thing comes out."

Re:Too verbose (5, Funny)

elrous0 (869638) | more than 5 years ago | (#24755565)

My ex-girlfriend used to use that exact phrase all the time.

No kidding (2, Insightful)

Moraelin (679338) | more than 5 years ago | (#24755841)

No kidding. The whole "frictionless tube" thing is just thinking too hard about it. Yes, instead of simply repositioning an object from point A to point B, you also take the normal of both holes and change the direction of the velocity. That's it. It solves the same problem and produces the exact same result without doing physics for a frictionless tube.

Ahoy, GlaDOS! (4, Funny)

Stanistani (808333) | more than 5 years ago | (#24754767)

I want to see the nautical version, Porthole.

Re:Ahoy, GlaDOS! (4, Funny)

Darth_brooks (180756) | more than 5 years ago | (#24754903)

I'm waiting on the hot grits version, Portman

Re:Ahoy, GlaDOS! (4, Funny)

Captain Splendid (673276) | more than 5 years ago | (#24755187)

I'm waiting on the drunken lawyer version, Port

-Rowley Birkin, QC

Re:Ahoy, GlaDOS! (5, Funny)

Anonymous Coward | more than 5 years ago | (#24755231)

The grits are a lie :(

Re:Ahoy, GlaDOS! (4, Funny)

Underfoot (1344699) | more than 5 years ago | (#24755057)

I want to see the white water version, Portage.

Re:Ahoy, GlaDOS! (0)

Anonymous Coward | more than 5 years ago | (#24755495)

attn: flamebait, I think that's the ricer cflags version where you have to compile each level just before playing.

It would have been more fun (1)

hcdejong (561314) | more than 5 years ago | (#24754819)

if they'd chosen the Discworld version of teleportation: two objects have to be teleported simultaneously in opposite directions, and the weight difference determines the exit speed of the lighter object.

Re:It would have been more fun (2, Funny)

Underfoot (1344699) | more than 5 years ago | (#24755137)

We need a Pratchett based online FPS! Dwarf Bread for weapons; you can play as a Gollum; Discworld based physics.

That would be super-sweet!

Re:It would have been more fun (1)

mike9989 (1237998) | more than 5 years ago | (#24755267)

Meh... Probably not. By the way it's a GOLEM not a Gollum. One is a human made construct the other is a human made construct... Wait... what?

Re:It would have been more fun (2, Funny)

Punko (784684) | more than 5 years ago | (#24755341)

Dwarves on Discworld don't fight golems. They fight trolls. This is why the internet needs more dwarves.

Re:It would have been more fun (-1, Troll)

Anonymous Coward | more than 5 years ago | (#24755803)

Dwarves on Discworld don't fight golems. They fight trolls.

This is why the internet needs more dwarves.

Dead Nigger Storage Inc is a successful business founded in 1994 by Toluca Lake, Los Angeles resident Jimmie Dimmick, after a misunderstanding with two acquaintances from the local underworld. In an interview made in 2004 with Pulp Magazine, Dimmick stated that the idea for his business originally came from his dealings with a mysterious "Mr Wolfe" several years previously.

Dead Nigger Storage Inc is publicly traded on the Nasdaq stock market under the symbol DEDNIG.

The business focuses on a simple service provision as the basis for their corporate offering, namely the creation of storage facilities specially built to store dead and/or decaying afro-americans. With offices in Alabama, Elko, Georgia, Louisiana, Dead Nigger Storage Inc now has more branches throughout the Confederate States of America than both KFC and Big Kahuna Burgers combined.

Originally run from Jimmie and Bonnie Dimmick's garage, the business' growth rate within the first few months of operating forced them into a rethink. In 1998, the Dimmicks purchased Monster Joe's Truck and Tow in Downtown Los Angeles, which has remained their base of operations to this day.

With the catchy friendly slogan of "Storing Dead Niggers is our business" Dead Nigger Storage Inc remains a market leader at the forefront of ethnic minority storage, despite the recent upsurge in the market for companies such as Jews on Ice and the Cracker Barrel.

Very recently, Dead Nigger Storage Inc has expanded into a chain with several branches outside of the United States. Though each branch outside the USA are largely similar to their American counterparts, most customers note a handful of "little differences". For example, in America one can store a decapitated Nigerian. In the Paris branch, however, one stores un Nigirié guillotin. In general, dead niggers are still called dead niggers, but over there they're called les dead niggers.

âoeYou know what they preserve dead niggers with in Holland instead of synthetic petroleum based chemical preservatives? Mayonnaise.â

        ~ Vincent Vega on storing Dead Niggers

Many individuals have struggled with the issue of dead nigger storage, including Jefferson Davis and John C. Calhoun who favoured the time-attested methodology of dry suspension, a technique that preserved by hanging them in carefully controlled environments for up to 21 days.

Other techniques utilised include smoking, often over specially constructed firepits or pyres. Although this often provides a more pleasurable flavour and aroma, it often led to a complete burning of the subject.

Pulverization is often utilised, either through the use of sticks, or in more extreme case through "dragging", a technique thought to include a pick-up truck. Another practice designed to aid tenderization is referred to as "curbstomping".

Dead Nigger Storage is subtly referenced in 14 separate Quentin Tarantino movies including Reservoir Dogs and the two Kill Bill films. The company also has numerous placements with Tarantino's latin lover Robert Rodriguez' movies, including The Adventures of Sharkboy and Lavagirl.

English Murder Mystery Writer Agatha Christie, referenced the company in perhaps her most famous work, Ten Dead Negroes made into the 1957 film The Only Good Injun is a Dead Injun. Perhaps her most famous reference remains the Hercule Poirot "quote" "Sacre bleu! C'est un dead negro, non?" in The Murder of Michael Donald.

One of the main accusations of racism aimed at George Lucas over his Star Wars franchise was his portrayal of certain species along stereotypical lines. Famously, in the scene when Jar Jar Binks is fatally wounded in the head whilst riding in the back seat of Mace Windu's landspeeder, a small sign can be seen in the background stating "Dead Gungan Storage".

Re:It would have been more fun (1)

geekoid (135745) | more than 5 years ago | (#24755223)

The weight difference AND the difference between there distances to the rim determin exit speed.

This is why you can use a multi-hundred pound canon to teleport a person and not have your brain go out your ears.

Re:It would have been more fun (4, Funny)

xouumalperxe (815707) | more than 5 years ago | (#24755525)

multi-hundred pound canon

Omnianism has loads of holy books, but I don't think even those collected amount to several hundred pounds.

bzflag? (1)

mikael (484) | more than 5 years ago | (#24754827)

You can do that with 'bzflag' portals. Take a jump through the portal or with the 'wings' flag. Then you appear at the other end like SG-1 stargate. Spins and backward movement work as well.

Re:bzflag? (2, Interesting)

Smidge204 (605297) | more than 5 years ago | (#24755025)

Yes no but not really. Vertical velocity is still vertical and horizontal velocity is still horizontal - just pointing in a different direction.

With Portal (and it's predecessor Narbacular Drop) you can enter a portal on the floor and pop out a portal on a wall - vertical speed seamlessly becomes horizontal speed. And that works at any combination of angles. Add to that collision detection mid-portal and you have something just a little more than what BZFlag offers.

Regarding the portals in Prey - I don't recall the portals being multi-directional but that game had a lot of funky physics in it so maybe I just don't remember. Also, the portals were all scripted in-place so they might have taken 'shortcuts' in the code to make them work.
=Smidge=

Re:bzflag? (0)

Anonymous Coward | more than 5 years ago | (#24755373)

You people realize that there is no up and down in a computer, don't you? It's all just vectors and matrices. If the programmer wants your character to fall to the "left" or stick to the "roof", she simply assigns a local force vector to your character.

Re:bzflag? (0)

Anonymous Coward | more than 5 years ago | (#24755715)

honestly anon, what do expect from a bunch of CS majors ;). Sure they got their discrete maths down, but when it comes to analysis and linear alg, they really don't stand a chance.

Prey (1)

AioKits (1235070) | more than 5 years ago | (#24754855)

Any thoughts on a nice little compare and contrast of the 'teleportation physics' between Prey and Portal?

M.C.Escher has good OLD examples of the concept: (3, Interesting)

Zymergy (803632) | more than 5 years ago | (#24754863)

These two were my favorites:
http://www.mcescher.net/images/relativity.jpg [mcescher.net] (1953)
and
http://www.mcescher.net/images/houseofstairs.jpg [mcescher.net] (1951)

Re:M.C.Escher has good OLD examples of the concept (1, Funny)

Anonymous Coward | more than 5 years ago | (#24754915)

Speaking of, whens he gonna put a new album out?

Re:M.C.Escher has good OLD examples of the concept (1)

isomeme (177414) | more than 5 years ago | (#24755509)

Re:M.C.Escher has good OLD examples of the concept (0)

Anonymous Coward | more than 5 years ago | (#24755639)

Ahhh, good ol' Momus. Does he ever change that eyepatch?

Re:M.C.Escher has good OLD examples of the concept (4, Funny)

Chris Burke (6130) | more than 5 years ago | (#24755689)

Speaking of, whens he gonna put a new album out?

Are you talking about M.C. Escher who designed the crazy staircase house? Or David Bowie, who lives there?

The code (2, Funny)

anomnomnomymous (1321267) | more than 5 years ago | (#24754885)

The code is a lie!


Ok, sorry...

Damn! (4, Insightful)

khendron (225184) | more than 5 years ago | (#24754901)

Reading that article makes me want to play Portal through again.

--sigh-- at least it won't take long.

Re:Damn! (1)

hansamurai (907719) | more than 5 years ago | (#24755145)

You can always play with commentary on if you haven't done that yet.

Re:Damn! (1)

fprintf (82740) | more than 5 years ago | (#24755507)

Played it with commentary on, tried (and have not succeeded yet) all the challenge maps, and then downloaded some additonal challenge maps from the 'Net. And yet, it still seemed like a game that was way too short.

I really loved this game, possibly better than anything else I have tried in years. So it was slightly disappointing that it only took me a few hours to get through it the first time, and subsequently takes less than an hour. (I am a slow player)

am i (1)

nimbius (983462) | more than 5 years ago | (#24754911)

the only person not absolutely obsessed with portal? video games use physics.

projectile force in rise of the triad? doom? every fragging quake? I liked this game better when it was called narbacular drop.

Re:am i (4, Insightful)

FiloEleven (602040) | more than 5 years ago | (#24755747)

When it was ugly, buggy, and short?

Narbuncular Drop was a great student project showing off a new idea, and I'm glad it's still available to play with. Neglecting the gameplay polish, puzzle depth, and environmental detail improvements that went into Portal is, IMO, a gross error in judgment.

You forgot to end with "get off my lawn" =)

Next step? (4, Funny)

Aranwe Haldaloke (789555) | more than 5 years ago | (#24754941)

Porting Portal's portal code?

Re:Next step? (5, Funny)

saboola (655522) | more than 5 years ago | (#24755247)

I'm not a portal porter
I'm a portal porter's son
And i'm only porting portal
Till the portal porter comes

WTF (5, Insightful)

4D6963 (933028) | more than 5 years ago | (#24754951)

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.

Are you fucking kidding? What's not completely obvious about this algorithm that should be Slashdot-front page worthy? I mean, it's fucking mind blowingly obvious, of course it keeps the velocity and translates it, how else could it do what it does? I can understand why it would be relevant to do a coding tutorial on the subject, but that's about as newsworthy as a Bresenham line drawing algorithm tutorial. TFS looks just like a "hey let's talk about how some super popular game is super awesome and post about it on a high traffic website".

Re:WTF (2, Insightful)

77Punker (673758) | more than 5 years ago | (#24755079)

The physics of the teleportation are pretty boring, but the fact that you can see through the portals and have an object go halfway through a portal are unusual.

I don't care enough about programming games to RTFA, but that could be something worth talking about. Chances are it's not what they're talking about, though.

Re:WTF (1)

Steauengeglase (512315) | more than 5 years ago | (#24755279)

I was wondering the same thing. Sadly, it really didn't go too far into that one, just the physics.

Re:WTF (1)

4D6963 (933028) | more than 5 years ago | (#24755483)

Yeah which is really the easiest and most obvious part. As the GP pointed out the algorithm for seeing through the portal must be less obvious/interesting, same for things standing in the portal, although I suspect there's no big challenge here, I'm ready to be that objects just go on either side of the portal without making any difference.

Re:WTF (1)

nine-times (778537) | more than 5 years ago | (#24755505)

the fact that you can see through the portals and have an object go halfway through a portal are unusual.

There's also some potential that's not really unlocked in Portal itself. For example, seeing through the portal could allow you to shoot through it (Portal only allows you to drop things through portals). The game it's based on (Narbacular Drop [wikipedia.org] ) even allowed you to place portals (imagine being able to shoot the portal gun through the portal) while looking through the portals, which made for some interesting strategy.

So it is an interesting case of teleportation. I'm not entirely sure it even makes sense to call it teleportation, though. The effect is not that objects themselves are being transported through any special means, but instead space is twisted around.

Re:WTF (1)

rpj1288 (698823) | more than 5 years ago | (#24755119)

GlasDOS said how it worked in the game for crying out loud! "Speedy thing goes in, speedy thing comes out."

Re:WTF (5, Funny)

kestasjk (933987) | more than 5 years ago | (#24755129)

It didn't answer the main question for me: How does the code which accelerates players downwards work?

It must be using some kind of vector mathematics for mapping acceleration onto velocity, and velocity onto position, but I'll be damned if I can figure out how they expressed that in an algorithm.

Re:WTF (1)

Millennium (2451) | more than 5 years ago | (#24755161)

Um... aren't you referring to gravity here?

Re:WTF (1)

Goaway (82658) | more than 5 years ago | (#24755285)

Uh... That's game programming 101.

velocity_z += gravity * delta_t;
position_x += velocity_x * delta_t;
position_y += velocity_y * delta_t;
position_z += velocity_z * delta_t;

Then again, with the rest of the article being absolutely elementary bullshit, maybe it is a wonder they didn't cover that, too.

Re:WTF (2, Insightful)

4D6963 (933028) | more than 5 years ago | (#24755513)

Haha nice one, I didn't think about that ;-). Don't pay attention to the other posters, Slashdot is crowded with people insensitive to even the most blatant sarcasm.

Re:WTF (1)

geekoid (135745) | more than 5 years ago | (#24755191)

I lied it, and I like seeing how they did it differently. If comparing how different people implement game teleportation isn't nerdy, then nothing is.
I mean, you could treat it like a tube, or you could just save the movement information and reimplement it when using a spawn technique of teleportation.

The fact that you aren't clever enough to see all the variations is hardly Slashdots fault.

Re:WTF (1)

4D6963 (933028) | more than 5 years ago | (#24755635)

What the hell are you drivelling about? It is obvious that the only straightforward and sensible way to do this is to do a line-full circle collision detection between your position (a point) between this frame and the previous frame (a line) and the portal (a flat full circle, well, oval), and that when the line and the circle cross you just translate positions and velocity according to a fairly simple function that relies on the 3D angle between both portals. And wtf is "a spawn technique of teleportation" if not a fancy (although near nonsensical) way to refer to something obvious to sound like you're in the know?

Re:WTF (1)

Coward Anonymous (110649) | more than 5 years ago | (#24755211)

Don't you be denigrating Bresenham's line drawing algorithm. Truly a work of algorithmic beauty.

Re:WTF (1)

4D6963 (933028) | more than 5 years ago | (#24755673)

Oh I know, I use it, and I'm not denigrating it. Just saying, if Gamasutra wrote a tutorial about it, I wouldn't want to see that on the front page of Slashdot, no matter how elegant and efficient this algorithm is.

Re:WTF (1)

Goaway (82658) | more than 5 years ago | (#24755265)

Well, the Super Mario Galaxies was total bullshit too, so that does seem to be their modus operandi. Take a popular game, bullshit something that sounds plausible to someone who's not experienced with game programming, and get linked on social media sites.

Re:WTF (1)

BigJClark (1226554) | more than 5 years ago | (#24755283)


Although I appreciate Gamasutra for its laymen-type articles, in reality the portal code is quite simple. Simple matrix-multiplication kids. Take the rate of entry into portal A(incoming), apply this by the normal of portal B(outgoing), then multiply the new vector to the matrix describing the actor (in this case, the player). Don't forget the gravity vector!
Not terribly difficult, as with the WII Mario gravity. Although, I can really appreciate the creativity.

Re:WTF (0)

Anonymous Coward | more than 5 years ago | (#24755337)

The Mona Lisa is just a portrait of a woman. It's special because it was done well. Any painter can see that it was done with the same kinds of brushes and paints as other paintings of its day but very few will ever aspire to birth such a creation. It's really easy to sit back and scoff at the simplicity of a brush stroke or an algorithm but the time wasted doing so would be much better spent putting your money where your mouth is.

Re:WTF (2, Insightful)

4D6963 (933028) | more than 5 years ago | (#24755731)

You're pretty much missing the point, or at least your comparison is quite flawed. The Mona Lisa isn't obvious, not anyone who wanted to a woman's portrait came up with the Mona Lisa. And neither is Portal as a whole. But the algorithm behind the teleportation in Portal is flat out obvious. Like, really, anyone can come up with it when they're thinking of teleportation. The idea behind the game is what's admirable and ingenuous, not the little necessary and obvious algorithm.

Re:WTF (1)

ABoerma (941672) | more than 5 years ago | (#24755381)

Physics major nitpick: It doesn't keep the velocity, it keeps the speed.

Re:WTF (0)

Anonymous Coward | more than 5 years ago | (#24755527)

Angry poster is angry.

Re:WTF (1)

4D6963 (933028) | more than 5 years ago | (#24755869)

Angry poster is angry.

Anonymous Coward is anonymous.

slashdot version (1)

extirpater (132500) | more than 5 years ago | (#24754985)

According to portal theory in some place, this comment is the first!

My big question (4, Interesting)

Zerth (26112) | more than 5 years ago | (#24755085)

If you could put a portal on a fast falling object, when it lands on you while you are standing still would you have momentum at the other of the portal or would you just poke through since the portal has the initial momentum? (IE nonplayer movement being different than player movement)

What would that say about your reference frame? Could you use that to distinguish which of two objects had "universal frame" movement? That'd be kinda neat, theoretically, but it'd be way more interesting to be able to put a portal on a crate hanging from a crane, then make the crate fall while standing under it to catapult yourself from a low position.

Re:My big question (1)

geekoid (135745) | more than 5 years ago | (#24755163)

You could use to portals to create a geekoid friction bomb.

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.

Re:My big question (1)

ikkonoishi (674762) | more than 5 years ago | (#24755347)

Ah but the air would also be falling through at the same speed. If you put a portal on the ceiling and floor of a closed room then soon the small difference in air pressure from the top of the room to the bottom would create a howling vortex.

Re:My big question (2, Informative)

pla (258480) | more than 5 years ago | (#24755755)

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.

Re:My big question (1)

director_mr (1144369) | more than 5 years ago | (#24755215)

I think you just helped Valve come up with some concepts for Portal2. That would add a bunch of fun to the game.

Re:My big question (1)

Erbo (384) | more than 5 years ago | (#24755295)

Well, in Portal, if an object that has an open portal on it moves, the portal disappears, and the "other end" of the portal is blocked. Hence tricky puzzles like the one in Test Chamber 18 to reach the storage cube. That one was a cast-iron bitch to figure out the first time. (Not going to give it away for the six people who've never played Portal...)

Re:My big question (1)

Zerth (26112) | more than 5 years ago | (#24755807)

Well, those were part of the "test". They (or the mechanics of the portal) were coded to dispel on movement. If that weren't the case, I'm curious how portal velocity would affect player velocity.

They already used the "portal keeps you from being slowly squished" trick, I'd like to see it with faster SMB-Thwomp style traps.

you are doing it wrong (0)

Anonymous Coward | more than 5 years ago | (#24755103)

the comments go in the code

Portalized (2, Informative)

TypoNAM (695420) | more than 5 years ago | (#24755147)

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 [ogre3d.org]

He also has a blog [portalized.org] which seems quite lacking though.

Physics? (1)

sanosuke001 (640243) | more than 5 years ago | (#24755157)

I don't know... without RTFAing this seems to be a pretty straightforward problem.

If you wish to "teleport" an object, find the objects vector, find the difference from the portal's normal, move said object to front of connecting portal, dot the difference vector you got from before with the new portal's normal, keep velocity/acceleration constant.

Now, there's more to be done with making it look like the player is actually travelling through the portal. But, the movement itself seems quite simple...

Re:Physics? (1)

sanosuke001 (640243) | more than 5 years ago | (#24755179)

Note: you would have to reorient the initial offset from the first portal's normal to match the orientation of the second portal's normal. Oh, and normalize all vectors.

The big question you are all missing is: (0)

Anonymous Coward | more than 5 years ago | (#24755173)

Could we use these highly advanced computer programs for these portal tubes on the tubes that power the internet?

blitz3d & coding... while we are here (1)

erbbysam (964606) | more than 5 years ago | (#24755217)

this isn't even coded correctly in blitz3d...
When you align the portals they flicker because blitz3d cannot handle 3d objects right on top of each other. The easiest fix for this is to move the portals .001 "blitz3d distances" away from the wall.

... my copy of blitz3d is lost but there definitly right about using it to create quick 3d stuff

Portal Physics 101 (5, Interesting)

xPsi (851544) | more than 5 years ago | (#24755235)

In the game, GlaDOS says "momentum is conserved through the portal." Assuming our physical system is the character, momentum definitely is not conserved. Neither is energy. The description "the player enters point A with full velocity and exits point B with the same speed, but moving in a new direction" is exactly correct: a textbook example of momentum non-conservation. However, what drives the exciting "flinging" effect, which makes Portal's teleportation so unique, isn't just momentum redirection. It's that you instantly obtain the potential energy of your exit location. This new potential energy can be converted back into kinetic energy, increasing your speed...mix in a little momentum redirection at the portals then wash, rinse, repeat. Although GlaDOS describes the game physics incorrectly, there is a game walkthrough where the programmers do describe it correctly. If you take any physics courses from me, you can expect to see some Portal questions on future quizzes :) Nice article overall.

Re:Portal Physics 101 (1)

Tacvek (948259) | more than 5 years ago | (#24755611)

TO be fair, the magnitude of momentum is the same. Most regular people consider velocity to the the magnitude of the physics velocity vector, and momentum as the magnitude of the physics momentum vector.

The potential energy change is not very unique though, as games do not care about potential energies. Only current kinetic energy is ever important. Thus any sort of portals in a game where the that have different 'z' values would have that attribute.

What is really unique about Portal is the portal visuals.

Re:Portal Physics 101 (3, Interesting)

rk (6314) | more than 5 years ago | (#24755795)

I never really thought about that before, but you're right. The portal gun is also a perpetual motion engine. Put a portal above a paddle wheel, and a portal below the paddle wheel. Add enough water to get the paddle going, and poof. Power until enough water evaporates that it can't turn the wheel anymore.

So.... (0, Redundant)

jeffy210 (214759) | more than 5 years ago | (#24755249)

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.

In other words, speedy thing goes in, speedy things comes out?

Pussy Nazi Sez (-1, Troll)

Anonymous Coward | more than 5 years ago | (#24755433)

No pussy for YOU!

The physics is actually fake. (3, Interesting)

Animats (122034) | more than 5 years ago | (#24755471)

There's a fair amount of fake physics involved. Properly, the parts of the character on one side of the portal should have the gravity and momentum of that inertial frame, and as the character passes through the portal, the new frame should begin to act on the character. But the sample code in Gamasutra treat the character as a single rigid body.

It's a neat problem to make the physics correct as the character moves though a portal. It could certainly be done, even for ragdoll characters. From a gameplay perspective, it would drive players nuts. To make the gameplay tolerable, the designers of this game added a pseudo-force that tends to align the character with the local vertical. Otherwise, characters would have execute proper parachute landing falls when moving through a gravity vector change.

Character physics almost has to be fake. Trying to drive a real car via a game pad is very difficult, and trying to drive a human body via a game pad is worse.

Re:The physics is actually fake. (1)

brkello (642429) | more than 5 years ago | (#24755853)

Hate to burst your bubble...but video game characters have no mass...so ALL physics in the game would have to be fake ;)

They omitted what Portal actually does. (3, Interesting)

Sockatume (732728) | more than 5 years ago | (#24755599)

Portal exploits portal rendering [wikipedia.org] technology - a technique for graphics optimisation which incidentally allows you to take a given map layout and provide a different subjective layout for the player. It's actually a fairly trivial problem to do the portals themselves, as most graphics engines these days should have portalling built in. All of the interesting physics comes in when they start making it work as gameplay, for example by giving portal entrances "push" or "pull" to steer players into and out of them. The article is a good description of how to make a game that behaves a bit like Portal, but it's got nothing to do with that game's actual physics.

Havok... (1)

Enki X (1315689) | more than 5 years ago | (#24755667)

Halo 3's teleporters do this...I had loads of fun in forge making portals to cliff edges in front of 'human propulsifiers'

the cake is a lie (0)

Anonymous Coward | more than 5 years ago | (#24755839)

the cake is a lie

Pacman (1)

BattleHawk (773905) | more than 5 years ago | (#24755885)

"that wasn't the first game to use teleportation as a gameplay mechanic...the player enters point A with full velocity and exits point B with the same speed, but moving in a new direction"

Sounds like they re-invented (ms)Pacman(jr)

Grossly Oversimplified (5, Insightful)

p0tat03 (985078) | more than 5 years ago | (#24755909)

Portal's physics go *way* beyond what the article implies.

Article basically says: it's not a simple teleport, direction of movement and momentum are preserved.

This is far too much of an oversimplification. Portal was probably a technically difficult game to code for - mostly due to collision physics. The problem is that something does not instantly teleport from one end of the portal to another. You can have an object on BOTH sides of the portal. This makes physics calculations very difficult, since you essentially have a single object of a small finite size, colliding with different objects across the room, affected differently by gravity, etc.

If I get the right gist from the developer commentary in the game, their solution was the CLONE the two sides of the portal in a mini physics-only environment and run the simulation there.

Definitely much more complex than the article.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>