# What is the topology of a world with portals?

Portal is a video game, where you can create 2 disks $D\in\mathbb{R}^3$, which then are identified. The world is glued together at these points.

This kind of reminds me of some procedures to construct spaces for CW complex and whatnot in algebraic topology. I don't know if that kills properties like smoothness, but that doesn't really matter here.

My question:

What is the topology of a world with one or $n$ portals?

If you take topological $\mathbb{R}^3$ and two or even $2n$ therein seperated two-dimensional discs $D_1,D_2$ which you identify (say pairwise), what is the resulting topology?

The question was motivated by my own answer here.

-
It would probably be a quotient topology of some sort. –  Asaf Karagila Apr 28 '12 at 10:49
It was always a matter of time until this question appeared here on MSE. The Portal world, in terms of playability, is not quite $\Bbb R^3$ topologically; you can't fly (well...) or go through walls after all. I figure the best analogy here would be devising a "playspace" as an open subset of a topological space $X$, selecting two open subsets of $X$, intersecting each with the boundary of the playspace for the "portals," and then identifying the portals on the closure of the playspace. This is rather generic and I don't think amenable to a specific answer in the general case. –  anon Apr 28 '12 at 11:18
@anon: The game (with its not quite $\mathbb{R}^3$ world) is only the motivation for the question. I could formulate the question without any reference to Portal$^{\text{TM}}$: If you take topological $\mathbb{R}^3$ and two or even $2n$ therein seperated two-dimensional discs $D_1,D_2$ which you identify (say pairwise), what is the resulting topology? –  Nikolaj K. Apr 28 '12 at 11:36
You could, for intuition, think of this in dimension two, i.e. take the plane and glue intervals. At the very beginning you will see, that the topology (in a strict view) will depend on whether you glue open or closed intervals, but I'm pretty sure it won't affect the standard algebraic invariants. By the way, the standard glueing in topology is not the same as in those games I think: in the quotient space a point could choose whether to pass a portal or ignore it. –  Ben A. Apr 28 '12 at 15:11
Your description of portaling isn't quite correct; portals are attached to a 2D boundary in a 3D space, and each portal is one-sided. You might ask instead, for example, about a solid ball $B^3$ with $n$ pairs of discs on its boundary identified. –  Qiaochu Yuan Apr 28 '12 at 23:17

I will try to answer the question I think you should have asked instead. This should perhaps be a coment instead but it is too long.

Take the union of all the walls in a portal level. This is an orientable two-dimensional manifold $M$. The set of points the player can occupy is some connected component $C$ of the complement of the manifold in $\mathbb R^3$. Let $D$ be the complement of $C$. If we assume there are no "floating walls" in the level, then $M$ is a (connected) orientable compact surface without boundary. Due to the classification of closed surfaces, $M$ has a genus $g\geq 0$, so it is homeomorphic to a sphere with $g$ handles. Identifying two discs on $M$ is equivalent to adding another handle to the surface. You can picture it by just digging a tunnel inside $D$ between the two discs. It will look something like this:

I got the picture from this Wikipedia page, which has two more representations of the same surface.

Now, it remains to deal with the case of shooting one portal on a wall and another on a floating platform. In this case you can't dig a tunnel inside $D$ between the portals since $D$ is not connected. We could however embed $C\subseteq \mathbb R^3$ in $\mathbb R^4$, and dig a tunnel between the portals inside $\mathbb R^4-C$, but now we have a space embedded in $\mathbb R^4$, which of course more difficult to picture. Thus the general case of a portal level is the union of a finite number of spheres with handles, where portals connecting different wall components are realized by tunnels extending into a fourth dimension. I don't know if there's a simpler way to describe this.

-

This is a very incomplete answer. I feel the appropriate mathematical construction of portals should be slightly different from above.

1) The player moves around in an embedded compact connected $3$-manifold $M \subset \mathbb R^3$ which has as boundary a closed two manifold $N=\partial M$.

2) The Aperture Science Handheld Portal Device acts on $M$ by an operation similar to the connected sum operation acting only on the boundary. We obtain the new space $M'$ by taking a pair of disjoint (homeomorphic to) $2$-disks $D_1, D_2 \subset N$ (the portals) and gluing them via a homeomorphism $\phi: B_1\to B_2$ i.e. the quotient topology on $$M'=\frac{M}{\{x \sim \phi(x)\}_{x \in B_1}}$$

The character now moves in a 3-manifold $M'$ with closed boundary $$\partial M' = \frac{N-B^\circ_1-B^\circ_2}{\{x \sim \phi(x)\}_{x \in \partial B_1}}$$ The possibilities for the $3$-manifold are probably limited to the surface possibilities, but because the surface need not be connected it's classification is not so simple. I think you'd have to know how to use Thurston's geometrization conjecture (now Theorem? a la Perelman) to determine the classes of portal-gun obtainable manifolds.

Starting from $M$ you can add a handle, and definitely with $n$ portal guns and starting with the $3$-disk you can obtain the fill of the orientable surface genus $n$. You can also connect the components of the boundary with portals until $\partial M$ is connected, but you can't go the other direction and disconnect the boundary. Then the obtainable spaces depend a lot on the starting space.

I don't remember exactly the game mechanics but I think in game the blue/orange portal/antiportal forces $\phi$ to be orientation preserving. But I see no reason you couldn't program the game to allow orientation reversing portals where you can come out with left and right switched. In that case you would also have to include the nonorientable surfaces/3-manifolds. Complicated.

-