Non-Euclidean geometry and games
The term “non-Euclidean” is often used by gamers (game developers, journalists, etc.) to mean any kind of game where the space does not work exactly as in our world. While such games typically tend to be amazing and very fun, this is not what “non-Euclidean” traditionally means for mathematicians, for whom it has a more precise meaning, which is not “anything that is not a perfectly normal space”. This article provides a summary of what “non-Euclidean” means, and the various weird spatial experiments that can be found in video games.
Non-Euclidean geometry
The discovery of non-Euclidean geometry is one of the most celebrated, surprising, and crazy moments in the history of mathematics. It is something that many great thinkers for more than 2000 years believed not to exist (not only in the real world, but also in fantasy worlds). So many popular expositions of mathematics discussing non-Euclidean geometry have been created that the term has rightfully entered the general public conscience, as something extremely alien, important, crazy, and difficult to understand. In general, something extremely cool!
Recently, the term “non-Euclidean geometry” has been appropriated by some game developers for any kind of game space which works in a different way than ours. This is unfortunate, as players are attracted to such games, thinking “hey, at last I will have a chance to understand that weird and important thing what all these mathematicians were crazy about!”, which is nowhere near the truth —while these games are usually very cool, they are usually based on relatively straightforward concepts that have nothing to do with the original thing.
Euclid has shown how everything in geometry (Pythagorean Theorem, etc.) could be derived from a small set of very simple postulates… but there was one thing he was not happy about: his fifth postulate, which was not actually that simple: If a line segment intersects two straight lines forming two interior angles on the same side that sum to less than two right angles, then the two lines, if extended indefinitely, meet on that side on which the angles sum to less than two right angles.. Euclid believed that his fifth postulate could be proven from the other ones, and he failed, and so did many mathematicians through the ages. The mystery has been solved in 19th century.
I am resolved to publish a work on parallels as soon as I can put it in order, complete it, and the opportunity arises. I have not yet made the discovery but the path which I have followed is almost certain to lead me to my goal, provided this goal is possible. I do not yet have it but I have found things so magnificent that I was astounded. It would be an eternal pity if these things were lost as you, my dear father, are bound to admit when you seen them. All I can say now is that I have created a new and different world out of nothing. All that I have sent you thus far is like a house of cards compared with a tower. — János Bolyai
Bolyai, Lobachevsky, and Gauss have created a new world, where all Euclid’s postulates hold except the fifth, thus showing that the fifth postulate could not be proven from the other ones. Since Euclid believed that such a thing could not exist, it has been called by Gauss non-Euclidean geometry.
Today, we call this hyperbolic geometry, while (two-dimensional) non-Euclidean geometry could be hyperbolic or spherical. A sphere is curved in the third dimension; we say it has constant positive curvature. (The surface of Earth is a good approximation, though the curvature is not exactly constant: it is slightly more flat on the poles.) Euclidean geometry has curvature 0, while the hyperbolic geometry has constant negative curvature.
You can easily tell whether you are in an non-Euclidean world in the following ways:
- In Euclidean geometry, we have parallel lines which are in a constant distance from each other. In spherical geometry, they would converge, and in hyperbolic geometry, they would diverge.
- Look at the angles of a triangle. In Euclidean geometry, they sum up to 180 degrees. In spherical geometry, they sum up to more (for example, take the North Pole, and two vertices on the equator as the vertices). In hyperbolic geometry, they sum up to less.
- An easy way to tell whether a game uses truly non-Euclidean geometry is to look for rectangles. In non-Euclidean geometry there are no rectangles, anything that looks a bit like a rectangle actually has its angles smaller than 90 degrees, or its edges are curved. So, if you see rectangles, the game is (probably) not non-Euclidean.
- In Euclidean geometry, a circle of radius r has perimeter 2πr. In spherical geometry, it is 2πsin(r) (which is bounded), and in hyperbolic geometry, it is 2πsinh(r) (which grows exponentially). In a three-dimensional hyperbolic world with “absolute unit” of 1m, a ball with radius 100m will have greater volume than the observable Universe!
- In truly non-Euclidean 3D games and simulations the parallax works different. In Euclidean space, things that are far away from you (stars, distant mountains) are seen in roughly the same place as you move. This changes in non-Euclidean geometries: in hyperbolic space, everything moves, while other non-Euclidean geometries are even weirder.
Play our HyperRogue to explore a non-Euclidean world and get some intuitions about how non-Euclidean geometry works. The main gameplay is designed for the hyperbolic plane, but you can also experiment with other 2D and 3D geometries.
Manifolds
Games claiming to be non-Euclidean usually have worlds obtained by performing some kind of “surgery”: we cut some fragments (chambers) out of a Euclidean space, and then glue them together in some non-standard way. In 3D games, the place where we performed surgery typically looks like a portal, but the game may also make the surgery appear seamless. Mathematically, this is called a Euclidean (or flat) manifold (with boundary); Euclidean/flat because it is made of fragments of Euclidean space, and “with boundary” because there are typically some walls which you could not go through, and some points inside such walls could not even be modeled consistently (walls of the portals). It is also possible to have manifolds without boundary; typically these look like periodic spaces.
Such games are probably called non-Euclidean because their geometry is impossible to interpret consistently as a part of a world similar to ours. In a Euclidean world, when you go 10m, turn 90 degrees right, go 10m, turn 90 degrees right, go 10m, turn 90 degrees right, go 10m, and turn 90 degrees right, you return back to your starting point and orientation. In a manifold (and also in non-Euclidean geometry as described above) it is possible to end up in a different point. (A great example of this is the VR project Tea for God, where the VR world you are exploring is huge, while in the real world you are just walking back and forth around a small room.) It is also possible to make a loop which brings you back to your starting point inside the manifold, but would be different in Euclidean world. However, this is not what non-Euclidean geometry means to a mathematician. Surgery changes the topology of the space, but it does not change its geometry.
In a manifold you can sometimes find triangles whose angles sum up to something else than 180 degrees, or parallel lines which stop being close when one of them goes through a portal. However, in a truly non-Euclidean world, these phenomena happen even for very small triangles, and for every pair of lines. Effects like this animation could not be achieved using portals — in non-Euclidean geometry it is possible to see the whole right-angled pentagon at once, while with portals, one of the five right angles will always be hidden behind a portal.
An easy (but limited) way to implement a manifold in a game is to make invisible teleportation devices, which seamlessly teleport the player to another location which looks exactly the same. That technique works in basically any game engine (even in Minecraft). I have seen many comments under videos using this technique saying “this is not non-Euclidean, you are just using teleports!” These comments are right that this is not non-Euclidean in the mathematical sense, but using teleports has nothing to do with that. In general, I find that sentiment weird. It is the effect that matters, not how it is implemented. Any video game is an illusion, after all.
Of course we could also do this starting with non-Euclidean space, obtaining a non-Euclidean manifold. Hyperbolic manifolds are typically bounded, thus they lose their exponential growth (and, depending on the game design, this exponential growth may be a huge technical problem); however, parallel lines and triangles still work differently.
When the distance is not the Euclidean metric
I have seen some people argue that any games played on square grids are non-Euclidean. This is because, in such a game, the number of steps you need to take to reach point (x,y) from the point (0,0) is given by the formula |x|+|y| (so called taxicab metric) or max(|x|, |y|) (so called Chebyshev metric), or some other formula where the set of points in d steps is an octagon, while the Pythagorean theorem says that the distance between these two points is actually the square root of x²+y² (so called Euclidean metric). Similarly, one could say that HyperRogue is not hyperbolic, since it is a grid-based game.
In fact, we do not really need a grid for this problem: if you play a top-down game with continuous space using the keyboard, you can usually move in eight directions, so the distance will still be given by one of the formulas above. So this would make lots of games non-Euclidean.
This seems to be again a confusion arising from having several things named after Euclid. “Non-Euclidean” means that Euclid’s parallel axiom is not satisfied, not that the metric is different than the Euclidean metric. Grid-based games are not normally perceived by people as anything weird, and this is expected, as many important properties of these spaces are similar to that of continuous spaces. Parallel lines in a square grid work like in Euclidean geometry, while Great Walls in HyperRogue work like straight lines in hyperbolic geometry. A square grid grows quadratically, just like the Euclidean plane, while the HyperRogue world grows exponentially. And so on. A rather impressive phenomenon arises when you are simulating how effects spread on a square grid — for example, you are simulating heat transfer (in time 0 one point of the grid is very hot, and you let the heat spread to other points), or random walk (in time 0 there are many particles in one point of the grid, and then each of them moves randomly). Even though it might appear at the first glance that the waves should spread in square or octagonal shapes (because of the structure grid), they are in fact perfectly circular! This happens on any sufficiently symmetric grid on the Euclidean plane, but will be different in other grids!
Artists associated with non-Euclidean geometry
M. C. Escher has created many great artworks based on impossible geometries, which has in turn inspired many amazing games. If you read that Escher used non-Euclidean geometry, this is true, he did use non-Euclidean geometry in his Circle Limit series. However, if a game reminds you of e.g. Ascending and Descdending, Waterfall, Relativity, Depth, or Another World II, well, these artworks do not have much to do with non-Euclidean geometry. Commonly used terms for such spaces include impossible space/geometry or Escheresque.
Another artist commonly associated with non-Euclidean geometry is H. P. Lovecraft: surfaces too great to belong to any thing right or proper for this earth […] the geometry of the dream-place he saw was abnormal, non-Euclidean, and loathsomely redolent of spheres and dimensions apart from ours […] One could not be sure that the sea and the ground were horizontal, hence the relative position of everything else seemed phantasmally variable. […] an angle which was acute, but behaved as if it were obtuse. (H. P. Lovecraft, Call of Cthulhu) These descriptions are very vague, but they describe some of the feelings a layman has where exploring a non-Euclidean simulation quite well, even amazingly well given the fact that Lovecraft had no access to such simulations: he does mention that there is something very weird about angles in R’Lyeh, and you get this feeling in a non-Euclidean simulation, while in games using “non-Euclidean” in a non-mathematical meaning, the angles look mostly normal; they remind the player more of Escher’s impossible architectures than R’Lyeh. This article explores this in more detail.
Games using non-Euclidean geometry
Most of these are free (and also the source code is available).
- our HyperRogue (free/paid) — a puzzle roguelike taking place in the hyperbolic plane (i.e., two-dimensional hyperbolic geometry). This uses a hyperbolic plane (without any topological surgery or boundary), so its world is larger than No Man’s Sky, MineCraft, or anything Euclidean. While HyperRogue shines the most as the puzzle roguelike it was originally designed as (2D, top-down, turn-based, grid-based), its non-Euclidean engine and unique world are a great testing ground for various experiments with game genres or other weird geometries. So it can be played as, say, a first-person shooter or VR racing game in a three-dimensional anisotropic geometries.
- Hyperbolica (paid) — a hyperbolic ‘’walking simulator’’ with polished graphics and some mini-games in hyperbolic and spherical geometry (first-person shooter, racing, etc.). Works in VR too.
- Bringris (paid) — our non-Euclidean falling block game (similar to Tetris), made with the HyperRogue engine. It uses a product geometry (hyperbolic 2D manifolds stacked in a Euclidean way). Can be played in VR.
- MagicTile — like Rubik’s Cube, but in non-Euclidean 2D manifolds.
- Hyperbolic Maze — a maze in a hyperbolic 2D manifold.
- Hypernom — this small game designed for VR uses three-dimensional spherical geometry.
- Hyperbolic Games — simple games (Sudoku, maze, etc.) in 2D hyperbolic manifolds.
- Warped Mines — Minesweeper in hyperbolic plane.
- Nil Rider (VR) — a game in Nil geometry. This is a three-dimensional geometry that has no 2D counterpart — with three dimensions we can do new cool stuff! (Nil is a Thurston geometry, some people would restrict “non-Euclidean” to only hyperbolic and spherical geometry.) Works in VR too.
- Sokyokuban — Sokoban-like in the hyperbolic plane, playable in a browser. Holonomy makes it interesting. (See also this for another puzzle based on holonomy.)
- H2Snake is a hyperbolic Snake game.
- The Hyperbolic Maze Demo by Bernie Freidin seems to be the oldest hyperbolic game. There are some other old small games, like Henri’s Reef by Eric Bergstrome.
- Hexagrid, Esfera Chess, and Geodessey are 2D spherical games. Just like HyperRogue, they are grid-based games, and use the Goldberg-Coxeter construction to obtain more cells than a regular tiling would allow.
- Henry Segerman has designed several 3D printed puzzles based on non-Euclidean geometry and topology. The holonomy maze is based on the concept of holonomy in spherical geometry. There are also variants of the classic Fifteen puzzle, based on non-Euclidean geometry and topology. Our computer simulations of these puzzles, and links to Henry’s videos can be found here.
Interactive demos using non-Euclidean geometry
These let you explore non-Euclidean spaces but have no actual gameplay.
- Curved Spaces — fly through three-dimensional non-Euclidean manifolds. Probably the oldest three-dimensional non-Euclidean demo.
- Non-Euclidean VR (H3) — this is three-dimensional hyperbolic geometry. See also H2xR (hyperbolic in some dimensions and Euclidean in other dimensions), and the new version.
- Three-dimensional space — this project lets you explore Thurston geometries (rendered using raymarching) in your browser.
- Uniform Polychora — more three-dimensional spherical geometry.
- our Virtual Crocheting — a demo in three-dimensional spherical geometry.
Non-Euclidean games in development
Recently there are several cool non-Euclidean game projects in development! Hypermine and HyperBlock are very promising, but unfortunately the development is going slow recently :(
- Hypermine — this is a Minecraft-like in three-dimensional hyperbolic space. The screenshots in the Gallery are quite impressive, and the development is progressing quite well!
- HyperBlock — another Minecraft-like. The video linked shows H2xR geometry, i.e., a hyperbolic plane with the ‘z’ coordinate working in Euclidean way. Three-dimensional hyperbolic space will also be featured in HyperBlock.
- Non-Euclidean billiards in VR — the idea of mapping a real right-angled square table to a hyperbolic right-angled pentagon, or spherical right-angled triangle, is very cool!
- Spaceflux —the existing early-access version shows “fractal geometry”, but the plans in the kickstarter page mention hyperbolic geometry and even non-isotropic geometry (Solv).
In the following sections, we list games that are incorrectly called non-Euclidean. The common question is: what is the correct term, then? Well, the geometry in the game may be weird for many possible reasons, and thus, it depends on the game in question. The categories below are the suggested terms.
Games in wrapped spaces
Games in wrapped spaces are sometimes called non-Euclidean, even though it is one of the oldest tricks in game design!
- Asteroids (1979) — when you go through the east edge of the world, you appear on the west edge; similarly for north or west. This is a two-dimensional flat manifold without boundary (called a flat torus).
- Pac-Man (1980) — like Asteroids. In most versions you can only go through the E-W edge but not through the N-S edge, making it a cylinder (a manifold with boundary).
- Civilization (1991) — as mentioned above, the surface of a sphere is non-Euclidean. This is why it is impossible to make a flat map of Earth which does not distort anything. Unfortunately, most games taking place on a spherical planet do not take this non-Euclidean geometry into account; they take a flat map and pretend that this map has no distortions. Civilization is played on a cylinder (you cannot go through a pole, while in the real world, the shortest flight from Europe to Hawaii would go through the North pole). Some other games are played on flat tori, which is in some sense even more different from a sphere.
- Manifold Garden (2019) — it uses the term “manifold” correctly. I have not played it yet, it seems to be mostly a three-dimensional flat torus (i.e., a three-dimensional flat manifold without boundary), but it has some portals too.
- Tetrisphere (1997)— while the name and the presentation suggest that this game is spherical, it is actually just because of the projection it is using. (It is not possible to tile the sphere with squares, four meeting in every vertex.) Every level is a flat torus.
Games with portals
In these games, we have “portals”, which take you into another part of the world. The portals tend to be explicit: you know where the portals are and as long as you do not go into a portal, the space works in a totally normal way.
- Portal (2007) — once you place some portals, the world becomes a manifold with boundary. There are also some 2D games using similar mechanics (Portal 2D; 7DRLs by Jeff Lait such as Jacob’s Matrix and Vicious Orcs).
- Fragments of Euclid —a puzzle game in an Escheresque Euclidean manifold. Escheresque like in Escher’s Relativity or Another World: the directions are not consistent.
- More interesting portals are possible too. What if the portal is knotted or linked? What if we send a portal through its other side? What if we make non-Euclidean portals (i.e. portals in some non-Euclidean space)? Can we make portals in the shape of Möbius strips? See this thread for some examples.
Using portals to simulate non-Euclidean geometry
We can take six square rooms, and connect them with portals as if they were the faces of a cube. This way, we get an approximation of spherical geometry (as a cube approximates a sphere). You get some effects typical for non-Euclidean geometry, such as holonomy.
- Holonomy — a puzzle game based on this idea
- Topologies of Zelda has a cube like this (and also a “sphere” which is not done correctly).
- Similar constructions work for hyperbolic geometry, and for higher dimensions. However, this is a pretty bad approximation of actual hyperbolic geometry, so probably better to just do the real thing.
Games in impossible spaces
In the previous category we had games with explicit portals. A more interesting effect is obtained when the portals are not visible, producing an illusion of an “impossible space”.
- Madspace is a game from 1997 that featured such impossible space. It did use the word “non-Euclidean” in its marketing, although it did not seem to gain much popularity. Interestingly, the rendering algorithm used by first-person shooters created in these times (Duke Nukem 3D, etc.) was based on splitting the space into “rooms” and connecting them via portals, so it was quite straightforward to connect these rooms in an impossible way. However, most game developers thought of such possibility as a bug to be avoided rather than something fun.
- Antichamber — this game is probably responsible for popularizing the mathematically incorrect usage of the term “non-Euclidean”. This is mostly a Euclidean manifold (with boundary), but also exhibits some effects that would not happen in a manifold (e.g. you end up in a different place when you go some steps and back). I believe almost all the weird things in Antichamber could be (and probably have been) implemented with the teleportation trick desribed above.
- AAAAXY —the idea here is a bit similar to Antichamber, but it is 2D.
- Paradox Vector —a first-person shooter in an Escheresque Euclidean manifold. Escheresque like in Escher’s Relativity or Another World: the directions are not consistent.
- Jet Set Willy (1984) —appears to be a normal platformer, but if you try to create a map, you learn that some things do not match correctly. Three rooms on the cellar level correspond to 9 rooms on the basement level, and 4 rooms on the top floor correspond to 6 rooms on the roof. (Vertical lines diverging makes it a bit similar to hyperbolic geometry.) See this for something related.
- The VR game Tea for God (2020–2021) uses impossible spaces to simulate a large world using a small real-world space. A similar trick is also used in other VR games, e.g. Shattered Lights.
Recursive games
Some games use constructions which contain a smaller copy of themselves, or more precisely, contain themselves. This is no longer a Riemannian manifold, since we cannot uniquely define the distance between points in the space — if you go outwards, you become smaller and smaller, and thus things become larger and larger in comparison. Mathematically it is called an “affine manifold” (if any affine transformations are allowed) or “similarity manifold” (if things can only become smaller or larger). Affine/similarity geometry is different than Euclidean geometry (3rd axiom becomes meaningless) but it is still not called non-Euclidean, since parallel lines are not affected.
- Maquette (2020) is a 3D example.
- Mirror stage (2009) is a similar idea in 2D.
- Patrick’s Parabox (2022) has some recursive aspects.
- Sierpiński’s Tomb (2013) is a text game based on a similar idea.
- Game inside a game is yet another one.
- Spaceflux is similar, although we also become smaller and smaller as we go inside.
- Super Hexagon and Infinite Pizza (2020) look a bit similar to Spaceflux, but they are not recursive —they do not repeat. It could be said that the gameplay in these games is Euclidean (there are two dimensions — angle and distance — which work in the Euclidean way), but rendered with a cool perspective.
- It is also possible to have portals where one end is a square and the other end is a rectangle, causing the objects to be stretched by portals (see also my old demo based on a similar idea).
- Fractality is also vaguely similar.
- We could make this actually non-Euclidean by changing the metric — see non-Euclidean recursive house.
Relativistic games
Relativistic games are based on Einstein’s special relativity theory, which is in turn based on Minkowski geometry, which is different from Euclidean geometry, and is related to hyperbolic geometry. Possible velocities of objects could be said to follow the rules of hyperbolic geometry — which is why you cannot go faster than light. These effects happen in our world but we normally do not move fast enough to see them, unless we simulate a universe where we can easily reach relativistic speeds, as in the following games.
- Velocity Raptor is a 2D relativistic puzzle game.
- A Slower Speed of Light is a first-person 3D game that shows various visual effects of relativity.
- our Relative Hell includes a multidirectional shooter in Anti-de Sitter space, and a bullet hell game in de Sitter space. These are the relativistic analogs of hyperbolic and spherical geometry.
Other notable games which are geometrically weird
- Four-dimensional games. Some people may think of these games as non-Euclidean, because four spatial dimensions would not fit in our three-dimensional world. However, a world which works just like our old three-dimensional Euclidean space, except that it has more dimensions, is still definitely Euclidean (according to definition). It is of course possible to have a four-dimensional non-Euclidean space, but at the time of writing, it appears that no game tried to implement this.
- Perspective tricks, such as Fez, Echodrome, Monument Valley, Naya’s Quest, or Perspective. Superliminal has some perspective and “affine manifold” aspects. These games are weird and cool, but should not be called non-Euclidean either. I would call some of them Escheresque.
Related Videos
No time to play games? Videos are great too!
- Geometry Center videos (1991) — Not Knot is a classic video featuring computer visualizations of non-Euclidean 3D geometry. (This video from 1977 without computer visualizations is also quite funny.)
- Henry Segerman has lots of great videos on his channel (some are based on non-Euclidean geometry and some are not, but all are great). See e.g. non-euclidean virtual reality.
- Most videos on our channel feature non-Euclidean geometry, some do weird things with topology too. Recently we have created some explanatory videos (Portals to non-Euclidean geometry featuring non-Euclidean geometry and portals, and Nil geometry explained! featuring Nil geometry and impossible triangles/staircases), but see all of them!
- CodeParade has created a viral video Non-Euclidean Worlds engine — this starts with Circle Limit by M. C. Escher, which is indeed based on non-Euclidean (hyperbolic) geometry. However, the most of the video presents a plain old affine manifold with boundary. The later Hyperbolica dev blogs of course use non-Euclidean geometry, and are the most visually polished ones (Non-Euclidean geometry explained and Spherical geometry is stranger than hyperbolic).
- The history of non-Euclidean geometry by Extra Credits explains the history of non-Euclidean geometry quite well.
- “No! Euclid!” GPU Ray Tracer gets an upgrade! — this is quite interesting, because this is indeed a curved space, not based on surgery. (Although it is sad that quite a lot of cool videos/prototypes remain just videos/prototypes…)
- In early 2021 we see an influx of “non-Euclidean Minecraft” videos. These videos are usually made with the “non-Euclidean Minecraft mod”, which is not an actual name of the mod, but rather they are using the Immersive Portals mod (which allows constructing portals and impossible spaces) and/or the Pekhui mod (which, in combination with Immersive Portals, allows constructing recursive spaces and similarity manifolds in general). It appears that they use the term “non-Euclidean” because of “non-Euclidean Worlds engine”, and because they think that they get more viewers this way (which does not seem to be actually true —lots of people are confused by this). Sometimes the youtubers clearly do not know what non-Euclidean means at all (for example, the only weird phenomenon is that the chickens are huge).
Thanks to Henry Segerman for suggesting improvements, and to all the developers who try to create these mindbending geometric experiences!