Author Archive

4D Rotations and the 4D equivalent of Quaternions

Friday, May 20th, 2011

In a game, we often want to represent rotations: the main character’s head tilts left and right, the wheels of a vehicle rotate, characters follow curved paths through space.

There are many ways to represent a rotation mathematically, and each might have different benefits when we actually transform that math into code. Quaternions are one such way, and they are often favored because they are easy to interpolate; this means that given two rotations, we can easily transform one into the other in a smooth way without running into any issues.

Rotating Cube

For example, if the main character’s face is pointing down and to the right and his head is tilted sideways, it is possible to bring him back to facing straight ahead smoothly, using only the two quaternions corresponding to each orientation of the head.

This is why Quaternions are used in pretty much any 3D game engine out there.

You need four numbers to represent a quaternion. That might feel arbitrary, but it turns out that it’s related to the number of “different” 2D planes that can exist in 3D space.

It’s important to realize that rotations happen on 2D planes. In 3D, we usually think of rotations happening around an axis, like a wheel turning around its axle, but instead of thinking about the axle, we should think about the plane that the wheel lies on, perpendicular to the axle. Allow this old lady to demonstrate:

Old Lady shows off rotations

She is spinning wheel in the XZ plane, perpendicular to the Y axis. In addition, this is more like the 2D case where there is only one plane to rotate in. Considering rotations to happen around a third axis (perpendicular to the 2D plane) is technically incorrect, since we shouldn’t need to introduce another dimension to perform rotations.

In any case, this is what the code for a quaternion class might look like:

Quaternion Source code

You can see that, aside from the scalar part, there are three numbers (x,y, and z), one per axis, or more properly one per plane perpendicular to each axis.

That’s all well and good, but we’re making a 4D game.

And we need to rotate things. So what about 4D rotations? It turns out there is a mathematical entity called a Rotor which can represent a rotation in any number of dimensions. As long as we think of rotations as happening on 2D planes instead of around 1D axes, everything works out fine. We just need to count the “different” 2D planes that can exist in 4D space. There are 6.

This is what the class definition for a 4D Rotor looks like:

Rotor Source code

New Work In Progress Screenshot

Saturday, April 2nd, 2011

GDC Build Screenshot

I figured I should post a screenshot of what the game has been looking like lately. Please note these are not the final graphics. There are a lot of things in this screenshot that we’re going to change, but it gives you an idea. This was printed on a postcard for GDC.

Mailing List Options

Wednesday, January 5th, 2011

A quick note for those on the mailing list: If you only want to be notified of Miegakure’s release date and nothing else, I just added a new category on the blog.

You need to register here and after logging in, only check the “I only care about when Miegakure is released” box, and uncheck everything else.. Sorry about the 2 step process and the spam.

You can also unsubscribe on the mailing list page

Technical Excellence

Tuesday, January 4th, 2011

IGF

Miegakure is finalist at the Independent Games Festival 2011 in the “Technical Excellence” category. Combine this with last year’s nomination in the “Excellence in Design” Category, and I think that’s enough awards for now.

Here’s what the jury had to say:

Jurists also praised Marc ten Bosch’s fourth-dimension exploring puzzler Miegakure for using game mechanics to “provide a space for the exploration of a technically complex and fascinating concept,” and generally serving “as a demonstration of why games are unique among other technical mediums, able to illuminate ideas through interaction in a way that nothing else can.”

While I’m on the subject of awards, I never wrote a blog post about the award the game received at Indiecade this past October in Culver City. It was the “Amazing” award, which was originally the “Technical” award, but was renamed since, I am told, rewarding the game’s technical prowess didn’t seem to be enough.

Indiecade Awards

Photograph by the lovely .tiff. On the left is Steph Thirion (Sublime Experience Award), of Ellis and Faraway fame, another French speaking indie game developer. In the middle is Tim Schafer (Trailblazer Award), of The Secret of Monkey Island fame, and founder of Double Fine.

Progress on the game has been steady. I focused a lot of my attention on refining the start of the game: smoothing out on the difficulty ramp, making sure each important concept is introduced in its own level. I’m quite satisfied with the results, and I’ll need to talk about that in a blog post eventually. The graphics have also improved quite a bit, and I’m looking forward to sharing that with you soon as well. This is actually very much related. Especially in this game, graphics are more than “sizzle on the steak,” as players use (subconsciously and not) all available visual and auditory cues to learn how to navigate the game’s space.