8
\$\begingroup\$

I remember back in the 90s when X-Com came out, being really impressed by the way its world map was an actual world: a map of Earth drawn on a spherical surface. That was pretty cool, because I had never seen it before. And now, thinking back... I can't recall just off the top of my head ever seeing it again, with the obvious exception of X-Com: Terror From The Deep, which used the same engine.

Most games that have an entire-planet world map either use a rectangle that wraps around at the sides but not the top and bottom (a cylinder), or a rectangle that wraps around at all four edges (an impossible geometry that some people call a "torus", even though it can't actually represent a real torus.) And that makes me wonder why.

What difficulties does attempting to build a spherical world map for a video game raise, that it's so incredibly rare to actually see it done?

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Just as an aside, I'm curious why you say that a rectangle wrapping side to side and top to bottom "can't actually represent a real torus" - is it because there's some stretching involved in this map projection (like most map projections), or something else? \$\endgroup\$ Commented Oct 20, 2018 at 23:08
  • 1
    \$\begingroup\$ @DMGregory On a real torus, the inner circumference is smaller than the outer circumference, significantly so if the thickness is non-trivial (or, in this case, if the width of the rectangle is similar to the height, which it usually is.) There's no way to turn a rectangle into that, whereas you can trivially wrap a rectangle around a cylinder and make it work. \$\endgroup\$ Commented Oct 20, 2018 at 23:25
  • 2
    \$\begingroup\$ The same goes for any cylindrical projection of a sphere — the circumference of a line of latitude should get smaller as we approach the poles, but in many common map projections we use for the Earth (including Equirectangular or the Mercator projections popular in mapping apps like Google Maps) they're drawn all the same width. That doesn't mean they no longer correspond to the actual Earth, just that the correspondence function involves a variable scaling factor. \$\endgroup\$ Commented Oct 20, 2018 at 23:29
  • 1
    \$\begingroup\$ @DMGregory Sure, but in-game, in game-mechanical terms, no such scaling factor ever appears. For example, in the Civilization games, it takes just as many turns for a unit to circumnavigate the poles as the equator. Likewise, in a Final Fantasy game where the map wraps along both edges, the amount of time it takes to fly around the world on your airship remains constant no matter what latitude or longitude you're at. (Also, if it were an actual torus, there would be places where you would look up and see land. This never happens.) Therefore, impossible geometry, not a real torus. \$\endgroup\$ Commented Oct 20, 2018 at 23:53

3 Answers 3

20
\$\begingroup\$

Because spherical maps, compared to rectangular ones, create a lot of additional complexities regarding the technical implementation and the UI design while usually offering very little gameplay advantage.

First, there is the technical problem. With a rectangular map, you just use a 2-dimensional array to represent map positions. But unfortunately there is no proper way to map a 2-dimensional plane to a 3-dimensional sphere. So if you want your world to be tile-based, then that is usually incompatible with a spherical world (unless you are willing to accept some weird artifacts). And even if your game mechanics are not based on tiles: common tasks which are trivial on a plane, like measuring distances, calculating angles or detecting collisions between geometrical shapes, become a lot more complex when you are doing them in a spherical coordinate system.

The science of doing geometry on curved surfaces is called Non-Euclidean Geometry. If you want to dive deeper into the mathematical details, then this would be the search term to start your research with. But be warned: It drove various mathematicians crazy for over a millennium.

Then there are the UI problems. There is no good way to show the player the whole globe at once. The player can only see half of the game world at a time, and everything near the edges becomes distorted. Also, globes are difficult to navigate. If you let the player rotate the globe around the world axis', you encounter gimbal lock around the poles, which results in very awkward controls. If you let the player rotate the globe relative to their viewport, then the globe will end up in strange orientations and the player gets disoriented. A plane is usually far more intuitive for the player.

This UI problem is so prevalent that even real-world applications where it is important to remember that the Earth is round still often decide to visualize the Earth as a distorted plane instead. Like NASA mission control software, for example.

But dealing with those complications would be worth it if a spherical game world has a notable advantage over a rectangular one. But there are very few game concepts where the shape of the world would make a big difference.

If you wonder if the game you are designing right now should have a truly spherical map or if a planar map would suffice, ask yourself this: Do you have any game-mechanical reason besides "realism" why you want the map to be a sphere? If you can't think of any important game mechanic which would require a sphere and couldn't work on a plane, then do yourself a favor and don't torture yourself with trying to pull this off.

\$\endgroup\$
2
  • \$\begingroup\$ Beyond the topology considerations it's also quite common that physics or gameplay code relies on a constant "up" direction, while for a spherical world "up" becomes "away from the planet center at this specific point", which might need some in-depth adaptations \$\endgroup\$ Commented Jan 21 at 12:33
  • \$\begingroup\$ Among the games I can think of with spherical worlds (e.g., Dyson Sphere Program, Kerbal Space Program, Super Mario Galaxy), a common element is leaving the surface of the planet. A 2D plane is often just fine for representing the 2D manifold of a world's surface, but this no longer works well when the surface exists in a true 3D space. Agree that oftentimes when spherical worlds are used, they're downright necessary to the gameplay. \$\endgroup\$ Commented Jan 23 at 16:01
4
\$\begingroup\$

For anyone considering this...

A tile-based spherical world is possible, but you need to carefully consider the topology of your world sphere. And you need to decide what to do about the poles of the topology.

For example, there is a rather neat Catalan solid called the Rhombic Triacontahedron, which would give you a "globe" with each face being a rhombus of the same dimension. You can use this polyhedron's topology, but make it more spherical. The way to achieve this is by subdividing the faces into smaller rhombi, and then spherizing the whole mesh again. This results in a higher count of rhombic faces and thus a higher-resolution spheroid.

Comparison in Blender, of a rhombic triacontahedron, with and without subdivision and spherizing Above: A rhombic triacontahedron created in Blender (using "Extra Objects": Add → Mesh → Math Function → Regular Solid)

Then you can consider each subdivided rhombic region to be its own x/y grid.

Put them together, and you've got a continuous world.

Where it gets tricky is that the fundamental rhombic topology has twenty 3-poles and twelve 5-poles (30 faces), which are illustrated by the red seams I've marked in the GIF. So where those meet, your illusion of a rectangular grid falls apart, as it becomes noticeable that the neighboring quad is angled. How to work around this? You can either model the structures on your world a little off-grid in those areas, so they retain the appearance of continuity, or you can do some refraction-like fakery with the render engine to render each rhombic region as if it's actually a square grid - and then hide each pole by covering it with impassable geography (mountains?).

Should you decide you want to make an epic LoD "zoom-out" into space, that will probably require additional planning and testing.

As fun as the rhombic triacontahedron is conceptually with its unique uniformity of faces, the skewed grid shape and the large number of poles in the topology make it somewhat less than ideal. What might be a better option is the "roundcube". A roundcube is simply a spheroid with the topology of a cube. It has only six face regions, and eight 3-poles. Many readers are probably familiar with it, as it is a common shape for 3D modelers to use. The faces at each of those poles have noticeable distortion, where they get pinched in one corner. But that's not a deal-breaking limitation.

Comparison in Blender, of a roundcube, with and without subdivision and spherizing Above: A Roundcube created in Blender (using Add → Mesh → Round Cube)

Either way, expect experimentation to be required. And maybe a little clever math, so that the world renders correctly (and physics of projectiles etc behave correctly) at the poles. But it's certainly possible, given that the topologies I mentioned allow for sectioned x/y grids to be mapped onto them. And when dealing with something the scale of a planet, the vast scale may make it easier to conceal any anomalies that might crop up at the poles. After all, those are really tiny points in the global scale of things.

\$\endgroup\$
1
\$\begingroup\$

They are rare because the coders are unimaginative, or scared of the geoemtry of it all.

A game that uses spherical worlds is Super Mario Galaxy. So, I’m a Nintendo fanboy LOL

You can use spherical triangles, made up by a convex hull of a set of points in 3 dimensions. If you prefer hex-based maps, you can instead use the dual to the triangular mesh: a Voronoi diagram, which is made up mostly of hexagons, sprinkled with some pentagons and heptagons. The entire C++ code is at: https://github.com/sjhalayka/spherical_triangle

Here we show the Delaunay triangulation of a set of points on a 2-sphere. We used spherical (curved) triangles. The points have gone through many iterations of repulsion, to spread the points out more evenly.

![Spherical triangles

Here we show the dual of the Delaunay triangulation -- the Voronoi diagram. We have drawn the edges of the pentagons-hexagons-heptagons in orange. These n-gons can also be drawn using spherical triangles, if one goes with the hex method.

Dual

I used TetGen to do the triangulation and Voronoi diagram generation. It's extremely easy to use this TetGen software library, once you get the hang of it. If the end shape is reminiscent of a soccer ball, it’s because they both follow the same mathematical pattern, in regard to Euler’s formula: vertex count - edge count + face count - 2 = 0.

As for difficulties with game mechanics, the sphere is a very special non-Euclidean shape, and it boils down to paths that lie on great circles. So it's not super difficult. Also, Newtonian gravitation is a little trickier, but not super difficult. I can provide further details if required.

Note that there are no singularities nor slightly overlapping patches, like often done in differential geometry. This is the beauty of discretizing the 2-sphere.

Dual, where the number of points equals 500

Curved hexagons, etc:

enter image description here

Determining neighbours is relatively easy:

enter image description here

The Americas:

enter image description here

\$\endgroup\$
10
  • 1
    \$\begingroup\$ This does not appear to answer the question "why are spherical worlds so rare?" / "What difficulties does attempting to build a spherical world map for a video game raise, that it's so incredibly rare to actually see it done?" \$\endgroup\$ Commented Jan 22 at 0:17
  • \$\begingroup\$ That's the thing... it's not difficult at all. It's rare because people have no imagination. \$\endgroup\$ Commented Jan 22 at 0:22
  • 4
    \$\begingroup\$ If that claim is your answer, you can add it to the body of the post. I don't expect "game developers have no imagination" will go over super well in a community of game developers, though. 😜 \$\endgroup\$ Commented Jan 22 at 0:26
  • 2
    \$\begingroup\$ I like your answer, so please don't delete it. The screenshot is helpful, so that's a start. But the answer still feels incomplete IMHO. Can you explain about "spherical triangles" and "convex hulls" and "hex maps"? How does one "use the dual to the triangular mesh"? Giving an upvote, because I like where this is going. But I hope you will expand on this answer, because in its present state it mostly raises more questions for me. Anyway, I like that you are thinking in terms of possibilities instead of limitations, and I look forward to reading more. \$\endgroup\$ Commented Jan 22 at 2:22
  • 2
    \$\begingroup\$ How do you map textures to n-gons? There are multiple shapes, seems very inconvenient to me. \$\endgroup\$ Commented Jan 24 at 6:10

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.