Portal Gun - Like Teleportation

Started by
4 comments, last by Thokas 12 years, 8 months ago
Hey guys! I'm working a voxel exploration game. I'm pretty far along with it, and I decided that I need to have my own portal gun inspired weapon. I'm a novice engine programmer. This is my first step outside of excel VBA development. Point is, handle me with gloves and if you have any examples I would greatly appreciate it.

Most I have so far is camera setting and a way to display the viewport on a decal. What I don't know where to begin is how to make the game teleport objects the way Portal does. I love how seamless it is and I think something similar would work well with the game I am creating. How would you guys suggest I go about making my own version of a Portal like teleportation experience.

I'm using C# and XNA 4.0 if that give you and idea of the environment I am in.
Advertisement
The basic mechanism is very simple: you use a flat shape (rectangular is easiest) that acts as the "portal." When an object collides with the portal, you teleport it into the "exit" portal, and do some simple local-coordinate-space transforms to make sure that things like the momentum behavior carries over.

Where things get messy is with full physics, and if you want to allow things to be partially in one portal and out the other. If you opt for the simplest approach, you can still get really good-looking results with a decent amount of effort. If you want the whole package deal, though, be prepared to invest a lot of work.

I'd be happy to elaborate on the processes involved if you're interested in going the extra mile :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


The basic mechanism is very simple: you use a flat shape (rectangular is easiest) that acts as the "portal." When an object collides with the portal, you teleport it into the "exit" portal, and do some simple local-coordinate-space transforms to make sure that things like the momentum behavior carries over.

Where things get messy is with full physics, and if you want to allow things to be partially in one portal and out the other. If you opt for the simplest approach, you can still get really good-looking results with a decent amount of effort. If you want the whole package deal, though, be prepared to invest a lot of work.

I'd be happy to elaborate on the processes involved if you're interested in going the extra mile :-)


Greetings! Thanks for the reply.

I had given thought to a simple teleport approach. It could work with what I want to achieve. I'd like to have anything that does move to be able pass through the portals. However, I am absolutely in love with Portal's implementation of the portal experience. Presentation is everything, the seamless approach is what I want. I just can't wrap my mind around how to actually get it done. If you could elaborate on the methods involved I'd greatly appreciate it.

I just can't wrap my mind around how to actually get it done


have you tried the "Developer Commentary" ?
i cant remember most of the stuff from it, but if i remember correctly, they used a physics approxomation on the cube.
maybe used two, one on either side.
very interesting how they solve some of the stuff.

Never say Never, Because Never comes too soon. - ryan20fun

Disclaimer: Each post of mine is intended as an attempt of helping and/or bringing some meaningfull insight to the topic at hand. Due to my nature, my good intentions will not always be plainly visible. I apologise in advance and assure you I mean no harm and do not intend to insult anyone.

One of the things I remember from a Valve article is, when going trough a portal pair, an object can collide with itself. In gameplay terms. I wonder what does that even means when it comes to low-level. Clearly, no physics API I know supports portal natively and likely never will.

Previously "Krohm"


[quote name='Thokas' timestamp='1313934785' post='4851893']
I just can't wrap my mind around how to actually get it done


have you tried the "Developer Commentary" ?
i cant remember most of the stuff from it, but if i remember correctly, they used a physics approxomation on the cube.
maybe used two, one on either side.
very interesting how they solve some of the stuff.
[/quote]

Great tip!

They talk about it a few times in this clip


They mentioned creating a bubble around portal locations to handle physics calculations. To shorten time it would take to process object interactions. They also mention that said physics was separate from the standard source engine. Are was much simpler to help processing times.

I haven't actually started adding any objects that require physics interactions yet. Most I have is player jumping. It's all new to me so I'm taking it one step at a time. So designing said bubble might be a bit of a hurdle for me.

This topic is closed to new replies.

Advertisement