# This Man Is Using Math To Create An Impossible 4D Video Game

Images courtesy of the artist

Starting with the basics, the first dimension is length. The second is length and width. The third is length, width and height, and the fourth dimension is—something, right? As inhabitants of the latter, third-dimensional realm, humans are intrinsically unable to imagine what a four dimensional world might look like. We can fathom time being the most-plausible dimension outside of the one in which we exist, but, as we can't see "time," the ability to fathom a fourth dimensional world is restricted. But for San Francisco-based game designer Marc ten Bosch, these physics aren't stopping him from trying anyway.

Bosch is in the process of designing a puzzle game called Miegakure. The game acts as a mathematically accurate facsimile of a 4D world, employing the hidden dimension as a tool for advancing through a series of puzzles. The puzzles further the story, and each can be solved in multiple ways, some of which Bosch admits he may not have even thought of yet.

In the world of Miegakure, it’s important to realize that the fourth dimension isn’t time, as we understand it, but an extrapolation of the relationship between the second and third dimensions. Bosch compares his game to the 1884 novella Flatland by Edwin A. Abbott, which depicts an insane interaction between a 2D square and a 3D sphere. Check out this animated version of Flatland by Ladd Ehlinger, Jr. to see what we mean:

In the likely event that you don't have two hours to kill, skip to about 52 minutes in to see the square escape the 2D realm and immerse his flat eyes in the 3D world.

The game itself has been in development for a while, and has earned attention from forward-thinking Internet folk, such as Jonathon Blow, the creator of breakout indie game Braid, and Randall Monroe, the creator of popular thinking-person's webcomic, xkcd.

We got the opportunity to ask Bosch about this years-in-the-making project, and what it’s like to design a inconceivable video game in an impossible dimension:

The Creators Project:  What does the title of the game, Miegakure, mean?

Marc ten Bosch: Miegakure means “Hide & Reveal” in Japanese. It is a traditional Japanese garden technique where as you take a stroll through it you can never see the entire garden at once or elements will be half hidden by trees or bushes, making it so you have to imagine what you can’t see. It is intended to stimulate your imagination so that as you complete the picture in your mind, the entire garden feels larger than it actually is.

When did you first think of the idea for a 4D video game?

I had the idea for a hyper-dimensional game in college, maybe around 2005? When you program a 3D game, every object’s position is represented using three numbers (usually called x, y and z), but that concept easily generalizes. Why not four numbers or more? At the time, a big tech company’s programming interview question involved computing whether two 2D rectangles overlap. It turns out the code for this generalizes extremely easily to the 3D case of cubes and to any number of dimensions: you just have to change a single number, the dimension of the space. So the idea came from this as a joke almost, like “I could answer your programming question for any number of dimensions.” But it made me start to wonder, what would it an actual n-dimensional game be like?

The idea stayed in the back of my mind until around 2008, when I decided I wanted to make a game that would satisfy both my love of game design and tech, in particular computer graphics. I made a list of my most experimental game ideas, and a 4D game came at the top of the list, so I started to build some prototypes. The first few prototypes were not very good however, and I later realized the main reason was that even though the game was taking place in a 4D world it was not clear to me what the consequences of being able to move in 4D were. What could you do that you couldn’t do in 3D? It would not be very interesting to build a game where you just spend your time running around and shooting things, even if it was 4D... In order to understand a concept you need to interact with it in a meaningful way, to push on it and have it pull back, not just have it part of the background.

What are some of the prime influences for your conception about how Miegakure should be?

So I got a little bit stuck until I did some research and came upon lots of literature dedicated to the subject of n-dimensional space, including an 1884 novella called Flatland. It’s about a 2D square that gets visited by a mysterious 3D being, a sphere. As the sphere passes though the square’s 2D plane it looks like a circle that expands then contracts. Even though the 3D object is just moving, its 2D slice changes and so it looks to be deforming from the perspective of a 2D character. A similar thing would happen in higher dimensions: if we were visited by a 4D sphere, as it passes our “3D plane” it would look like a 3D sphere that expands then contracts. This is just a consequence of the mathematics used to describe n-dimensional space.

It turns out people have been thinking about what you could do if you could move in 4D for more than a century! For example, you could bind two rings without breaking them, steal things from closed containers, make objects levitate, etc… So it became clear that the game should be about all these “miracles.” I mean, games are basically about letting you do things that you could not do in real life, so it works out well.  The plot of the game is you discover that, as opposed to everyone you know, you have mastered the ability to move in 4D. What will you do with this ability? Use it to help people or for your own benefit? And what hidden worlds lie far along the fourth dimension? It turns out the fourth dimension is basically a mathematical formulation of parallel universes: think of how a 3D world can be built from many 2D worlds or “slices” stacked on top of each other along the third dimension,  and similarly a 4D world can be built from many 3D worlds stacked on top of each other along the fourth dimension.

We’ve talked about the ideas influencing your conception of four dimensionality, but what kinds of games have influenced Miegakure’s design?

My favorite game is probably Ikaruga. Ikaruga is such an elegant game, with tons of layers of gameplay. I love how a simple change to typical shmup rules creates a deep game filled with interesting consequences. There are two colors of projectiles to avoid, and you only need to avoid one color, and you can switch which color that is at any time, instantly. So at any time you are invincible against half the bullets on the screen, actively trying to absorb as many bullets of one type while avoiding the other; but in an instant, at the press of a button, the bullets you were trying to avoid, you are now trying to absorb. This rapid switch, were your brain must adapt, is fascinating. Why is it so hard to adjust? After all, the players themselves are pressing the button to flip polarity. Can we build more games that explore and push different physiological limits of our brains?

In Miegakure you can be facing either of two orientations, and that was definitely inspired by Ikaruga.

How long have you been building the game?

I have been working on the game since 2009. I am working with a 3D artist and a couple of musicians. We will be done “when the game is done,” but we expect that to be around next year, as we are done with the difficult technical challenges of displaying a detailed 4D world for the first time ever, in real-time, and making the game easy to pick up for people who have never thought about a fourth dimension of space before.

Tell me about the programming tech behind the puzzles.

The game runs on its own custom 4D engine that I developed from scratch. Every position in the game is *actually* represented with four numbers. There are no tricks or hacks. We are building what a 4D world would be like, in many ways. This creates a space were puzzles happen naturally: they are just simple consequences of 4D space.  More traditional puzzle games very carefully set up situations, and the behavior is limited to what the designer has intended (for example you need to input the right code to open the door, and the code is written down somewhere hidden). Because what we are building is so general, I might not know all the solutions to a particular puzzle… or I might discover a lot of puzzles by just setting up random situations and playing and seeing what happens. If something surprising and interesting happens, I will make it into its own puzzle.

How have your previous projects, like the Entropy prototype and PrometheusZ affected the development of Miegakure?

My previous projects have taught me how to prototype games, and to look for the most interesting gameplay possible. It’s much easier to build something that people are excited about if it is obviously original. The concept of extra dimensions of space is so fundamental that it automatically makes people curious. Miegakure was nominated or won every competition I sent it to (even with very early builds of the game), and everybody I show it to is extremely impressed with it, so I think it will do well. But even so I did want to spend the time to make it the best game it could be. That always involves lots of playtesting to make sure the concepts are properly introduced. We also spent a long time improving the correctness of the representation of the fourth dimension, in a similar way to how 3D games improve the correctness of the representation of the real world. The great thing about that is that it consequently made the game better looking and also play better, because it gives more information about what is going on.

What drives you to undertake so gargantuan a task as building a game based on a completely unheard of physics engine that you built from scratch? This is an incredible amount of work that we’re talking about. What keeps you going?

Personally, I do not simply want to make fun games, I want to make games that change the world, and I want to demonstrate that games have the power to change the world. What will happen to the world once kids grow up with an instinctive understanding of higher-dimensional spaces because they grew up playing Miegakure? I am anxious to see. I am hoping people will at least become smarter if they are surrounded with interesting games that challenge the way they see the world. This could be explorations of the definition of space itself, social and economic systems, etc…

Now that we have built this engine, I could see a few different games made using it. We are actually working on a small side-project that involves exploring a different aspect of the fourth dimension. An important problem, however, is that large 4D spaces require a lot more data to fill than 3D spaces (just think about how much more work it is to build a 3D game as opposed to a 2D game).  We are solving this problem by keeping the environments small and focused! This helps gameplay as well. I would love to see a true 4D First Person Game, but if the environment is going to be large, it’s going to be a real challenge to build.

Ok, so the game is modeled in four dimensions, but is still represented on a two dimensional screen. Could you see yourself writing a virtual reality version, like for Oculus Rift, that creates a more real illusion of three and four dimensionality?

What I would love is not just seeing 4D objects in an Oculus Rift, but the ability to get haptic feedback and be able to touch and squeeze 4D objects. This game is about manipulating 4D objects, and how that allows you to understand 4D better. I know for me before I started working on the game, and probably for most people, the fourth dimension was this abstract concept, with shapes “floating” on the screen and not really existing. Letting you actually touch them is what makes this game successful I think, and taking that to the extreme with haptic feedback would be awesome.

What are the philosophical implications of a 4D world, and how does Miegakure deal with them?

What I find extremely fascinating is that we created the concept of a dimension in order to explain our universe, but the concept is not bound by it, it generalizes independently of whether or not the actual universe is 3D or 4D or more. Does a fourth dimension of space actually exist in the universe we live in? I would argue that the fact that it exists mathematically and that we can now represent it and interact with it using a computer makes it very real, in a strange way. So this game is an expedition into unknown frontiers of our universe, but not in the way that we have thought of previously, such as going to Mars or discovering new continents or elementary particles.

The way that the game builds a 4D universe which can be used to answer questions about the fourth dimension is reminiscent of thought experiments famously performed by Einstein. What if the universe worked like this? What would be the consequences? However, we can now use the computer to help answer these questions instead of having to imagine every detail.