Upload
vutu
View
230
Download
1
Embed Size (px)
Citation preview
HyperRogue: Playing with Hyperbolic Geometry
Eryk KopczynskiUniversity of Warsaw, Poland
Dorota CelinskaUniversity of Warsaw, [email protected]
Marek [email protected]
AbstractHyperRogue is a computer game whose action takes place in the hyperbolic plane. We discuss how HyperRogue isrelevant for mathematicians, artists, teachers, and game designers interested in hyperbolic geometry.
Introduction
a) b) c) d)
Figure 1 : Example lands in HyperRogue: (a) Crossroads II, (b) Galapagos, (c) Windy Plains, (d) Reptiles.
Hyperbolic geometry and tesselations of the hyperbolic plane have been of great interest to mathematicalartists [16], most notably M.C. Escher and his Circle Limit series [4]. Yet, there were almost no attempts tobring more complexity and life to the hyperbolic plane. This is what our game, HyperRogue, sets out to do.We believe that it is relevant to mathematical artists for several reasons.
First, fans of Escher’s art, or the famous Hofstadter’s book Godel, Escher, Bach: an Eternal GoldenBraid [10], will find many things appealing to them. The graphical style of HyperRogue is directly inspiredby Escher’s tesselations, some of the music is based on Shepherd tones and crab canons if the gameplay inthe given area is based on similar principles. As for Godel, there is also one game mechanic reminding of alogical paradox: magical Orbs normally lose their power each turn, but Orb of Time prevents this, as long asthe given Orb had no effect. Does Orb of Time lose its power if it is the only Orb you have?
Second, we believe that exploring the world of HyperRogue is one of the best ways to understandhyperbolic geometry. In typical courses one would learn that, for example, the sum of angles of a hyperbolictriangle is less than 180, but it is not clear how this could be applicable, or what would be the effects forpeople living in the hyperbolic world; even in other existing hyperbolic games and VRs [8, 13, 17] the worldis periodic and sterile. In HyperRogue, players are led to gain intuitions about hyperbolic geometry, and topose questions about how things known from our world would work there. For example, the design of theHive, one of the lands in HyperRogue, incorporates studying war strategies, like army formations, that aremeaningful in wars taking place in hyperbolic plane.
Bridges 2017 Conference Proceedings
9
Third, we believe that game design, or creating interesting maps and rule systems for games, is also akind of art. The first version of HyperRogue had very simple rules: take Chess, but replace the “chessboard”with a tiling of the hyperbolic plane, and give just one piece to the player (player character, or PC); inyour turn you can wait, move to an adjacent tile if it is not blocked by a wall, or attack an enemy on anadjacent tile (destroying it); after your move, each enemy moves (with similar choices). Enemies do not actvery intelligently—they just try to get to the PC using the shortest possible route and do not avoid beingattacked—but they can appear in large numbers. That would not be very interesting in a Euclidean tiling, buthyperbolic geometry makes it fun—not only because it feels very different, but also because it is possible touse the hyperbolic properties tactically, to deal with large groups of enemies. On the other hand, many ofthe traditional game design techniques would not make sense in a virtually infinite world. No Mans Sky ispraised for having 1019 stars in its universe—our game has more space in 200 tiles around the starting pointbecause of using hyperbolic geometry, and one would usually go further during the game. HyperRogueexplores how hyperbolic geometry could be used for interesting gameplay, and how to deal with infinity.The basic game is grid-based and turn-based, but a shmup mode exists to explore gameplay with continuoushyperbolic space and time.
HyperRogue takes much from roguelikes, a genre of computer games that is relatively unknown to themainstream gamers [5].Roguelikes are often viewed as a subgenre of computer role-playing games (CRPGs),however, they have evolved separately from the mainstream; with their focus on gameplay requiring playerskill and positioning instead of following a pre-written story, we view them as sharing more with boardgames such as Chess than with (typically very easy) CRPGs.
HyperRogue follows the roguelike tradition of permanent failure: when one loses the game, they haveto start a new one—from the beginning, except from the fact that they have learnt from their failure, andthis knowledge stays with them. Some players might feel that their game ends when too many enemies aregenerated at the same time, which is a random event not under the control. While it is definitely possibleto fail due to bad luck, the best players complete the difficult Hyperstone Quest, which involves getting 10treasures in every land, with high probability, in roughly two hours. It may take you many tries to win thegame, but then that is because you enjoy the gameplay (otherwise you would not be playing), but you haveto learn, and learning is fun. This could be seen as a metaphor of how we learn mathematics—as shown bythe famous quotes of Euclid himself (There is no royal road to geometry) and Gauss (The enchanting charmsof this sublime science reveal themselves in all their beauty only to those who have the courage to go deeplyinto it.), we have to learn the basic stuff first, then proceed to more complicated topics. 1
Geometry of HyperRogue
HyperRogue uses the order-7 truncated triangular tiling of the hyperbolic plane, also known as the hyperbolicsoccerball tiling. One advantage of this tiling is that it it is similar in spirit to the hex tiling commonly usedin tactical games. This advantage is shared by the more regular order-3 heptagonal tiling; however, theheptagons in that tiling are very big, and less appropriate for a game. HyperRogue allows experimentingwith other curvatures—switching to the heptagonal tiling effectively increases the curvature, while replacingthe heptagons with hexagons leads to the normal Euclidean hex grid, and if we go further by replacingthem with pentagons, we get the positive curvature of the truncated icosahedron (i.e., the usual sphericalsoccerball) or dodecahedron.
The distinction between hexagons and heptagons is important in gameplay—in some sense, the hyper-bolic effects are concentrated on the heptagons. Suppose that the player character (PC) and two enemies arestanding on the vertices of a triangle in the hex grid, as in Figure 2d. We cannot attack any of the enemies,
1 The in-game tutorial serves as an introduction to hyperbolic geometry, with the challenge removed.
Kopczynski, Celinska and Ctrnact
10
a) b) c) d)
Figure 2 : Tilings. (a) truncated triangular tiling, (b) heptagonal tiling, (c) triheptagonal tilingused in the Warped Coast, (d) Euclidean hex grid.
because the other one would attack us then. We could escape, but then the enemies move parallel to us, thusrecreating the same configuration. However, if we were actually standing on a heptagon in the hyperbolicgrid, one of the possible moves will make the enemies unable to recreate the configuration, and allow us toattack them one by one. (For completeness: on a dodecahedron the enemies will capture us quickly, andon the soccerball, the only way to avoid capture is to consistently avoid the pentagons; thus, the smaller thecurvature, the easier our situation is.) This is not caused by using our particular tiling, but a general fact ofhyperbolic geometry—there is one shortest path between two points, and if one is forced to avoid that path,they must use another one, which will be an equidistant curve rather than a straight line, and thus it will belonger by a linear factor, rather than an additive constant, as would happen in Euclidean geometry. This isespecially visible in the Land of Eternal Motion, where the tiles fall after someone moves on them, so even asingle pursuer has to take another path, and thus is completely unable to pursue the PC, even though movingwith the same speed.
a) b) c) d)
Figure 3 : Curves: (a) straight lines in Vineyard, (b) circles in Hive, (c) equidistants in IvoryTower, (d) horocycles in Temple of Cthulhu.
The well known hyperbolic curves have their discrete analogs in our tiling. The distance between twotiles is the length of the shortest path between them. A straight line, also called geodesic, is a path p suchthat the distance between tiles pa and pb is always exactly |a− b|. A circle is a cycle consisting of all tiles indistance (radius) r from the given point, called the center of the cycle. An equidistant is a curve consistingof tiles in distance r from the given straight line. A horocycle is a limit circle of infinite radius—a curvesuch that every segment of it is a segment of a circle, with larger segments corresponding to greater radii (thediscrete approximation allows us to give a slightly simpler definition of the horocycle than the usual one).Two curves p and q are concentric if the distance from q is the same for each point in p.
Let ad be the numbers of tiles in distance d from some heptagon in our tiling i.e., the perimeter ofa circle of radius d. We believe this sequence has not been previously studied. The initial values of thissequence are 1, 7, 14, 28, 49, 84, 147, 252, 434, 749... and for d ≥ 5, the following recursive formula holds:
HyperRogue: Playing with Hyperbolic Geometry
11
ad+4 = ad+3 + ad+2 + ad+1 − ad, and thus ad = Θ(γd), where γ = 1+√13+√
2√13−2
4 ≈ 1.72208 ≈√
3.This γ is the fundamental constant of our tiling, as the same recursive formula eventually holds when westart from a hexagon, or include the whole area of the circle, instead of just the boundary, and thus all thesesequences are asymptotically Θ(γd); γd is also the ratio of lengths of corresponding segments of concentrichorocycles in distance d, and the limit of the similar ratio for circles and equidistants, as r → ∞. In theheptagonal tiling the respective value of γ is φ + 1 = φ2 = 2.618..., i.e., the sequence grows exactly twiceas fast as the Fibonacci sequence.
What Can We Learn, or How Does Hyperbolic Geometry Affect the Gameplay
The world of HyperRogue consists currently of about 50 different lands. Each land has a specific theme(treasure to collect, enemies to fight), and specific mechanics displaying different aspects of hyperbolicgeometry. Regular straight lines are usually employed as borders between the lands (see Figure 1a), butcurves of large radius (circles, equidistants, and horocycles of infinite radius) are used in some cases. Forexample, Camelot is a large circle without internal markings; players are required to devise an algorithm toreach the center. It is practically impossible to reach the center solely on Euclidean intuitions – by lookingat a small part of a large radius curve it is impossible to tell the exact way to the center, what is the radius,nor which kind of curve it is (their curvatures are almost equal). In a large radius curve, moving into adirection which appears promising takes one back to the edge very quickly. In other cases the consecutiveconcentric horocycles are marked, so that finding the correct direction is easy; for example, in the Temple ofCthulhu every sixth horocycle is marked. Since all horocycles have roughly the same shape, moving towardsthe center of the Temple gives the players an impression of endless descent, a bit like in Escher’s famousAscending and Descending.
A very important aspect of HyperRogue is that the number of tiles in radius r is exponential. Playersquickly learn that it is practically impossible to reach a location they have been before, unless some methodof marking the way has been used. Exponential space is not the only reason why this is difficult – the otherreason is curvature: if you move fromA toB, fromB toC, and fromC toA, the map will usually be rotated;this happens because the sum of external angles of the triangle ABC is not 360. Some time later, they mightbe surprised about one situation where they do return – going back towards the center of a large radius curve.This commonly happens in the Ivory Tower, where artificial gravity pushes creatures towards the straight linebordering the Tower; after ascending in a random way, and descending back to the borderline, one typicallylands very close to their starting point. Each level of the Ivory Tower (levels are marked with alternatingcolors in Figure 3c) is an equidistant curve, giving insight to how a three-dimensional hyperbolic space withgravity might operate – if one floor is two tiles high, and we have two points A and B on some level indistance d along the equidistant, the distance betwen the corresponding points A′ and B′ on the next flooralong their equidistant will be γ2 ≈ 3 times larger. Then, they might be surprised yet again when they finda randomly generated large obstacle on their way to the center of a large radius curve (as happens e.g. in thePrincess Quest) – even though it seems that circumventing such obstacles is impossible (trying other routespushes you back into the obstacle) this can be done with persistence.
The Yendor Quest requires one to return to a location 100 steps away, which is practically impossiblewithout devising some method (γ100 possible directions). Yendor Quest and Camelot are examples of questswhich would be trivial in Euclidean. On the other hand, in the Galapagos one receives a quest which is easyin hyperbolic plane, but hopeless in Euclidean. The player encounters a Baby Tortoise, and has to find anadult of the same species. However, each tile in the Galapagos has 21 binary environmental factors, whichchange smoothly (most of the factors are equal for tiles which are close); and for each of 221 combinationsof the factors, there is a different species. In the Euclidean world, one would have to travel Ω(
√221) tiles
to find the adult tortoise matching a random baby – and that is under (definitely false) assumptions that we
Kopczynski, Celinska and Ctrnact
12
know where to go, that each tile contains a tortoise, and environmental factors change quickly. However, inthe hyperbolic world, the task can be completed quite easily, simply by moving towards areas where morefactors match.
Exponential space is also at the core of game design of HyperRogue. The play in roguelikes and similargames progresses from easy to difficult levels; on the easy levels, the player might find some powers orresources (equipment, consumables, XP, etc.), which will be useful on later levels. In this design, unlimitedamount of space on each level leads to grinding, i.e., staying on easier levels for long times in order tocollect large amounts of resources. Allowing grinding is considered a bad design, since it leads to boringgameplay, and modern well designed roguelikes avoid this, usually by restricting the size of levels. However,HyperRogue has to take a different approach. The player’s progress and score is measured by the numberof treasures they have collected; the more treasures they have collected in a given land, the more enemiesappear in this land, thus making it harder and harder to collect more treasures. If permanent equipment orconsumables did appear on the map, it would be possible to grind; for this reason, there are no permanentor consumable resources to be found, other than treasures and Dead Orbs which have very limited uses.One possible solution which combines permanent and consumable powers with infinity is to give powersonly as extra prizes for collecting treasure – since the ability to collect treasures is limited, so are the prizes.The current versions of HyperRogue do not provide consumables in this way, but a permanent effect ofcollecting many treasures in a given land is access to magical orbs (which appear randomly and providetemporary power-ups of various kinds), and also access to more advanced lands.
Even though negative curvature is probably the thing that students remember best about the hyperbolicplane, its effect on the gameplay, or living in the hyperbolic world, appears quite limited, compared toexponential space and its consequences. One land where curvature is featured prominently is the BurialGrounds, where treasures have to be excavated using a magical energy sword. The problem here is that thesword has to be aimed in the specific direction (where the wall is soft), and the PC is unable to rotate theirsword, which just floats in the air next to the PC, maintaining its relative angle to the PC’s movement. Ina Euclidean world, the sword would always face the same direction, but here, we can use the curvature torotate the sword. Understanding that the sword will rotate when we go around a loop, and that the angleof its rotation is proportional to the area inside the loop, is essential for excavating treasures efficiently; theplayers will have to learn this to be successful in the Burial Grounds.
Procedural Generation in the Hyperbolic Plane
834
3532
431
2818
42
22 16
305 43
23
17
1338
37
27
1242
18
24
835
32
22
4 30
31
28
6 30
16
40
29
14 20
26
36
10 32
33
34
8 32
22
42
1224
38
18
15 25
4121
3913 27
43
19
37
7 28
31
17
9 35
34
33
11 23
33
32
5 29
19
43
9 21
35
34
1040
1622
20
8 42
26
20
4 31
28
18
12 38
39
36
1438
24
37
1016
22
40
6 28
29
30
18
428
18
311135
2141
32
8 26
20
34
4212 38
39
36
24
14 38
24
40
1022
3233
16
923
4327
11 21
41
17
530
2919
725
192915
37
3639
13 25
39
38
7 31
17
41
15 27
3736
1242
1824
26
1440
2026
6 29
30
16
1032
3334
832
22
351218
243842
430
3128
16
630
1640
1337
274314
20
2636
10 32
3334
832
2242
1224
3839
181525
412113
27
4319
728
311711
3332
23
93433
35
842
2620
22
1016
22
40
51731
30 23
1135
2141
32
826
2034
42
923
4327153639
25 37
71929
2813
372743
51731
30
6
1640
24
418
4222
616
4024 418
4222
1033
342014
3637
3826
123936
2613
4319
25152127
37142440 38
83435
3220
102232
33 1694327
21
103334
20
114117
2315
3639257
2928
31529
19
4330
927
21
35
133938
371539
25
41
12
3839
36
26
14
2636
37
83222
42
111723
33
72928
3152919
4330
921
3527
1020
40
1634
82242
2632
143738
246
28
2918
431
2830
54323
1719
725
1941
1224
38
39
18
630
16
40
29
52317
3143
418
42
2210
33
34
20
32
1426
36
37
83222
421224
38
39
1541
21
25
1343
19
27
934
33
23
35
531
30
17
1541
21
25
728
31
17
29
640
24
18
16
422
16
30
519
43
29
1133
32
239
21
35
34
27
1040
16
20
1343
19
25
27
934
33
23
35
842
26
20
22
431
28
1812
38
39
36
1438
24
40
37
1016
22
32
628
29
30
428
18
42
820
34
26
1121
41
17
359
23
43
27
33
1536
39
25
531
30
29
719
29
28
1337
27
43
517
31
30
640
24
18
16
442
22
16
1239
36
26
834
35
32
1034
20
33
624
18
401436
37
38
26
1236
26
39
731
17
41
28422
16
30
428
34
35
32
20
1034
20
40
618
28
29
24
519
43
23
717
41
25
1338
37
27
1521
27
37
1133
32
35
921
35
34
1539
25
41
1123
33
32
842
26
20
22
1040
16
22
1437
38
24
628
29
30
428
18
31
826
20
34
421238
39
36
24
1438
24
40
933
23
43
1016
22
32
628
29
30
428
18
42
820
34
35
26
1121
41
17
923
43
27
1536
39
25
1438
24
40 20
1319
25
39
531
30
29
719
29
28
13
43
5
30
640
24
16
442
22
16
1812
26
8
32
1034
20
33
624
18
401436
37
38
26
1236
26
39
731
17
41
28422
16
30
428
32
10
40
618
2829
24
519
43
23
7
25
13
27
935
34
21
1132
35
331040
16
22
20
826
20
42
1527
37
21933
23
43
341016
22
32
40
1121
41
17
530
29
31
1325
39
19731
17
41
28
1527
37
21
1226
42
18
361424
40
20
381226
42
18
3614
20
8
22
430
31 28
16
629
30
16
7
19
5
31
418
42
28
1032
33 34
22820
34
35
26
1141
1723
835
3222
943
27
21
5
19
13
37
1539
25 41
36
1117
2333
7
31
5
43
921
35
27
1020
40
34
822
42
26
32
1437
38
36 430
31 28
16
618
28
29
241236
26
42
39
416
30 31
741
25 19
17
543
23 17
1338
37
27
935
34 33 629
30 16
741
2519
1132
35
21
10
22
8
34
923
43 27
33
1537
3639
13
38
14
26
1218
24
42
1337
27 4338
1420
26 36
40
1525
41 21
523
17 319
35
3433
11
32
8
20
1016
22 3240
1135
21 418
34
9
27 1022
32 33
428
1842
725
1929
1537
3639
12
38 1337
27 439
33
517
31 3023
11
41
7
28
616
40 24
418
4222
832 10
33
34 20
8
42
14
3637
26
12
39
1541
21
25
1239
3626
38
1343
19 25
27
9
23
5
297
31 17
4128 1521
27 3711
35
9
43
820
34 3514
38
24 40
1319
25 3915
36 1226
42 18
4
31
6
2930
1628
7
195
31
1022
32 334
28
18 42
1226 8
20
34 35
9
27
11
41 17
21
15
257
29 28
19
9
43 27
23
530
29 19
31
4
166
28 7
17 41
31
13
3938
25
1527 37 36
21
12
42 18
26
11
41 17
2321
1536
39 25
37
1440
20 26
24
6
1610
34 8
32 22
4235
1218
24384
28 640 14
26 3620
13
27 43
1937
1525 41 21
39
9
34 33
23
7
2928
315
1731 3011
417
28 4
42 22
1618
6
4024
1810
20 1438
9
43 27
215
3029 194
4222 16
1239
36 26
14 20
8
34 3532
11
23
10
34 20
4033
935 8
26
6
2418
2814
3637 38
13 39
12
36 26
42
8
32
4
16 3022
1040 6
18 2824
7
17 41
2531
5
19 4323
29
725 13
27 9
35 34
3321
11
32 35
21
1022 8
34
13
39 38
37
15
2737
369
33 2343
5 19
13
25 39
38
12
18
14
40 20
2624
616 10 34
12
42 18
24
8
35 32
22
10 16
4
30 31
28
719
6
301629
531 4
18 4228
14
202640
10
32 33
3422
835 11 23
9
27 2143
8
32 2235
11
17 23
3341 10
20 4034
15
392536
12
18 24
3842
4
30 31
2816
629 5 17 7
25 19
29
41
6
30 16
40
531 4 22
10
33
3432
14
2636
20
8
32 22
4235
12
24 3818
13
274337
15
25 41
2139
13
27 43
1937 7
28 31
1711
33
3223
9
343335
8
42 26
2022
10
16 2240
11
1723
33
41
7
29 28
3119
5
17 31
3023
11
35 21
4132
834 9 27
15
36 39
25
37
7
19 29
28
13 43 5 30
6
40
2416
4
42
22
16
18
12
39 36
2638
8
34 35
32
6
4024
18
10
33 34
20
11 23 9 35
8
22 42
26
32
14
3637
38
12 39 15 27
13
19
25
43
12
36
26
39
15
21 27
37
41
14
24
4038
4
22
16
30
42
8
3435
32
20
10
22 32
3316
9
43 27
21
11
17
23
33
41
10
34
20
40
9
27 21
35
8
22
42
26
5
29
19
43
6
2418
28
14
36 37
38
12 39 15 27
13
19
25
39
43
12
3626
42
15 37 14 20
8
35
32
34
4
16
30
31
22
10
34 20
40
33
6
18
28
29
7
17
41
25
5
1943
23
7 25 13 27
9
35
34
33
21
11
32
35
21
10 22
8 34
923
43
33
15
37
36
27
13
2539
38
14
40
20
26
24
13
38
37
39
12
42
18
24
8
35 32
22
4
30
31
28
6
30
16
29
14
20
26
36
40
10
32
33
34
22
8
32
22
42
921
35
2715
39
25
41
12
1824
38
4
30 31
28
6
30
16
40
14
26
36
37
20
13
27
43
19
15
25 41
21
9
34
33
23
531
30
17
728
31
296
40
24
18
16
4
22
16
42
11
23
33
32
175
29
19
43
30
6
24
18
28
40
7
17
41
25
1338
37
27
39
9
21
35
34
15
39
25
41
11
23
33
32
1020
40
348
22
42
26
10
20
40
16
8
22
42
26
10
20 40
16
4
31
28
18
1238
39
36
24
14
37
38
24
15
41
21
27
13
19
25
39
1226
42
36
628
29
30
184
16
30
31
22
741
25
19
431
28
18
5
43
23
17
13
38
37
27
935
34
33
1135
21
41
32
725
19
29
15
37
36
39
1337
27
43
517
31
23
616
40
304
18
42
22
28
1033
34
32
1238
39
2414
26
36
37
208
32
22
42
35
1224
38
39
1541
21
25
1343
19
279
34
33
23
35
531
30
17
1437
38
24
3615
41
21
27
257
28
31
17
296
40
24
18
16
422
16
30
519
43
23
29
1133
32
35
921
35
34
1040
16
22
826
20
42
933
23
43
34 1016
22
32
40
1121
41
17
1319
25
39
531
30
29
719
29
28
442
22
16
624
18
28
40
731
17
41
422
16
30
519
43
23
11 32
35
33
15 27
37
21 933
23
43
1325
39
38
19
12 26
42
36 1424
40
20
1226
42
18
629
30
16
10 32
33
22
8 35
32
22
34 943
27
21
23
1117
23
33
6 28
29
184
16
30
31
1034
20
40
927
21
35
822
42
26
14 37
38
24
36
618
28
29
1236
26
42
416
30
31
7 41
25
17
5 43
23
1913
38
37
27
39
9 35
34
21
7 41
25
19
1711
32
35
21
33 1040
16
22
20
8 26
20
34
9 23
43
27
33
15 37
36
39
1325
39
38
14 40
20
26
a) b) c) d)
Figure 4 : (a) Zebra pattern, (b) Zebra, (c) Emerald Mine, (d) Dragon Chasms.
The infinite world of HyperRogue is procedurally generated on the fly. In this section we describe themethods used to place terrain features such as walls, trees, or chasms.
HyperRogue: Playing with Hyperbolic Geometry
13
Random patterns. The easiest method is to place terrain features randomly: each tile independently be-comes a wall with probability, say, 50%, thus creating a maze. This method yields much more satisfactoryresults than in Euclidean geometry (dead ends are rare) due to the tree-like nature of the hyperbolic plane.This method can be further differentiated by altering the probability, refining the results using a cellularautomaton (the Living Cave), or by placing large obstacles with smaller probabilities.Periodic patterns. Figure 4a depicts a periodic encoding, which we call the Zebra pattern. The hyperbolicplane has been tiled in a regular way with a “triangle” consisting of 7 hexagons and 3 heptagons. Triangleshave been colored into four colors, and for each colored triangle, ten codes have been given to its tiles, adifferent set of ten codes for each color. The coding is periodic, i.e., there is a subgroup HZ of the group Gof isometries of our tiling such that the set of tiles with the same code are exactly its orbits. The code foreach cell can be computed algorithmically.
A single periodic encoding can be used to create many different periodic patterns. Even though theZebra (Figure 4b) and the Windy Plains (Figure 1b) look completely different at the first glance, they areboth invariant under HZ (i.e. isometries which map the encoding into itself also map these patterns intoitself) and thus both can be obtained simply by assigning colors to codes from the encoding above. Therandom pattern mode can be used to try random invariant patterns. The Palace is based on another regularencoding derived from tiling a hyperbolic plane with circles of radius 2 (50 ·4 codes), and several other landsare based on the Emerald pattern consisting of 40 · 4 codes.
The most basic ”unit” that can tile a plane would be a triangle connecting centers of three cells at asingle vertex; such a triangle is formed by two 1/6s of a hexagon and one 1/7 of a heptagon, so the ratioof hexagons to heptagons is 7:3. Any pattern that tiles the whole plane must preserve the same ratio, andtherefore the number of cells in the pattern must be a multiple of 10.
Hyperbolic periodic patterns typically create beautiful tree-like structures. Effects of using a similarprocess in Euclidean geometry are much more trivial – we can only get a kind of checkered or stripedpattern.Fractal landscapes. The diamond-square algorithm [7] can be used to generate realistic looking Euclideanlandscapes; they could be viewed as a two-dimensional generalization of random walk, where we smoothlyassign a random value to each point in the grid 0, n2. Ideally, the fractal landscape should be a randomfunction f : Ω × T → R, where Ω is the probabilistic space and T is the set of all tiles, such that for eachisometry i of the hyperbolic plane, fi given by fi(ω, t) = f(ω, i(t))−f(ω, i−1(t0)) has the same distributionas f . As far as we know, the diamond-square algorithm cannot be easily extended to the whole plane Z2;however, we have found an efficient algorithm working on a hyperbolic tiling [19]. Fractal landscapes areused to generate chasms in the Dragon chasms, and environmental factors in the Galapagos (Figure 1c) arealso generated based on a slightly modified version of this algorithm.Combinations. All these three methods can be combined – in Reptiles (see Figure 1d) a fractal landscape isused to generate the chasms, Zebra pattern is used as a base for the tesselation, and it is randomly decidedwhich of the reptile-shaped floor tiles are actually sleeping reptiles.
Models of Hyperbolic Geometry
The game displays its world in the Poincare model by default. However, it is also possible to experimentwith many other models.
The Minkowski hyperboloid is the set of points (x, y, z) such that z =√
1 + x2 + y2; equipped withthe Minkowski metric, it is the model of hyperbolic geometry used internally by HyperRogue [19]. Poincare,Beltrami-Klein and Gans models can all be obtained from the Minkowski hyperboloid model by viewing theMinkowski hyperboloid from (0, 0,−p), where p = 0 for Klein-Beltrami, p = 1 for Poincare, and p → ∞
Kopczynski, Celinska and Ctrnact
14
a) b) c) d)
Figure 5 : (a) Band model, (b) conformal square [6], (c) the Hypersian Rug model, (d) conformal spiral.
for Gans. If we assume that the HyperRogue world is actually a three-dimensional hyperbolic space, theground level is an equidistant surface c units under some plane, and we are viewing it from a point g unitsabove the plane, this corresponds to p = tanh g
tanh c . Thus, HyperRogue’s standard 3D display, using the Poincaremodel for the ground level and intermediate values of p for tops of walls and other levels, accurately showshow the situation would look from the bird’s eye, assuming g = c = 1.
One counterintuitive property of hyperbolic geometry is that, even though it may seem that you changeyour movement direction a lot during the game, your path is actually very close to a straight line, exceptthe parts where you were backtracking to a previous location (as happens in the Ivory Tower or during theYendor Quest, for example). The band model [2] is a lesser-known conformal model, corresponding to theMercator projection of a sphere. In this model, a fixed straight line L is mapped isometrically to a Euclideanstraight line. By picking the line L to be the line passing through the starting and ending locations in thegiven game, the player can view their whole path as a single straight band. Another effect can be achievedwith the Poincare half-plane model – if L is mapped to a vertical line in the half-plane model, the wholegame can be seen by zooming the model in or out.
The Hypersian Rug model can be used to play the game on an approximate isometric embedding ofhyperbolic plane in R3, similar to what you get from hyperbolic crocheting [9]. This gives a good insightinto the curved nature of HyperRogue’s world, and how the points close to the edge of the Poincare diskare actually much further away from each other than it appears. Such embedding is shown on Figure 5c,although a static image does not do it justice – it is much better to rotate the model in HyperRogue, and evenbetter to touch a real crocheting or paper model.
Applications, or More than a Game
We believe that HyperRogue is one of the best ways to teach or learn about hyperbolic geometry. Eventhough it does not teach you any mathematical formulas, a very good intuitive grasp of hyperbolic geometrywill be necessary to achieve success in the game, as we have argued in the previous sections. Other thanthe game itself, the built-in map and vector graphics editor could be used by mathematicians and artists,e.g., to find new periodic patterns or new tesselations; this is however currently limited only to tesselationsand patterns derived from the order-3 heptagonal tiling in some way.
It is worth to mention that HyperRogue has potential applications outside of education and art. Hyper-bolic geometry has gained interest in the data visualization and network science communities. Exponentialamount of space allows to easily fit very big trees [12, 14, 11]. Hyperbolic geometry is also intrinsic in scale-free networks [15, 1]. The publicly available source code of HyperRogue contains a very rich set of powerfultools for representing, visualizing, navigating, and performing computations in the hyperbolic plane, bothcontinuous and based on the order-3 heptagonal tiling. These tools are very useful not only for games, butalso could be used as a basis of hyperbolic graph visualization software [3] or efficient implementations ofalgorithms based on hyperbolic geometry.
HyperRogue: Playing with Hyperbolic Geometry
15
Acknowledgments
HyperRogue could not achieve its current state if not for the help of its players, constantly reporting bugsand coming up with great ideas for new lands or other features. We would like to especially thank ShawnParrotte for making the music, tricosahedron and wonderfullizardofoz on Steam for many great discussionsand ideas, and Tristan Parker (Sprite Guard) for making a long series of videos about HyperRogue. The fulllist of significant contributors can be found in the in-game credits and on the HyperRogue website [18]. Thiswork is partially supported by the National Science Centre, Poland, grant DEC-2016/21/N/HS4/02100.
References
[1] Thomas Blasius, Tobias Friedrich, Anton Krohmer, and Soren Laue. Efficient embedding of scale-freegraphs in the hyperbolic plane. In European Symposium on Algorithms (ESA), pages 16:1–16:18, 2016.
[2] Vladimir Bulatov. Conformal models of the hyperbolic geometry, 2010. Available online at http://bulatov.org/math/1001/index.html (as of Jan 20, 2017).
[3] Dorota Celinska and Eryk Kopczynski. Programming languages in GitHub: a visualization in hyper-bolic plane. In Proceedings of ICWSM 2017, Montreal, Canada, May 16-18, 2017. To appear.
[4] H. S. M. Coxeter. The non-Euclidean symmetry of Escher’s picture Circle Limit III. Leonardo, 12:19–25, 1979.
[5] David L. Craddock. Dungeon Hacks: How NetHack, Angband, and Other Roguelikes Changed the Course ofVideo Games. Press Start Press, 1st edition, 2015.
[6] Chamberlain Fong. The conformal hyperbolic square and its ilk. In Proceedings of Bridges 2016: Mathe-matics, Music, Art, Architecture, Education, Culture, pages 179–186. Tessellations Publishing.
[7] Alain Fournier, Don Fussell, and Loren Carpenter. Computer rendering of stochastic models. Commun.ACM, 25(6):371–384, June 1982.
[8] Vi Hart, Andrea Hawksley, Elisabetta A. Matsumoto, and Henry Segerman. Non-euclidean virtualreality I: explorations of H3. In Proceedings of Bridges 2017: Mathematics, Music, Art, Architecture, Culture.Tessellations Publishing, 2017.
[9] D. W. Henderson and Daina Tamina. Crocheting the hyperbolic plane. Mathematical Intelligencer,23(2):17–28, 2001.
[10] Douglas R. Hofstadter. Godel, Escher, Bach: An Eternal Golden Braid. Basic Books, Inc., 1979.[11] T. Hughes, Y. Hyun, and D. Liberles. Visualising very large phylogenetic trees in three dimensional
hyperbolic space. BMC Bioinformatics, 5:48, Apr 2004. http://www.caida.org/tools/visualization/walrus/gallery1/.[12] John Lamping, Ramana Rao, and Peter Pirolli. A focus+context technique based on hyperbolic ge-
ometry for visualizing large hierarchies. In Proceedings of the SIGCHI Conference on Human Factors inComputing Systems, CHI ’95, pages 401–408, New York, NY, USA, 1995. ACM Press/Addison-WesleyPublishing Co.
[13] David Madore, 2013. http://www.madore.org/~david/math/hyperbolic-maze.html (Jan 27, 2017).[14] Tamara Munzner. Exploring large graphs in 3d hyperbolic space. IEEE Computer Graphics and Applica-
tions, 18(4):18–23, 1998.[15] Fragkiskos Papadopoulos, Maksim Kitsak, M. Angeles Serrano, Marian Boguna, and Dmitri Krioukov.
Popularity versus Similarity in Growing Networks. Nature, 489:537–540, Sep 2012.[16] Radmila Sazdanovic. Fisheye view of tessellations. In Proceedings of Bridges 2012: Mathematics, Music,
Art, Architecture, Culture, pages 361–364, Phoenix, Arizona, USA, 2012. Tessellations Publishing.[17] Jeff Weeks, 2009. http://www.geometrygames.org/HyperbolicGames/ (as of Jan 27, 2017).[18] HyperRogue website. http://www.roguetemple.com/z/hyper/ (as of Jan 27, 2017).[19] HyperRogue: programming. http://www.roguetemple.com/z/hyper/dev.php (as of Jan 27, 2017).
Kopczynski, Celinska and Ctrnact
16