Marc ten Bosch created an extradimensional game engine for 4D Toys

July 14, 2017
protect
Game Developer logo in a gray background | Game Developer

Marc ten Bosch has been working on 4D puzzle-platformer Miegakure (Hide and Reveal) for eight years now. Over that time, many have dared to describe how the game works after playing around with early builds, but it’s tricky to do well without an accompanying visual demonstration.

The issue is one of translation: the game’s four-dimensional world operates differently to the 3D world we understand and see with our eyes. It’s difficult enough to comprehend upon seeing it in action yourself - describing it to others with words just doesn’t cut it.

But ten Bosch has now done us all a huge favor by creating 4D Toys, currently available to buy for iOS and PC. It’s an “interactive toy” that allows us all to explore the types of four-dimensional spaces that Miegakure’s puzzle gardens inhabit.

Rather than a world with puzzles to solve, 4D Toys offers individually enclosed stages which, at first, house a single 4D shape to mess around with. You’re invited to throw the shape around, rotate it, see how it not only travels between the three dimensions we know (x, y, and z), but also the fourth (w).

As the artwork that accompanies 4D Toys suggests, the play experience evokes a toddler experimenting with putting 3D objects through different shaped holes, figuring out which ones match and which don’t. You are, essentially, learning the rules of a new world and how they interact.

With Miegakure unavailable to play at present, 4D Toys serves as something to point interested players towards, it helping to alleviate the heavy lifting that words previously had to do. But 4D Toys isn’t really intended as a gateway towards understanding the otherworldly dimensions of ten Bosch’s larger project.

In fact, a lot of the 4D physics that drives 4D Toys won’t even feature in Miegakure. “Some of it might be there for decoration, but it won’t affect gameplay in any major way,” ten Bosch says. So what is 4D Toys, then? Well, it actually started off as a joke.

<iframe title="Embedded content" src="https://giphy.com/embed/3og0IMnpq4Dw50UCu4" height="273px" width="100%" data-testid="iframe" loading="lazy" scrolling="auto"></iframe>


Abacus from 4D Toys

A game engine with an extra dimension

"Near the beginning of Miegakure's development, someone joked I should make a 4D physics engine. Then a few years ago I had gathered enough knowledge that it was a possibility. So I made one for fun, and kept working on it on the side."

“Near the beginning of Miegakure's development, someone joked I should make a 4D physics engine,” writes ten Bosch on the 4D Toys website. “Then a few years ago I had gathered enough knowledge that it was a possibility. So I made one for fun, and kept working on it on the side.”

Please note that ten Bosch says he created a 4D physics engine “for fun.” That particular detail is very telling of his character. Bear that in mind while trying to make sense of what a 4D physics engine is and how it works. In explaining it, ten Bosch starts by outlining that the purpose of a 3D physics engine is to simulate how objects collide, bounce, and roll around similarly to how they do in reality. 

“A physics engine works by storing the position/orientation and velocity/angular velocity of each object,” ten Bosch says. “Forces (such as gravity) and collisions change the velocities of the objects, and the positions evolve according to these velocities.”

The point is that 3D physics engines work the way they do because we write rules for them that reflect our 3D understanding of the world. There is no gravity in a 3D physics engine, but it can simulate the effect with the right line of code, which is a generalization of one of the physical laws that govern our universe. Ten Bosch merely expands on this by taking the same generalized laws and adding a fourth spatial dimension to them. He literally started out with a 3D physics engine and increased the number dimensions of the basic components by one.

“Basically this means the positions of each object uses four numbers instead of three,” he explains. “Forces such as gravity apply to all 4D space because they are defined as vectors of four numbers instead of three. The way we store orientation and angular velocity needs to change as well. Objects have a 3D surface instead of a 2D surface, etc…”

Mindbending mathematics

"I took a branch of mathematics called Geometric Algebra, which is very adapted to working independently of dimension but often isn't used that way."

While ten Bosch goes through the process of creating a 4D physics engine as if it were simple, to pull it off he had to invent the mathematics that make it work. This meant ensuring the numbers add up so that forces are four-dimensional vectors and objects rotate around planes rather than axes.

“I took a branch of mathematics called Geometric Algebra, which is very adapted to working independently of dimension but often isn't used that way for historic reasons, and applied it to the case of simulating rigid bodies that spin and bounce in n-dimensions (I defined the math for any number of dimensions but only implemented the 4D case),” he says. “For example I needed a way to compute how any specific nD object spins when you push on it along a specific direction in nD, as well as how it reacts to friction in nD, how objects collide in nD, etc…”

If all this is going over your head, don’t fret, as the whole point of 4D Toys is to help us engage with the mathematics behind it through a less intimidating interface. You don’t really need to know how it works unless you’re planning on building your own 4D physics engine. And even if you are then you might want to hold your horses, as ten Bosch might release his own one day: “I might do that a few years down the road,” he says. “It's difficult to give something to other people to use because it needs to handle many more cases than I personally need.”

<iframe title="Embedded content" src="https://giphy.com/embed/3og0ITXwiH1eFi5mQU" height="273px" width="100%" data-testid="iframe" loading="lazy" scrolling="auto"></iframe>


Ballpit from 4D Toys

Visualizing 4D space on a 2D screen

Tags:

No tags.

JikGuard.com, a high-tech security service provider focusing on game protection and anti-cheat, is committed to helping game companies solve the problem of cheats and hacks, and providing deeply integrated encryption protection solutions for games.

Read More>>