You should definitely have a look at space engineers. They have a similar spherical problem with their voxels and I don’t think they went half as far as you did when implementing “orbital bodies”.
As someone who is rather keen on space, gfx, and the algorithms that render them. Kudos. The problems were known to me, which is why I didn’t attempt it, however - the distortion correction, the chunking, I’m thinking if you just limit how far down you can dig (half way to the “core”) it will be fine. You won’t run into those tiny squished blocks that make up the core.
It’s also important to call out the quad-sphere. This is what makes it doable. Naive devs may just map lat long to sin cos spherical coordinates and call it a day, not realizing that their poles are jacked up. The cartography problem. I’m really glad to see that called out as people don’t realize WGS84 sucks for mapping a sphere.
This is SO fun! You have the foundation for a cool voxel-y interplanetary game if that's your jam. I had fun "getting into orbit" and watching my velocity increase at periapsis and decrease at apoapsis, then descending and landing with the rocket power button ([Space]). I would love a Minecraft + Kerbal Space Program fusion game and most of the pieces for it are already here. :D
Eco: Global Survival (https://play.eco/) bypassed the distortion problem entirely by using an undistorted flat voxel grid, but rendering the globe view as a torisphere.
It still has the tradeoff of making travel close to the center take longer than it should on a sphere (worked around by limiting diggable height), but i find it a more elegant solution.
The article doesn't describe the way to avoid the difference in rectangle size in a cubesphere, so let me.
The bad way: - Generate a cube - Subdivide each face using linear interpolation (lerp) - Normalize each vector to put it on a unit sphere
The good way: - Generate a cube - Subdivide using spherical linear interpolation (slerp) - done!
The cubesphere has lots of interesting geometric properties, particularly in texture mapping.
Given how naturally you can map a grid of quads onto a strip of adjacent triangular faces, I wonder if you might end up with a better distribution of the distortion using a geodesic sphere rather than a puffed-out cube as the basis— at the cost, of course, of an even more hair-raising coordinate scheme for actually addressing it all.
Anyway, you're never going to avoid the existence of some special nodes where three corners come together, and this does nothing to address the altitude problem, but I think it might result in a more uniform surface especially as the overall diameter goes up.
This reminded me of another attempt, but in Minetest:
- https://youtu.be/ztAg643gJBA?si=8vDgg0rFCOj9I7no
This person has another, more technical video where they talk about the math behind it btw
I wonder if this is also how Eskil Steenberg's 'Love' worked. [0]
It had a spherical 'block' world as well.
I suppose the same shell trick could also work on hyperbolic maps too, right? I've wondered what Minecraft would look like on a hyperbolic plane, if you were to squeeze an exponential amount of terrain within a linear radius. It's a strange thing to say, but I think it's more "practical" than Euclidean geometry in the sense that every is very close to everything, but there's still plenty of room.
Should have used a tetrahedra the size of the world sphere, and subdivided it until the smallest size of a voxel is reached, based on camera location. Then convert it to triangles where it intersects with air.
Then you get automatic LOD.
Earlier versions of the now abandoned Seed of Andromeda [0] [1] had planet-scale voxels with physics! I remember causing huge avalanches with explosions, or watching many pools of water flowing downhill [2] myself, it had so much potential..
There was a dev blog or two I couldn't find in Wayback except a YouTube video [3] on how they mapped the sphere to voxels. Not that one would notice much local effects at these scales (Flat Earth illusion), but Blocky Planet showcases the other end of the extremes, where Distant Horizons' curvature option or some other rounded world shaders out there could never achieve! (+Outer Wilds vibes)
[0]: https://github.com/RegrowthStudios
[1]: https://web.archive.org/web/20210416224527/https://www.seedo...
[2]: https://youtu.be/qCoyNH6y7CU?t=529 + at 9:23
I wonder if it is possible to avoid "digging deep" problem by first building a cube out of voxels and then applying the type of distortion that turns the cube into quad sphere not just to the surface of the cube but also to the insides of the cube.
I don't know how to explain it better, perhaps I should try to write some code, lol
In a similar voxel system, for Roblox there is: https://web.roblox.com/games/4597506405/Gravity-Controller, my youngest son made a game based on it: https://www.robloxgo.com/game/4617217359/Gravity-Combat
Wonderful!
I wonder if there's a way to do something similar to Rectangular Surface Parameterization[1] with voxels. It would allow you to get pretty even-volumed voxels, and also simplify vertex identification (same three coordinates, nonlinear connection).
[1]: https://www.cs.cmu.edu/~kmcrane/Projects/RectangularSurfaceP...
Loved the writeup.
Are there any Minecraft clones that operate on a cubic world? Could be really fun building out a base on an edge, or on a corner!
Super cool demo!
I think the only thing that could dethrone Minecraft would be a voxel game with much smaller voxels (relative to the first person view). Maybe 1/8th the size of Minecraft blocks.
Neat. Reminds me of Planet Smith, a work in progress game with a similar concept (spherical Minecraft), except it uses hexes instead of cubes. Hexes reduce distortion, but add their own complexity. There’s a small number of pentagons on the surface, too, to make the tiling work.
I had a bit of fun playing with the orbital mechanics of it. First soaring around the planet core, then around the planet itself.
At one point I flew far enough into space that I passed the star objects and everything got dark. That was a bit disquieting.
Very cool little game!
Flying up too high becomes quite interesting. Eventually you hit the point where you're missing the ground and end up on an upward spiral... essentially falling up. You have to go backward to find a place where you can start falling down back toward the ground.
This made me think of Google's S2. 64-bit ID for every less-than-1cm^2 roughly-square area on Earth's surface, less bits used for bigger areas.
https://docs.google.com/presentation/d/1Hl4KapfAENAOf4gv-pSn...
This is a problem I have spent quite some time thinking about but never came up with such an elegant solution. Fantastic write-up, thanks. I do hope you open source it at some stage, would love to have a play around with the code.
> dozens of map projections.
This has plagued me for decades and I’ve been exposed to hundreds of projections. Probably thousands if you consider each UTM or MGRS zone to be its own projection.
God do I wish the Earth was flat.
<3
It would be nice to have an edge transition table, but implementing it sounds pretty tough.
My favorite Spherical Minecraft-like gamedev project is PlanetSmith [0], which uses hexagonal voxels (and a few pentagonal voxels). The devlogs are very well produced and I highly recommend checking them out.
Huh, I submitted this article last week when it came out and it didn’t get any attention at all.
This demo is super cool! I’ve been dreaming about a game with an engine like this for the last 5 years. Super happy to see people experimenting with it!
Wow, Minecraft X Outer Wilds… I should really finish Outer Wilds. It’s incredible and super fun to explore the solar system but I find many of the challenges quite difficult to navigate with the zero g thrusters.
Getting `ERR_SSL_VERSION_OR_CIPHER_MISMATCH` for link, but non-HTTPS works: http://www.bowerbyte.com/posts/blocky-planet/
I took a swing at something vaguely similar a long time ago now: https://github.com/jeffparsons/planetkit
My approach was to build a hex grid on a geodesic sphere. It's a very different trade-off.
Nice work! I've tinkered with this idea a bit in an unpublished project. How do you handle the singularities at the cube corners where three faces meet?
how about making the player smaller as you get closer to the core? then each layer appears the same. would be no seams where layers double/halve.
I chuckled when I got to the Core and it was a cube
This is a great demo. I love the laser, just destroying an entire voxel planet was pretty fun.
I could access the site a minute ago, but now I get "ERR_QUIC_PROTOCOL_ERROR". It works again.
> Not currently, but I may make it public later. The current state of the code isn’t the cleanest, so my sense of pride prevents me from sharing it.
Felt that.
I wish minecraft would adopt this mode! I'd love limited collab worlds.
I made a planetoid Minecraft demo back in the day, but I left the planet as a cube. Each cube had a defined gravity direction, so you could rig it so that no matter what face you were on, gravity pointed "down". Having gravity be a customizable per cube allowed for cool things like having the center of the planet have reversed gravity, so if you dug too deep you'd find a cavern and could walk on the inner surface of the planet , effectively upside down. Or you could have two planets near each other and build upwards until you entered the others gravity well. I also added portals, so you could even jump through a portal fast enough to get thrown up to a neighbouring planet.
Obligatory awkward demo: https://youtu.be/PDZGzL4GRF0?si=K9vfMhbcg5Vvd1_A
All these squares make a circle.
I tried making spherical grid planets before, and keep on wondering about the best compromises. Looking at the description, your version presumably has:
Certain blocks corresponding to the corners of the cube, where despite anti-distortion efforts the blocks will have one corner at 120° instead of 90°,
Triplets of blocks at these locations, where turning twice gets you back to the first block,
Blocks that get smaller as you mine down, and then suddenly double in size,
Somewhere, down at the core, a regular polyhedron (what shape is it? Must be a cube) made of pyramid blocks that all come to a point in the center.
OK who's fucking downvoting me for thinking about geometry? If one of these assumptions isn't true, go ahead and tell me.
Press E and Q for some lasers
how about making the player smaller as you get closer to the core? then each layer would be the same. there would be no seams where layers double/halve.
Instead of having weird 8 points in the world where 3 instead of 4 quads meet at a vertex, for minecraft like game it would make more sense to have barrel-like mapping with ice caps being weird zones where you can't build on or you transition from barrel mapping to flat mapping for ice caps, so you have unbuildable ring just on the ice boundary.
on a tangential note I once tried to get pathfinding working on a rhombic dodecahedral honeycomb feeling as regular 3-ish level octtree Dwarf Fortress of 2014-ish vintage was insufficiently weird.
this did not end well, but was hilarious. just to visualise the stuff I had to spend a week gluing cardboard rhombododecahedrons from pizza boxes.
what I learned is that they make much more fun toys than plain old cubes.
and that shallow sparse octtree-like things are in fact better for those kind of games (or GIS for that matter).
This looks so cool
Could you just cheat and render part of larger square map (with top wrapped to bottom and left wrapped to right) inside a circle and deform it so it just gives illusion but isn't really a sphere?
Quick experiments in blender show me that you can create a cube, then use subdivision modifier to get a fake sphere like the one in the article. Then put camera close to the surface and give it very low focal length. This way it looks like a sphere but the strange points where 3 quads meet are way out of the view so I basically see just one face of 6 sided sphere.
If I now textured this side so that it displays roughly 50% of the square texture containing the world map and scrolled and rotated the texture as I try to "rotate" the sphere I should pretty much not be able tell it from a real sphere but have a 100% normal 2d square Minecraft grid on top of it.
It looks quite nice, even and natural:
Texturing is a bit weird because polar caps are just two regions of the world with stuff in between them in all directions so you need to put them at the right distance and size them properly so they show up. And even then they disappear as you rotate the world by scrolling in W-E direction. To make them visible at all times, you'd need to make them half of your world. Which might be fine for your game to have vast, icy biome connecting north and south of your planet. Or even two separate zones of the planet separated by northern and southern walls of ice.
I'm not sure how well lightning is going to work with such low focal length but it might be fine.
Why can't you cover spherical surface with quads so that 4 lines meet at every vertex? How would the proof of that look?
A torus would have been easier.
I like the shader you used for the core.
Wonderful write-up of attempting to tackle this problem. I believe there must be a significant number of people who have played both Minecraft and Super Mario Galaxy, and had something like this sequence of thoughts - although you have followed it all the way to an actual demonstration, and written up your thoughts along the way so clearly.
The vertical distortion is the biggest issue IMO, there are a few reasonably satisfying ways to approach the horizontal tiling of each “shell”. For example, you can make your world a donut instead of a sphere, and now you have a perfect grid at each level! Of course, this introduces a level of distortion between the interior and exterior, so you also twist the donut once, and now you’ve both solved your distortion problem and invented the stellarator fusion device.