# Constructing a Planetoid Cube World?

This is sort of a multidisciplinary question, so I'm asking it here rather than on one of the other Stack Exchange sites.

I've been toying with the idea of making a game that's a mix between Minecraft and Kerbal Space Program, where the world is actually a planet and can be traveled around (either on the ground or in orbit) seamlessly, yet still consisting entirely or mostly of cubes à la Minecraft. It turns out this is actually incredibly difficult to wrap my head around!

There are a few requirements and concessions.

# Requirements

1. Must be able to travel and build on all parts of the planet seamlessly (poles included)
2. Every tile must be able to be mapped exactly or roughly to a spherical coordinate.

# Concessions

1. Planet's perceived 'radius' at varying depths can be uniform.
2. Depth of buildable area can (and should) be limited, meaning you don't need to be able to tunnel into the center of the planet and you don't need to be able to make an absurdly large tower.

Those are the main points, and the problem is open to interpretation and more concessions are able to be made so long as the illusion of being on a planet is maintained.

# Initial Idea

Here is an I've had that may have some merit but I'm not sure if it'd actually work.

## Tesselated Platonic Solid

The idea here is to create a 'virtual' sphere made of a patchwork of faces of a platonic solid (e.g. cube, icosahedron, octahedron). The faces represent a plot of flat land, with each edge being the 'portal' to another faces and so on. In this way the world is always 'flat' and you are basically traveling over a 2D unwrap of the original shape.

One of the problems with this method is that with some tesselated platonic solids (such as the cube above), the tesselated faces are warped and the surface area of each face is not uniform. A little bit of this is acceptable, but not too much.

## The Question

The real question here is ultimately "is this possible?" and if so, what would be the best method to achieve all of the requirements. If not, what kind of concessions would I need to make to make a believable world?

• Possible duplicates/related: gamedev.stackexchange.com/questions/45167/… gamedev.stackexchange.com/questions/59273/… – MichaelHouse Aug 27 '13 at 1:19
• The hand-wavy "a little bit of this is acceptable, but not too much" criteria kind of makes this impossible to answer in any meaningful way. It all comes down to each individual's personal opinion about what trade-offs are fair. As you've already noted in the answer below, where the answerer's suggestion was apparently okay according to his own opinions, but rejected by you as "not acceptable behaviour". – Trevor Powell Aug 27 '13 at 2:26
• I don't think that it is 'hand-wavy' to reject things that have obvious flaws as opposed to more subtle ones. I was trying to convey that I'm not looking for a perfect solution, just a good one. – Colin Basnett Aug 27 '13 at 4:27
• Well.. will this fit the bill? en.wikipedia.org/wiki/Geodesic_dome – teodron Aug 27 '13 at 13:30
• If you need to understand why it won't work with quad patches, you must understand what a non-parallelizable manifold is and that the sphere, having a constant positive Gaussian curvature everywhere cannot be developed onto a plane without distortions. The best you can get are either equiareal or harmonic projections. – teodron Aug 27 '13 at 13:33

I would cheat, and represent each planet as a flat plane in terms of "cubelets" and graphically wrap the plane around the sphere for distance POV. This will work as long as you don't have tiny planets (IE: from the surface, the planet is big enough to appear flat).

The other option is to simply construct the entire planet out of cubes, including the interior. Which would use an extraordinary amount of memory/disk/etc.

When in doubt, cheat :)

• The issue with the first method proposed is that it is highly subject to distortion at the poles and about the equator. This means it would take just as long to circle the equator as it would the north or south pole, which is not an acceptable behavior. The second method is out for the obvious reason of memory limitations, but also because the planet's gravity normal wouldn't be paralell to the blocks' 'up' vector, so you would start to 'lean' as you moved around the planet. – Colin Basnett Aug 27 '13 at 1:23
• The other option is to just use polar co-ordinates for on surface blocks but you will always have slight gaps between blocks. Might be a better idea to mix approaches and simply "cheat" for the poles. – Matt D Aug 27 '13 at 1:26

Would you be amenable to using a triangular grid as opposed to a square one? If so, I think the worst-case distortion can be reduced, relative to using a square grid.

If your planet is "really" an icosahedron before your rounding effect is applied, then each face can be covered with a grid of equilateral triangles, as densely as you like. The icosahedron approximates a sphere more closely than any other platonic solid. The only distortion occurs at the 12 vertices of the icosahedron, where you'd have 5 triangles joining instead of 6. (A shortfall of 60 degrees, a third less than you'd get with squares).

If you can control where the continents end up, you can ensure these 12 problem points are located in the middle of oceans, so they don't impact typical gameplay. (See, for instance, the points of the Dymaxion projection)

Your unit of construction would then be a triangular prism, rather than a cube. These are a bit trickier to work with, but you may be able to make that a natural part of your game's aesthetic.

Make a variable Scale of the Planet,and a variable Distance and Position,distance receives a relativity of Position(x,y,z) of block and the Center of Mesh. And make a if(Distance <= Scale) { MakeVoxel(x,y,z,Material); } Ok.