51
\$\begingroup\$

I understand the advantage of hexagonal tiles over square ones. But why aren't octagons used instead? I would think they would provide better, more natural movement in eight directions.

I was thinking about using that kind of map in some game, but I haven't seen any games using it, so I wonder if I missed something obviously flawed about using it?

\$\endgroup\$
7
  • 64
    \$\begingroup\$ Octagons don't tile. \$\endgroup\$
    – jmegaffin
    Commented Apr 17, 2013 at 21:37
  • 3
    \$\begingroup\$ I wonder if there are any other shapes that tile like squares and hexagons \$\endgroup\$
    – Azaral
    Commented Apr 18, 2013 at 0:30
  • 13
    \$\begingroup\$ @Azaral: There are only triangles, squares, and hexes. This has been proven. \$\endgroup\$ Commented Apr 18, 2013 at 0:46
  • 10
    \$\begingroup\$ That makes me a little sad inside \$\endgroup\$
    – Azaral
    Commented Apr 18, 2013 at 4:31
  • 11
    \$\begingroup\$ Well, actually there are tilings with other regular polygons, but only in non-euclidian geometries. You can get a regular pentagon tiling on a sphere for instance. \$\endgroup\$ Commented Apr 18, 2013 at 6:34

4 Answers 4

74
\$\begingroup\$

Octogons:

enter image description here

Hexagons:

enter image description here

The gaps in the octogons make for an unappealing game world.

Typically, if you wanted to allow for eight directions of movement, you would just use squares.

\$\endgroup\$
7
  • 48
    \$\begingroup\$ An alternative is to have your game take place on the hyperbolic plane, where you can tile with octogons: roguetemple.com/z/hyper.php \$\endgroup\$ Commented Apr 17, 2013 at 22:22
  • 3
    \$\begingroup\$ @MartianInvader How Interesting! \$\endgroup\$
    – Click Ok
    Commented Apr 17, 2013 at 22:43
  • \$\begingroup\$ "The gaps in the octogons make for an unappealing game world." I wouldn't say so, I certainly see usage for a pattern like that for less visible tiling. \$\endgroup\$
    – API-Beast
    Commented Mar 22, 2014 at 1:56
  • 1
    \$\begingroup\$ True enough, "unappealing" is the wrong word. I should say, the non-uniform structure introduces additional complexity for both the end user (who might have a hard time getting used to such a structure) and for the developer, who will likely find it more challenging to code for. \$\endgroup\$
    – House
    Commented Mar 22, 2014 at 2:02
  • 5
    \$\begingroup\$ The octagonal pattern with gaps is equivalent to a square pattern without diagonal movement, visually rotated 45 degrees! (And if you fill the gaps with square tiles, it's a square pattern with diagonal movement, but weirder) \$\endgroup\$ Commented Aug 18, 2015 at 11:18
75
\$\begingroup\$

To summarize and elaborate upon what has been said in other answers and in comments, triangles, squares and hexagons are the only mathematically possible regular tilings aka regular tessellations of the Euclidean plane. So yeah, this sucks. Triangles are completely useless here, squares suck because you can't move diagonally without having a somewhat unwieldy factor of 1.4142135623730950488016887242096980785696718753769480 ... give or take; and hexagons suck because you can't even move straight in both directions. Don't get me wrong, I still prefer them over squares within the constraints of the crappy reality mathematics left us with and go Civ5 for finally switching to hex grids. But still, if it were possible to tessellate with octagons, nobody would ever take a second look at hexagons.

You could say "Well, I don't care if there are gaps. I just pretend they aren't there." You'd get the truncated square tiling which is called square tiling not because there are little square gaps but because those octagons are in fact just glorified squares in terms of tiling the plane. Those little squares are what's left from truncating the corners off the squares that would actually tile the plane and in game terms, the reason to not use squares in the first place was to have an equal distance for straight and diagonal moves and this is what you don't have here. Diagonal moves have to bridge the same distance between tile centers as they would with square tiles. Conversely, if you pretend your magic digital space had actual holes, you can of course do that but what's the difference from just using square tiles and making diagonal moves just as expensive as straight ones?

truncated square tiling

Now this all wouldn't be so bad if there were really good alternatives that aren't Euclidean. Often, our grid is on some kind of planet anyway, so why not use an elliptic geometry, i.e. the surface of a sphere? Unfortunately, spheres are even much, much worse when it comes to regular tilings. Where in the plane you can at least use as many or as little tiles as you like, on spheres there are five arrangements, the Platonic solids. That's it. And only two of them don't use triangles. https://en.wikipedia.org/wiki/Spherical_polyhedra

However, the hyperbolic plane really rocks when it comes to tessellations. There aren't just three, in fact there's an infinite number of regular tessellations, including an octagonal one.

octagonal tiling in the hyperbolic plane

The only problem is that the hyperbolic plane isn't something as nice as a flat surface or a sphere but basically the surface of a Pringle. You'd need one hell of a story hook to justify a game on a Pringle ;)

hyperbolic paraboloid

Still, the octagonal tiling is so elegant and the Poincaré disc looks so awesome that I'm really surprised it's almost never been done (previously I said "never been done" here but then I read MartianInvader's comment pointing to HyperRogue).

Implementation-wise, while I've never done it myself, it should be fairly straightforward to implement this with today's 3D architectures, since a Poincaré disc view can be constructed by putting everything on the surface of a hyperboloid and doing a perspective projection (see Relation to the hyperboloid model).

construction of Poincare disk

Just one more thing to conclude this, in case you think about doing a grid-based space game and going to three dimensions, hoping that things might look rosier there ... better just give up. Not only would you need a regular convex polyhedron with 14 faces which doesn't exist, the only way to tessellate 3D Euclidean space with regular convex polyhedra is with cubes. Booooring. In hyperbolic space you can at least get something vaguely like the analogon to a hex grid by tessellating with dodecahedra (i.e. 12-faced polyhedra; that's almost 14, right?) but now you're in total brainfuck land and still haven't got the counterpart to an octagonal tiling:

Hyperbolic orthogonal dodecahedral honeycomb

Beautiful as hell? Oh my God, yes! Would I panic beyond measure if alien spaceships came after me in this and I was expected to react in a sensible way? You bet I would. This is probably the reason why most people just use either cubes or hexagonal prismatic stacks.

cubic honeycomb hexagonal prismatic honeycomb

\$\endgroup\$
13
  • 13
    \$\begingroup\$ Pro tip: if you feel like being elected official ruler of the nerdiverse, make a Dwarf Fortress in a dodecahedral honeycomb in hyperbolic space. If you don't want anyone to challenge you for that title ever again and also make the Vulcans land and offer their submission under your rule before we even invent the warp drive, write it in an according Funge dialect (quadium.net/funge/spec98.html). \$\endgroup\$
    – Christian
    Commented Jan 4, 2014 at 23:19
  • 3
    \$\begingroup\$ 3D does have a regular analogue of the hex grid, namely the FCC lattice, whose unit cell, the rhombic dodecahedron, is a Catalan solid (i.e. all its faces are identical and symmetric, even though not all the corners are). Haven't seen many games using it, though. \$\endgroup\$ Commented Jan 5, 2014 at 2:26
  • 1
    \$\begingroup\$ @TobiasKienzler Despite what I said in the answer, that would be pretty awesome. If a game isn't able to rewire our brains to comprehend 3D hyberbolic space, then what is? :) \$\endgroup\$
    – Christian
    Commented Jan 14, 2014 at 20:05
  • 1
    \$\begingroup\$ @TobiasKienzler Isn't the 4D Rubik's cube missing from that list? Anyway, Adanaxis sounds gleefully insane. As for higher dimensions, geometry becomes surprisingly boring in higher dimensions: en.wikipedia.org/wiki/List_of_regular_polytopes#Tessellations It really boggles my mind. I would expect there to be more degrees of freedom so more polytopes and stuff. But no. Even hyperbolic space that has that infinite number of tessellations in 2D space goes down to 0 in dimensions >5. Euclidean space retains its cubic tessellation in all dimensions. \$\endgroup\$
    – Christian
    Commented Jan 15, 2014 at 10:25
  • 5
    \$\begingroup\$ +1 for "You'd need one hell of a story hook to justify a game on a Pringle." \$\endgroup\$
    – Zack Brown
    Commented Mar 21, 2014 at 12:49
31
\$\begingroup\$

The author of HyperRogue here.

HyperRogue actually uses a tesselation made of hexagons and heptagons, here is the reason why this particular tesselation has been chosen, instead of only octagons or heptagons, for example: Hyperbolic geometry in Hyperbolic Rogue Basically, the octagons are too big.

Screenshot HyperRogue Numbered Screenshot

Also some consequences of using hyperbolic geometry in a game (what works in hyperbolic and do not work in Euclidean, and vice versa) are listed in that post.

And yes, as Christian guessed, HyperRogue internally uses the hyperboloid model.

I am not allowed to comment on Christian's answer, but there is a tesselation of the 3D space with 14-faced polyhedra: Bitruncated Cubic Honeycomb (why 14 faces, anyway?)

\$\endgroup\$
14
  • \$\begingroup\$ Damn, only now saw your post. Yeah, I overlooked the bitruncated cubic honeycomb but Ilmari Karonen was also nice enough to point me to it. Really nice work you did with HyperRogue BTW. Any chance you'll be adding Ouya controls to it? :) \$\endgroup\$
    – Christian
    Commented Feb 14, 2014 at 14:18
  • 2
    \$\begingroup\$ I got confused again. The bitruncated cubic honeycomb is not made up of regular polyhedra, i.e. not all faces are the same. The honeycomb Ilmari Karonen mentioned is made up of dodecahedra, i.e. 12-faced solids, that's why it's sort of the analogon to the hexagonal tiling: it works but it doesn't have the 14 directions you'd want (six "straight" directions for each face of a cube and eight "diagonal" ones for each vertex). The bitruncated cubic honeycomb is the analogon to the flat octagonal tiling: it works, but it doesn't have any advantage over a cubic honeycomb for game grids. \$\endgroup\$
    – Christian
    Commented Feb 18, 2014 at 17:04
  • \$\begingroup\$ I added a screenshot so you could understand the tiling. However, maybe it's just me but I found it really hard to even see how many vertices each tile had. So I put the numbers of vertices in each of the tiles (well, not all of them actually) and suddenly the pattern became clear: it's overlapping circles of hexagons with heptagons in the middle. Hope it's ok that I messed with your answer, @ZenoRogue and sorry if I'm just slow with these things and y'all got it right away. \$\endgroup\$
    – Christian
    Commented Mar 21, 2014 at 15:38
  • \$\begingroup\$ Thanks! What does it take to add Ouya controls? There is already an Android port, and joystick controls (for the Pandora console), so Ouya controls should be easy to add, although hard for me to test. \$\endgroup\$
    – Zeno Rogue
    Commented Mar 24, 2014 at 20:27
  • 1
    \$\begingroup\$ I think we would actually require 26 directions, not 14 (6 "pure" directions, 12 combinations of two (non-opposite) pure directions, and 8 combinations of three pure directions). The bitruncated cubic honeycomb uses 6+8 (corresponding to faces and vertices), and rhombic takes the other 12 (corresponding to edges). \$\endgroup\$
    – Zeno Rogue
    Commented Mar 24, 2014 at 20:28
10
\$\begingroup\$

Basically what you want is a monohedral tesselation (or tiling), that is a coverage of the entire plane (assuming 2d) with a single shape where the tiles do neither overlap nor leave gaps.

There are lots of shapes with which this can be done but when we introduce other constraints, usually orientation should stay the same or they should conform to a natural movement direction, basically only squares and hexagons remain.

Take the triangle for examples (which you might know from the tesselation of 3d objects). To fill the gaps between two triangels another triangle has to be inserted, but flipped upside down. This is obviously a hassle to generate when dealing with sprites for example since a seamless connection is important. Also triangular movement sucks.

The most natural, with regard to movement at least, is the square which happens to be the most frequently used. Hexagons are the next best thing and allow for more direct approach to a higher number of movement directions, i.e. not over the corner movement like 8-way movement on squares does. Usually they are used in more tactical games where the increase in movement is important.

Anyway, if you want to read up more, take a look at http://euler.slu.edu/escher/index.php/Tessellations_by_Polygons.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .