# Solution: The Globe in Civ V, a really spherical map with only hexagonal tiles!

Status
Not open for further replies.

#### orthoceros

##### Chieftain
I am a theoretical physicist specialized in complex systems. I am also a fan of the Civ series; actually Civ I was my first computer game ever. It is better than Chess! I have waited for a really spherical Earth map since then. So let&#8217;s try to finally realize it:

Goals
• Make it possible to play Civilization on a really spherical planet. Get rid of the unrealistic cylindrical or donut maps and open a new strategic dimension by allowing units to move over the poles.
• All map locations will be locally strategically identical, i.e. each tile will have the same number of direct neighbours.
• Most algorithms of the game engine for 2D hexagonal maps can be reused 1:1 on the spherical map. Only exception: The path finding algorithm and the distance-in-tiles algorithm need to be adapted for an octahedron base geometry. With these exceptions and from a coding perspective, the only necessary changes are of purely graphical nature.
• The distance-in-tiles around the equator will be the same as for the circle through the North and South Pole. On the Earth map, all local artifacts will be placed either in ice (at the poles) or in the oceans.
Problems
• The Civilization game mechanics require that the map is discrete, i.e. consisting of a finite number of tiles. A continuous distance/area tile-less Civilization engine is not available today.
• All tiles must be equal and have the same amount of neighboring tiles, because else not all locations would be strategically identical, which would be weird from a player&#8217;s perspective.
• Even if one allowed for e.g. a few pentagons in a map otherwise consisting of hexagons (which has been discussed in other threads on this forum), it would be complicated to adapt all algorithms of the game engine so that they can cope with these irregularities.
• The central problem is: It is mathematically impossible to tessellate the surface of a sphere with only hexagonal tiles (or with only n-gons for arbitrary n&#8805;4). For more information on this, have a look at http://en.wikipedia.org/wiki/Tessellation and http://en.wikipedia.org/wiki/Platonic_solid.
Solution
• From a mathematical perspective the solution is to allow some tiles to slightly overlap. (&#8220;It is not possible to tessellate the sphere with only hexagons, but a bit more than just the sphere is again possible.&#8221
• Using an octahedron as base geometry, we will only need overlapping tiles at the North and the South Pole and at four equidistant locations around the equator. On the earth all of these artifacts can be placed either in ice (at the two poles) or in the oceans.
• At each of these locations 4 hexagons overlap a bit, but the centers of these four tiles are still free of any overlapping. Thus the units on these tiles can be displayed just fine as on any other tile. The terrain of these tiles will need graphical blending. (The Civ V screenshots already show graphical blending for the non-overlapping tiles, so not much additional development effort is required here).
In the following posts I will show examples and explain my solution in detail:

The following introductory graphics show the whole Earth with only hexagonal tiles:
• North Atlantic view:
• North Pole view:
• Indian Ocean view:

(the Pacific Ocean view and higher resolution graphics are available from the attachment in the summary post below)

A remark on the tile resolution:
• I kept the tile resolution relatively low on purpose in order to illustrate how the map works and what the necessary artifacts look like.
• A higher resolution map can be obtained by the same construction steps. Since the geometric base still will be an octahedron, the number of artifacts is constant and does not increase with the tile resolution!

Discussion of the variations of the area per tile:
There are various methods to minimize the stress in such a map, i.e. making the area of all tiles approximately equal. I used three fast-to-calculate cylindrical deformers, which I wont detail here for simplicity. The deeper reason, why not all tiles can have exactly equal area is again a mathematical one: the base of the map is an octahedron, which then gets subdivided in hexagonal tiles and after that projected on the surface of the sphere. However, with my deformers the area of all hexagons is roughly the same: some are highlighted with their six neighboring tiles in the following image to show the remaining variations in shape and area:​
(higher resolution graphics are available from the attachment in the summary post below)

Discussion of the distance-in-tiles around various longitudes and other circles:
From a gameplay perspective only the number or distance in tiles is really important, not the area of the tiles. The distance-in-tiles around the equator and around the poles is equal (216 tiles each, highlighted in yellow).
At 45° to each of the six poles another six circles are highlighted in cyan. Note that for perfect symmetry one would have to highlight three instead of two neighboring lines of hexagons along the cyan paths (compare the North Pole detail image following in my next post); here I highlighted only two of them in order to show a path a unit could follow. Due to this slight asymmetry the unit does not travel along an exactly straight line; this geometric effect amounts to 218 tiles around the globe for the cyan circles instead of 216:
• circles square intersection view:
• circles triangle intersection view:
• circles diamond intersection view:
(higher resolution graphics are available from the attachment in the summary post below)

Detailed discussion of how the map works at its poles ("the graphical price to pay"):
• I chose the zoomed North Pole as a representative for all the six map poles with overlapping tiles; again the 90° and 45° circles are highlighted:
• Here the East representative of the four overlapping hexagons at the pole is highlighted with its six neighboring tiles. For comparison, some other groups (of seven tiles each) are highlighted, too.
Imagine units at the centers of these Sevens and their possible paths to go. Note that the overlap of the four tiles at the pole does not affect the strategy or gameplay of this position in comparison to the other highlighted regions:
(higher resolution graphics are available from the attachment in the summary post below)

Summary
To sum up, the solution is completely of graphical nature; no gameplay compromises are required for the spherical Earth map! And, maybe most important: It is very straight-forward to implement on the basis of a Civilization engine, which already works on 2D hexagonal maps. No need to tell you after this post that I REALLY want to see the globe in Civ V!

Higher resolution, lower compression images of the ones discussed and explained above as ZIP: View attachment higher resolution images.zip

(reserved)

Couldn't the innermost hexes at each distortion be made slightly larger instead, so that the edges would meet up even though the innermost edges might not correspond to the normal hexagon shape?

Hmm, I am not sure, if I understand you correctly: The four overlapping hexagons at each pole are already a bit larger than the surrounding hexagons. So the overlap would increase, if their size was further increased.
The only mathematical alternative to overlapping tiles, under the side condition to keep every tile strategically idendical (i.e. having six neighbours), would be to tesselate the sphere with some holes. This solution is equivalent to the one presented and can be obtained easily by shrinking the four overlapping tiles until the overlap vanishes. The resulting hole at the pole would be a square. The movement semantics would then be to "jump over this square hole". This was actually my first solution, but I disposed of it, because it looks worse than its dual with overlapping tiles.
Also, don't forget that in the actual realization graphical blending would be used in the overlapping regions, so the terrain, for example, will not look distorted at all.

The tiles aren't all strategically equivalent:

I'm assuming the tiles you are overlapping are neighbours (otherwise these would get fewer than 6 neighbours, and wouldn't be strategically equivalent to the others).

Pick a tile which is part of one of these overlapping regions. It will then have 6 neighbours (tiles of distance 1 to it), but only 10 tiles of distance 2 from it and only 14 distance 3 tiles. For "normal" tiles (those far enough away from these overlapping ones), these numbers are 6, 12 and 18.

edit: Just to add, you won't get an as efficient implementation of such a map as this, given that the neighbour relations aren't equal across the whole map. I agree, though, that it is doable, but so is using the 12 pentagons.

Your solution create a situation in which at each of your exceptional point there are four instead of 3 tiles that meet in a vertex. Does reinstates to old ambiguities related to vertices where 4 tiles meet, which defeats the point of going to hexes. If that is your solution, you might as well use a square tesselation of a cube.

In my opinion vertices where 4 tiles meet are much more of an strategical issue then tiles with an irregular number of neighbours.

You could of course resolve this by replacing the four pentagons meeting in each exception point (yes they are just pentagons where you can move across one vertex to create an extra neighbour) by two hexes and two pentagons, but then you are back to the twelve pentagon solution.

@eireksten: This is unfortunately correct. The the k-neighbourhood of the overlapping polar fields for k>=2 is not identical, if compared with non-polar tiles. I fear that there is no solution for this with an octahedron base geometry (correct me, if you see one!). I will soon update the text above to only "locally strategically identical". arrrg!

@Trias: I see that you can transform my solution in the twelve-pentagon-solution by arbitrarily choosing two of the four overlapping hexagons at each pole and replacing them by pentagons. The result would however be even locally strategically different. I do not understand what you mean with "does reinstates to old ambiguities related to vertices where 4 tiles meet". What ambiguities or strategical issues do you see exactly?

I do not understand what you mean with "does reinstates to old ambiguities related to vertices where 4 tiles meet". What ambiguities or strategical issues do you see exactly?

I'm guessing he's referring to the fact that the distance between the center of two adjacent hexes are no longer equal (as you will now be "crossing" the vertex). This is one of the problems switching to hexagonal tiling is trying to solve. You should no longer be able to take "shortcuts" by travelling through the vertices (like diagonally on squared tiling as in Civ4).

Ahh, he means the difference between the distance-in-tiles and the distance on the map. On the squares map this was always a factor of sqrt(2), if you compared diagonal versus horizontal/vertical movement...

Well, this usually is no problem for any spherical map by virtue of the sphere: Once all tiles are roughly of equal area, such a discrepancy cannot accumulate as it does in 2D. As I have shown above, the real distance and distance-in-tiles around the globe (yellow circles) has the desired ratio of one and is thus intuitive. Also, the distance between the centers of all tiles is roughly the same here.

You should also note that the 2D hexagonal map does not solve this discrepancy; it is just much better than with squares. The following 2D picture illustrates this (compare the distance-in-fields of the highlighted paths from the center to the outer cirlce):

Nice work.

It seems a workable solution, even with a few flaws. One question though; I assume it adapts to multiple map sizes without too much change of any factors?

You put a lot of effort into this and the models look cool; I'm not convinced this is better than the Pentagon solution though? (works for arbitrarily large sphere, just has a few pentagons sprinkled around the map)

I do want more spherical maps, certainly civ IV toroidal was awful and just regular cylinders better for me. But also I really wouldn't even mind just cheating and cutting out/somehow overlapping tiles when you get to the North/South Poles. Otherwise keep a perfectly 2D map that just gets thinner in radius as you go up/down...and at some point where in the gameworld it's all ice tiles anyway just cut it off to have like 5 tiles at the top, connected to each other so you could travel over the poles.

@Camikaze: Thank you. Your resolution question: The construction process starts with one of the eight triangle faces of an octahedron. This triangle can have arbitrary hexagonal resolution. Since this initial resolution does not change the symmetry, everything else does not need any parameter update (e.g. the deformers, which later care for all tiles having roughly the same area). Also, the number of places with overlapping tiles (6) is constant and independent of the map resolution. The process could certainly be automized, but I have not done this. It takes a few days to process all construction steps manually with a 3D program, especially the inital hexagonal polygon mesh of the triangle and melting eight triangles to an octahedron...

@Earthling: Thank you, too. I thought it would be better than the pentagon solution for the following reasons:
• you only have six locations with artifacts, not twelve
• every tile is a hexagon and has six neighbours (even if the k-neighbours for k>=2 are different for the polar fields, you at least do not need different keyboard controls for unit movement)
• the pentagon solution usually uses an icosahedron as base geometry; the resulting pentagons thus cannot be placed at the North/South Poles and around the equator, but have 60° angles between each other, if I recall correctly. I think for a planet, the locations at the Poles and at 90° around the equator are more natural and make it easier to put all artifacts in ice regions or on oceans, especially for the Earth map.
About your second paragraph: I also like the idea of having artifacts only at the North and South pole, but I am quite sure that it is unfortunately impossible, if you also want that all tiles maintain roughly the same area: Imagine a cylinder consisting of hexagonal tiles (except the caps, which will become your two artifacts at the poles). If you now spherify this cylinder (as Civ IV does a bit when you zoom out), then you will always have exactly the same amount of tiles around e.g. the North pole than you have around the equator, which is counter-intuitve, because the real distance of the equator is much larger.
Having only "like five tiles at the top" around the North pole will make it necessary to somehow loose tiles on your path from the equator to the pole, without the introduction of additional artifacts. I don't know how. I think, this comes down to the interesting question, if you could tesselate a cone without its apex with only hexagons, somehow mirror and melt it at the equator without artifacts and then spherify it again... i fear the "without artifacts at the equator" part is impossible here.

Actually, this is a specific case of the pentagon solution where the pentagons are paired up. This slightly reduces the irregularities but also increases the differences in area size.

Great images though.

@Ribannah: First of all, thank you. The usual pentagon solution is based on the icosahedron: The twelve pentagons will then be located on the sphere, where the 12 vertices of the icosahedron were. Thus, they will be isolated. As you note correctly, you could transform my solution in a different 12-pentagons-solution by arbitrarily choosing two of the four overlapping hexagons at each of the six poles and shrinking them to pentagons; this will leave two hexagonal tiles at each of the six poles. However, in contrast to the isolated-pentagons-solution, only if you pair them up, you can move on to the overlapping-hexagons-solution, which I showed above. This has two advantages: It is more symmetric than the solution with paired-up pentagons (which one of the four overlapping tiles would you chose to become pentagons and why?). Secondly (and more importantly): From a player's perspective your unit will always stand on a hexagonal tile and you will always have indentical local movement options.

This is a fascinating suggestion. However, I'm wondering what it would be like to "flatten out" the hexagons. Like, when the camera is close enough, the sphere is "unbent" into a plane (like in CIV). It would seem that if you picked any normal hexagon as the centre of the unbending, most of the map would flatten just fine. Everywhere you have hexagons with six neighbours, if they were rescaled to be regular, it would turn into a plane.

So, we could feasibly "unbend" the sphere around the current location with this model, but what I can't visualise in my head, is what would happen to the overlapping hexagons. Would this work for them? Or would it leave a "hole"? Actually, is what I'm saying at all correct, or can the sphere not be unbent like I'm thinking?

Status
Not open for further replies.

Replies
9
Views
621
Replies
4
Views
761
Replies
3
Views
610
Replies
20
Views
2K
Replies
354
Views
18K