## 4D Toys: a box of four-dimensional toys

So I have been working on Miegakure for a long time now, and I have created and accumulated many cool 4D things of all sorts. I think it's about time that I share some of them, so...

Surprise! Today I am releasing something!

### The History of 4D Toys

Near the very beginning of Miegakure's development, someone joked I should do a “4D physics engine.” Then a year or so later I had gathered enough knowledge (especially in geometric algebra) that it was a possibility. So I made one for fun, and kept working on it on the side. It evolved into a 4D physics-based toy box that you can get right now, for iOS (Multitouch & Accelerometer) and Steam (both VR (Vive) and Mouse/Keyboard).

Basically it turns out the rules of how objects bounce, slide, fall, spin and roll around can be generalized to any number of dimensions, and this toy lets you experience what that would look like.

My initial goal in making this was to have a ton of fun inventing the math for it. At first I was skeptical it was going to be possible at all, but in the end the mathematics fit together so well.

I was only planning to use 4D physics a little bit for Miegakure as a purely aesthetic component, since dynamic physics is a bit too unpredictable to make good puzzles with. But then I started thinking about making a stand-alone iOS toy to play with 4D objects, to take full advantage of the physics. At first it was very simple and based around the idea that in 4D you can have interesting new dice shapes like a perfectly symmetrical 600-sided die, or a 4D hypercube die with 8 faces (each of them a cube). But I kept adding new shapes like hyperspheres, etc... and it got out of hand, so the dice theme didn't fit anymore, and I named it simply “4D Toys.”

The website (4dtoys.com) has more info on it!

## More details about the design of 4D Toys

### Undirected 4D Play

4D Toys doesn't take you through carefully-constructed successively harder challenges the way Miegakure does. It's just 4D shapes, as if you were a very young kid again and given a box of wooden toys. Since the toys are 4D, that's sort of true: you have no experience playing with 4D shapes.

Play is undirected and we don't expect a child to come up with verbal realizations of what they are doing. They can learn about making stacks, and gravity, and fitting shapes into holes, and that could form the foundation for future, verbal, learning. Alternatively, one can just look at how pretty it is, like the waves rolling down the ocean, or the intricate swirling patterns in a fire.

It's so exciting to me to see a pile of hypercubes or a rolling 120-cell. Most representations of a fourth dimension are so abstract (a spinning bundle of lines) and my work has been to get away from that. It's the first time anyone has seen these objects as physical objects that bounce and roll and can be grabbed!

### Side project

4D Toys was a very fun side project. It uses the same engine as Miegakure, and many improvements I made to it have hugely benefited Miegakure. For example, I built a lot of the complex 4D collision detection code used in Miegakure for 4D Toys. I also came up with many ideas for Miegakure levels and scenes while playing with 4D Toys.

### Designing how to present 4D Toys

After I made it, I had to come up with a metaphor for what it was. Miegakure players know it is a puzzle-platforming game, so if they've played one before it sets a frame for the interaction, and the game can spend less time explaining everything and focus on the new stuff. They know how the game teaches things.

But 4D toys cannot rely on this well-known format. My goal was to strongly imply that it is not supposed to teach you in the way a puzzle-platformer like Miegakure does, but instead that it may only teach in an intuitive way. I came up with the idea of a box of toys, so the “menu” could be toys laid out on the floor, and you pick one and play with it, then come back to the menu.

However unlike a real toy box I have to first teach players how to manipulate the shapes a little bit. So I made a short tutorial that you have to play initially. The only thing that players really need to know besides the basic interactions is how to get back to the 4D shapes if they loose them into the fourth dimension. It's fascinating to me that the tutorial teaches exactly that, even if a player has no idea what they are doing. Once the tutorial is complete almost all the shapes are available to play with.

I also wanted to explain, non-verbally, this idea of a 4D toy box, so we also put a small comic strip that shows how someone might end up with such a toy box. I like how subtly this idea is communicated. By the way, Kellan Jett (who is doing concept art for Miegakure) did the amazing art for it.

(By the way, for the VR version it is recommended to be on floor when playing!)

### Adding an optional verbal explanation

I wanted to stop there and just give out a mysterious box of toys with barely any instructions, but playtesting revealed that some people really wanted to know more about how the shapes and how the fourth dimension worked and what they were seeing.

I think that while kids are fine playing with toys without fully understanding them, as we get old enough we start to ask “why?” when we discover something new... and as much as I like non-verbal learning, I didn't want to leave these “why?” questions hanging in the air. If I manage to make you interested, why wouldn't I try to answer these questions if I can? So I decided to add an optional interactive “Interactive Explanation” that takes you step by step through what the fourth dimension is, how a 2D being would experience the third dimension, and by analogy how a 3D being would experience the fourth dimension. This provides the beginning of an answer, and the toys become even more beautiful if you understand just a tiny bit more. There are also optional questions marks in certain scenes you can click on to get more info.

The interactive explanation could stand and be interesting on its own. It is very verbal, as opposed to the toy itself, which is totally non-verbal and freeform. While I wanted to get away from verbal learning because it is so often done poorly and takes you away from the experience, it is interesting to think about when verbal communication is appropriate and when it isn't. In this case I think it is good that the explanation stands next to the experience itself and can be ignored. Interestingly, Miegakure sits sort of in-between these two extremes: it is goal-oriented and directed and has words, but it very intentionally never verbally teaches you about the fourth dimension or how to solve its puzzles.

### Interaction method

Like I mentioned before, a problem that comes up when you are a 3D being playing with 4D toys is that they tend to disappear into the fourth dimension. A friend intuitively suggested a scrollbar to move along the 4D, and that seemed like the simplest way to solve the problem. Also this way we can display the extent of each shape in the fourth dimension and that allows players to very quickly find shapes when they lose them. Note that this is different from Miegakure's mechanic of rotating the player's slice. Miegakure's rotation mechanic is necessary since the avatar would hit invisible walls if they could move in a direction they can't see: 4D Toys does not have this problem since there is no physical avatar. Aside from the fact that both Miegakure and 4D Toys are 4D, the experience of playing each is completely different and complementary!

### Final words

Anyway! It's a thing. You can get more info about it at 4dtoys.com.

It is out now for iOS and Steam (both VR (Vive) and Mouse/Keyboard).

I am excited to release something, anything (!) and see how it goes and learn from the process. While I plan to add things to it when I feel like it, my focus is on Miegakure's development. Please enjoy!

### 75 Responses to “4D Toys: a box of four-dimensional toys”

1. Ben says:

Out of curiosity, have you ever read "Mimsy were the Borogoves", a science fiction short story from 1943? You've managed to build the wire maze from that story here. Also, could you consider publishing this for the Windows store? Playing this in Windows Holographic would be amazing.

• marc says:

If you buy it you might find out that I have read it.

• D says:

It too me far too long to realize that when Marc said "buy it" he meant "the game" and not "the story."

At the bottom of http://4dtoys.com/ there is a quote from Mimsy Were the Borogoves.

2. Gidaio says:

Gah! Vive only? Is there any hope for Oculus or OSVR support? I would LOVE to mess around with this, but I have an Oculus Rift.

If it's too much trouble, don't worry; I'd still like for you to focus most of your time on Miegakure. However, if it's a simple little add-a-few-calls and boom, that would be awesome.

• xyzzy1525 says:

The Vive's API is called SteamVR. Oculus has 100% support for SteamVR applications. Probably it will just work.

• Sam says:

I wonder what the purpose of having separate "Vive" and "Oculus" icons in the Steam store then? because they do, and many games have both the Vive and Oculus logo's but 4D toys only has the Vive logo.

• Gidaio says:

Maybe I'll check it out, then. If it doesn't work, I can always just return it.

3. VcSaJen says:

Great!

Is it possible to spawn-in various shapes and fixed platforms, like in Phun and other games? Or it's fixed demo rooms? I'm sure it will extend it's playability if it's available.

• marc says:

Not right now. We'll see.

4. Steve says:

Looks very cool -- it'd be great (code and your time permitting) to get it on Android (+Daydream) too...

5. Dzre says:

Can I play with it on Steam without Vive?

• marc says:

You now can!

• Sam says:

Happy Dance!

6. Sam says:

Oh man, I so want that! But, now this choice becomes harder: Do I save up and buy Nintendo Switch, or a Vive... [Insert Concerned SpongeBob Meme here]

I'm closer to wanting to buy a Vive than I am to an Ipad/Iphone.... decisions decisions...

• Sam says:

heck I want to buy it on steam just to show my support! Are you planning on an Android, or a non motion controlled PC release?

• marc says:

Thinking about it now...

• Mirek M. says:

Wanted to write the same thing -- absolutely would buy on Android.

Perhaps do a short survey to check whether it's worth it to port it?

7. Anon says:

1) Get back to work on Miegakure and stop spending time on other projects!
Kidding, of course. This looks awesome, and I'm excited to try both.

2) Any plans on releasing an Android version? As awesome as this looks, I'm unwilling+unable to buy a new device for it. 🙁

8. Limeth says:

Very interesting and highly appealing.
I have made a 4D renderer which uses ray tracing, but I can't wrap my head around how one would approach 4D rendering using rasterization. Do you compute 4d line intersections with the visible 3d subspace and then render the connected intersections?
Would you recommend any literature for this?

Thank you

9. Dan says:

This is amazing! Bought it on iOS and played for an hour. Now I keep expecting real things to roll into the 4th dimension when I let go of them.

Will the cool, complex objects in this like the duocylinder and the "tiger" be in Miegakure?

• Dan says:

Also, will there ever be a "rotate" function in 4d toys like there is in Miegakure?

• marc says:

YES

10. Greg Kavalec says:

Excellent work.

Question: how do you deal with the question of angular momentum?
I looked at this and got stuck by the lack of a cross-product in 4D.

• Yrlf says:

In 4D, the cross product is replaced with a similar construct that creates vectors orthagonal to others.

In 2D, you need one vector to specify a unique orthagonal vector. (Cross2D(vec) -> vec)

In 3D, you need more than one vector to specify a unique orthagonal vector (that is orthagonal to both). (Cross3D(vec, vec) -> vec)

In 4D, you just use one more and it's unique again. I don't know the mathematics of angular momentum in 4D, but it probably isn't that hard to generalize to 4D. (Cross4D(vec, vec, vec) -> vec)

Marc will probably be able to follow this up in more detail than I can, my first exposure to 4D was through Miegakure.

• marc says:

That's one way to generalize the cross product, but that's not the one I use.

• xaq says:

Rotation in higher D is typically defined within 2D planes; the other N-2 dimensions need have no movement. So in 4D you can rotate in xy and keep wz, or you can rotate in wz and keep xy. You could also rotate in both (double rotation). Or you can rotate in any combination of planes.

11. Dandelion says:

Thanks for making this! It currently doesn't work on Plus-sized iOS devices. As documented here, https://news.ycombinator.com/item?id=14472415 the graphics and hitboxes go out of sync, making it basically unplayable. Please fix! :thanks:

• marc says:

Am aware and fixing now!

12. Greg says:

What would you suggest as the best approach to learning geometric algebra? I was linked an article about it recently and it sounds fascinating, but I'm not too sure how to start and what resources are available+good. 4D toys looks awesome!

13. Ian says:

The app crashes on my iOS 8 device because of a call to -[UITraitCollection forceTouchCapability], which is only available on iOS 9. Could you make sure you're using only APIs available on iOS 8 or update the version requirements in the store? Thanks!

• marc says:

Thanks for reporting this! Will be fixed tomorrow.

• dave says:

I had this bug too -- the app would crash on the first touch, and I was on iOS 8. I figured it was probably worth upgrading to iOS 9 anyway, but the bad news is it crashes on iOS 9 as well. It gets a little further, but it still crashes when it gets to the pentagon loading screen. I am using an iPad 2 with iOS 9.3.5.

• dave says:

Just popping back to let you know that the new version has fixed the issue for me!

14. VisibleCode says:

Something that might be interesting to add would be some kind of "onion skinning" (like in 2d animation) so you can see a little bit of hazy depth in the fourth dimension rather than just getting a crisp 3d slice.

15. JusticeJoe says:

Marc is right as a learning tool this is phenomenal, bringing the 4th dimension to our finger tips in a textile way is superb. This should be available for every platform, and come as a game preloaded on every device, this needs to be in the hands of every aspiring mind. Don't limit it to the elitists with Apple, put it in the hands of the masses, port it to Android please, this needs to be done to increase our knowledge and understanding as a species. That one mind that invents time travel, may very well be playing with your toy when the idea first hits.

16. Gert10 says:

This looks fantastic! i'm so glad to see your works in an interactive medium so soon, I am curious though if you've thought about sending off review codes for this to stir up interest in Miegakure. There are a few reviewers, like Nerdcubed and Uidsea, who i believe would love this and would be interested in Miegakure when it does come out.

17. xaq says:

I'm so thrilled to be playing with these toys! Congratulations, and thank you for this gift to the world. I especially love the duo cylinder and tiger.

I'm sure that you've thought extensively about this, so I'm curious how you decided to focus on cross-section rather than projection (e.g. compare to urticator.net/maze).

• marc says:

I wrote a detailed reasoning somewhere on this blog, but basically I like the feeling that these toys could physically exist in our world, and I like how you don't have overlapping shapes to visually parse.

18. Diego says:

I hope I had an iPhone or Windows. I can't wait to borrow someones computer or mobile to try this!

• Diego says:

Also, I can't wait for the first generation of babies playing with virtual 4D toys. Can you imagine the new ways their neurons will interact playing with these while having their brains at the peak of their plasticity? It's excitingly insane.

• xaq says:

We can kind of do this now, not with real babies but with artificial intelligence babies. One of the major purposes of the brain is to infer 'hidden variables' — things you do not get to see. In 4Dtoys, structure in the fourth dimension is precisely that! There are a bunch of efforts underway (e.g. openai gym, project malmo) to provide a physics simulation that artificial agents can explore and learn from. It would be fun to let an AI agent play with these 4D toys and see how its representations evolve.

• Sam says:

If I ever have a child, when they are old enough to mess around on a tablet, I will definitely make a point to have them play the 4th dimension.

19. Owen Thompson says:

I've been imagining an augmented reality based Rubik's hyper-cube since I was 18 I'm really curious how that would behave in this toy box

• Sam says:

Me too, I have solved some of the easy scrambles on the Magic Cube 4d, but I'm not sure I could solve it viewing a slice at a time, or even if the mechanic would work in a physical sense.

20. Spencer says:

Are there any options for creating or importing 4D geometry? I would be very interested to play with a 4D level editor.

Also, I would love to see Mac support for the steam version!

21. Avi says:

Hi just been playing with the game and it's pretty fun. My brain keeps straining to try to intuit the object that I can't see. One thing that I think would help would be to add a way to deliberately move an object along the fourth dimension. While I appreciate the unpredictability of bouncing objects into the fourth dimension I think it would help build an intuitive mental model to have full agential control in four dimensions.

After all a baby playing in a three dimensional world would have a difficult time developing a picture of reality if they could only move into two dimensions and had to infer the third dimension merely from bouncing and changes in viewpoint.

• marc says:

If you are holding an object while scrolling in 4D, it will come with you!

• Avi says:

Oh nice, that's a good feature. However, I still think it would be good to have a way to push or pull objects through the 4th dimension while having the viewpoint remain fixed. Neurologically that would allow us to do something like what a baby does when they grasp a toy and wave it around. As the baby moves the toy, their brain correlates motor system activations with changes in visual information; this is how the nervous system builds up a 3D model of the object. It would be good to be able to do something similar in 4D.

22. Nick says:

Do you think you'd be able to add support for rotation along the fourth dimension? At the moment, it seems like the best way to rotate it that way is to press it up against the fourth dimensional wall at the top or bottom of the scroller, or to press it up against another object, but even then it can be difficult to move it into a position you want.

• marc says:

Yeah, that seems like the most requested thing.

23. sam says:

So after messing around in the toy box for a little while a question occurred to me about the "dice," What is the convention that you used for the numbers? Are they numerically balanced?

Like a regular d6 in 3D, the opposing faces add up to 7, and in d20's the opposing faces add up to 21. In larger die there is an additional property that is ideal and that is that the numbers located around a vertex add to the same value.

Are there properties like these possible in 4D? Have you incorporated them into the game?

24. Allen Knutson says:

Since I view 3d objects in 2d by looking at projections (with occlusion) not slices, I'd like to view projections of these 4d objects. If you work in quaternionic coordinates, then you could use the left hand to rotate by left multiplication (by unit quaternions), the right by right multiplication, which would be nice because they commute.

Check out the short, excellent game Simian Interface to see some of the problems one could play with.

• Sam says:

I'm curious to be able have this view too, but Marc has explained a few times on this blog why he chose to go the slice route, and after playing around with 4D toys for a bit I actually find myself agreeing with him, while nothing in 4D is what you'd call in intuitive, by viewing only a slice at a time you can get the sense of the object and you can see the straight lines of the shapes as actual straight lines, and perpendicular corners are really perpendicular rather than weird shapes that look somehow nested inside one another...

Now I would love an optional view, but there are plenty of 4D projections that you can look at online, I think Marc really has something unique here by adhering to slice view.

• sam says:

By the way, I gave Simian Interface a try and thought it was awesome, I think a similar game with a 4D/3D mechanic might possible break my brain. haha. I think I'll give 4D toys and then Miegakure some time to ready my brain for it.

25. Emil says:

You make so cool stuff but for the wrong platforms! I would love to play with the 4D toys on my Android and I think Miegakure is a perfect fit for Nintendo Switch.

26. sam says:

Hey Marc, Have you ever considered (or have you) making 4D paper or cloth? I'd like to see a cube folded like a piece of paper.

27. Garrett says:

Just out of curiosity, is there any sort of ETA as to when Miegakure will be released?

• marc says:

No not yet

28. Noah says:

I'm a bit confused by the use of gravity in the simulation. As an inherently 3d force isn't it a bit weird for it to exist in only a given slice? And if you simply extend it into 4d, it should in principle be reliant on a large 4d earth-like sphere,no?

• marc says:

You can think of gravity as a force pointing along a vector, in 4D that vector simply has 4 components. As such it exists in all the slices at the same time.
Yeah the vector would be pointing towards the center of a 4D sphere, but there's nothing theoretically wrong about that.

29. ergZay says:

Please compile a version for Mac! You have it for iOS already so it sounds like your engine is easily cross platform. As an Android user with a Mac computer this is very frustrating! Please release it on Steam with Mac.

30. Jacob says:

Will there be dice-rolling in Miegakure (with the NPCs with gyrochorons)? I think it would be cool if you played 4D games with them, like 3D Tic-Tac-Toe on a "papercuboid". Also, I think the game (4D Toys) lacks some cool 4D objects, like Klein bottle, Clifford torus or 3D equivalent of the Möbius strip (a cube of which one face is extruded in 4D and connected with the opposite face, while rotating 180° along w axis), spherinder, Schläfli-Hess polychora (you could even create Kepler-Poisont polyhedra without self-intersections), Kepler-Poisont-polyhedra-prisms. One last question, are the NPCs "aware" of that they live in a 4D world and are they able to travel within it? Sorry for that many ideas, you do not have to implement them in the game (although it would be very interesting in Miegakure to travel through a tunnel shaped like 3D-Möbius-strip). I apologize for possible stupidity of some of the ideas (I am not an expert) and language mistakes (I learn English as a foreign language) as well.

• marc says:

The tiger is basically a Clifford torus.
Some NPCs are and some are not...

• Sam says:

I like your idea of playing hyper tic tac toe with an npc, might be a good add on to 4d toys Is to implement a drawing tool, to draw 3d figures on the ground or other shapes

• Jacob says:

Thanks for appreciation!
Sorry if it sounded like I am not satisfied with the game, it's awesome work. I have plenty of other ideas too (like 3D chess with 4D figures, 3D keyholes and 4D keys, 4D maze, 4D wires (you have to discover where does each one go in order to press the right button) etc...). In my opinion there definitely should be a editor (4D Toys and maybe Miegakure, too; then there could be a feature system and level sharing).

31. Pulin says:

I would love to buy it but its not on android

32. Monty says:

This game - which by the way has led to me getting a new laptop and a vive just so I could play it - has given me an interesting idea... Is there any possibility of Miegakure being VR?

• Gui says:

why would you want VR in a game with third person view (especially being isometric)?
I don't mean to offend, i'm just curious (sorry for my shitty english btw).

• marc says:

It's kind of interesting to be able to walk around the game like a tabletop...

33. Monty says:

Having played with 4D toys for a while now, there are a couple of things that could be improved.

I find that I cannot rotate the 4d objects into the fourth dimension unless I use some variety of friction against another object. I keep finding myself trying to use differential force in the fourth dimension by swiping the vive touchpad in opposite directions simultaneously, but of course it doesn't work, since they're linked.

By allowing rotation into the fourth dimension for both held objects and ones self, that would remove a major niggle.