Readit News logoReadit News
mrtracy · 3 months ago
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.

tantalor · 3 months ago
Never played Super Mario Galaxy. How does it relate to this topic?
mrtracy · 3 months ago
Many of the levels in that game take place on tiny planetoids with spherical surfaces and central gravity. "Spherical" sells it short, there were some truly wild topologies around which Mario could run and jump.
kg · 3 months ago
It has lots of little planets with their own gravity you can jump between.
simooooo · 3 months ago
There are shader packs for actual Minecraft that make the world spherical, it’s a nice addition
squigz · 3 months ago
You can also invert it and play Inception-style!
fennecbutt · 3 months ago
Space engineers
reactordev · 3 months ago
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.

maxnoe · 3 months ago
> WGS84 sucks for mapping a sphere.

WGS84 is not a map projection, it's a geodetic reference frame prescribing a reference ellipsoid and reference positions of ground stations.

https://en.m.wikipedia.org/wiki/World_Geodetic_System#WGS84

lsaferite · 3 months ago
Not allowing excavation to the core solves weird gravity issue as well. Astroneer had super weird gravity at their planet core. You can get stuck oscillating there.
reactordev · 3 months ago
If you really wanted to go for realism, there would be NO GRAVITY at the core. :P

As you dig down you would get lighter and lighter on your feet.

Any mass you are below (within the sphere of Earth) will exert a gravitational pull in one direction, while the mass above you (also within the Earth) will exert an equal and opposite pull.

jacquesm · 3 months ago
That actually sounds pretty close to what I would expect to happen IRL. After all the mass is mostly all around you at that point and depending on how far you are towards the core you might build up speed, overshoot the target and then do it all over again.

But hollow planets are hard to come by so this is just my imagination, I'm sure someone has worked out exactly what would happen.

Aeolun · 3 months ago
I think the outer wilds did this perfectly. I seem to remember falling towards the core and gravity just disappearing.
rcxdude · 3 months ago
Astroneer does deliberately make it weirder, though, it's not just a simple gravity implementation.
RA2lover · 3 months ago
My understanding is Space Engineers takes the "blocky sphere" approach mentioned early in the post, works around the "walk along its surface" part of the problem by making gravity direction point towards a fixed point, and bypasses the "trying to build 'upward'" part of it by not allowing voxel construction. It doesn't use a quad-sphere at all.
reactordev · 3 months ago
Correct, which is why I said they didn’t go half as far as the OP did. Most stop at quadsphere after realizing their blocks are no longer square.
tomaskafka · 3 months ago
Everyone wants to dig to the core (and build a cool zero g habitat there), at least that was the first thing I did :)

Deleted Comment

cyptus · 3 months ago
thats why a liquid core is needed in the matrix
pvankessel · 3 months ago
Curious about this, is there actually a canonical explanation in the trilogy somewhere?
accrual · 3 months ago
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
inetknght · 3 months ago
> I would love a Minecraft + Kerbal Space Program fusion game

You might like Space Engineers.

Unfortunately Space Engineers is full of jank and random things will explode through no fault of your own. Actually, I guess that's on par with Kerbal Space Program-y. Also, Space Engineers will sometimes crash to desktop.

There's a Space Engineers 2 in development and I have good hopes for it.

RA2lover · 3 months ago
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.

mrtracy · 3 months ago
It's an elegant rendering trick, but if their worlds are represented as a torus, then I expect this would make rotation on a spherical globe view unintuitive.

One example of this: I would expect each location would not have a single antipode (opposite coordinate) but would instead have three. If you were to start at location A, rotate travel 180 degrees along the latitudinal axis to location B, then 180 degrees around the longitudinal axis... on a sphere you would expect to be back at location A, albeit upside down. But on a torus, you are in a completely different location, which is the 'C' antipode. Rotating 180 degrees latitudinally from here will bring you to point D, the last of the antipode set.

RA2lover · 3 months ago
I don't find it to be a problem as planning a route from A to B isn't done by looking directly for it, but by subconsciously referring to and plotting a path through landmarks along the way that aren't close to antipodal.

One of the worlds i played on had road planning from the start and a set of roadways covering the entire world in a 4x4 square grid. Pathing to point D was just a matter of going 2 blocks in one direction, and 2 blocks in an orthogonal to it.

In a world without such roadways, you'd look for landmarks such as oceans and continents instead.

Ultimately, you don't care if somewhere is antipodal or not because you never see the antipodes to where the globe is currently looking at without rotating the globe.

superb_dev · 3 months ago
I had a similar idea while reading this article, it’s very cool to see someone implemented it!
exDM69 · 3 months ago
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.

harvie · 3 months ago
I was recently thinking about this... We've been building houses and other structures using plum lines and water levels all the time before afordable optics came in play. This kinda means most of our buildings are actualy polar rather than cartesian. Surely enough given the size of earth the error is quite tiny. But it's funny thinking about how the room i am sitting in right now is shaped like frustum with spherical floor and ceiling, rather than block. Despite what architecture drawing says...
LeifCarrotson · 3 months ago
If the floor and ceiling (and walls) were leveled and flattened and brought to plumb with a straightedge scraped in with the three-plate method [1] (Popularized by Whitworth in the 1830s, but the ancients made straight edges and flat plates too), then they were actually not 90 degrees at the corners!

[1] https://ericweinhoffer.com/blog/2017/7/30/the-whitworth-thre...

UltraSane · 3 months ago
There are very long and narrow wave pools used for research and testing and they are long enough that the surface of the water curves measurably vs extending perfectly straight lines from the center out.
mdnahas · 3 months ago
Long bridges, like the Verrazano Narrows in New York City, have plans that account for Earth being a sphere. The towers at either end are not parallel, but tilted apart so that each is aligned with its local gravity.
brokensegue · 3 months ago
i imagine imperfections in construction dominate this effect
jameshart · 3 months ago
If you have two buildings 4km apart (about the length of Central Park), that’s about 1/10,000 of an earth circumference so 0.036° change in ‘up’. If the buildings are 300m tall, 300*sin(0.036°) = 0.188m

That’s less than those buildings are probably expected to sway in a strong wind, but probably outside the tolerances for modern construction so theoretically measurable as an average deviation.

Tremeschin · 3 months ago
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

[3]: https://youtu.be/bJr4QlDxEME

gatane · 3 months ago
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