Hyperbolic geometry is awesome

A spot for all things TestTube
Post Reply
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Hyperbolic geometry is awesome

Post by A Random Player »

We've probably heard of this: http://testtubegames.com/blog/friday-fun-hyper-rogue/
My favorite tiling. (My other favorite.) What's yours?

Also, how could one implement a game like Hyperrogue? I can't figure out how one would store all the tiles. (Unlike Euclidean space, where you just use an array or list of coordinates).
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: Hyperbolic geometry is awesome

Post by robly18 »

From what I know, non-euclidean space, upper dimensions, and all that stuff are only hard to conceive for us because of how our brain is wired. However, computers can do all of this at ease. It might be hard to conceive the code, but it's there. And the computer can run it just fine.

What the code is? I have no clue. Ask the computer.
Convincing people that 0.9999... = 1 since 2012
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: Hyperbolic geometry is awesome

Post by testtubegames »

A Random Player wrote:Also, how could one implement a game like Hyperrogue? I can't figure out how one would store all the tiles. (Unlike Euclidean space, where you just use an array or list of coordinates).
That's a great question -- I hadn't thought about that. Defining tiles on a standard Euclidean plane is comically easy (defined by rows and columns). Clearly Hyperrouge couldn't do that. You'd need some clever way to parametrize the world. Just like how on a sphere (if you did a tiled game on that surface), you could define tiles by their latitude and longitude, say. I have no idea off the top of my head how that developer would define locations in that world. A quick hunt for 'hyperbolic coordinates' took me here, though I'm not sure that's the right direction to take the problem.
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Hyperbolic geometry is awesome

Post by A Random Player »

testtubegames wrote:
A Random Player wrote:Also, how could one implement a game like Hyperrogue? I can't figure out how one would store all the tiles. (Unlike Euclidean space, where you just use an array or list of coordinates).
That's a great question -- I hadn't thought about that. Defining tiles on a standard Euclidean plane is comically easy (defined by rows and columns). Clearly Hyperrouge couldn't do that. You'd need some clever way to parametrize the world. Just like how on a sphere (if you did a tiled game on that surface), you could define tiles by their latitude and longitude, say. I have no idea off the top of my head how that developer would define locations in that world. A quick hunt for 'hyperbolic coordinates' took me here, though I'm not sure that's the right direction to take the problem.
Interesting link, though like you said, I don't think it's right. A few weeks ago, I tried to make a cave-based game where you started in a 5x5 space, and some "tunnels" led to other 5x5 spaces like the first. This is sort of equivalent to a hyperbolic geometry (if you "stretch" it correctly). Similarly, if you have 3 copies of an infinite binary tree joined at their roots, you can have a tree in hyperbolic space. This works because..
For the size (the "extra space") the further you are from the root, the density of nodes increases exponentially, which is exactly what happens in hyperbolic geometry.
For isotropy, all nodes connect to exactly three other nodes.

However, a tree is a tree, so it can't simulate a pattern that's not a tree directly. Though one can learn from this that to accurately simulate a hyperbolic space, you need an extensible string instead of numbers. In the exponential cave game, I stored position as "0312324" or similar.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: Hyperbolic geometry is awesome

Post by testtubegames »

A Random Player wrote:Similarly, if you have 3 copies of an infinite binary tree joined at their roots, you can have a tree in hyperbolic space. This works because..
For the size (the "extra space") the further you are from the root, the density of nodes increases exponentially, which is exactly what happens in hyperbolic geometry.
For isotropy, all nodes connect to exactly three other nodes.

However, a tree is a tree, so it can't simulate a pattern that's not a tree directly. Though one can learn from this that to accurately simulate a hyperbolic space, you need an extensible string instead of numbers. In the exponential cave game, I stored position as "0312324" or similar.
Ah, that's a nice, clean idea. One interesting thing, though, is that this method -- as well as any I can think of for such spaces -- does have, by definition, a 'central point'. Which would lead to some fairly convoluted metrics. How far is "03230230" from "02130932"? What tiles are on the sides of "0239028"? That kind of thing. All important questions when you're drawing 'all visible tiles' on the screen. You could certainly write functions to figure it out, though they'd be much more complex (and recursive) than for Euclidean or even spherical spaces. If I had to do it right now, mind you, that'd be the approach I took, too. I do wonder, though, if there is a cleaner way.
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: Hyperbolic geometry is awesome

Post by robly18 »

I may have come up with a way for the distances part. The hyperbolic plane is a three dimensional shape thing right? Why not have the coordinations in three dimensions?
Convincing people that 0.9999... = 1 since 2012
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Hyperbolic geometry is awesome

Post by A Random Player »

robly18 wrote:I may have come up with a way for the distances part. The hyperbolic plane is a three dimensional shape thing right? Why not have the coordinations in three dimensions?
Not exactly. Most projections draw it as a saddle in 3-space, but hyperbolic geometry is like a saddle everywhere, so it curls up more the farther you go. Eventually there will be no space to put all of the space far from the origin.
Check this out. It's a crocheted hyperbolic geometry.
testtubegames wrote:
A Random Player wrote:Similarly, if you have 3 copies of an infinite binary tree joined at their roots, you can have a tree in hyperbolic space. This works because..
For the size (the "extra space") the further you are from the root, the density of nodes increases exponentially, which is exactly what happens in hyperbolic geometry.
For isotropy, all nodes connect to exactly three other nodes.

However, a tree is a tree, so it can't simulate a pattern that's not a tree directly. Though one can learn from this that to accurately simulate a hyperbolic space, you need an extensible string instead of numbers. In the exponential cave game, I stored position as "0312324" or similar.
Ah, that's a nice, clean idea. One interesting thing, though, is that this method -- as well as any I can think of for such spaces -- does have, by definition, a 'central point'. Which would lead to some fairly convoluted metrics. How far is "03230230" from "02130932"? What tiles are on the sides of "0239028"? That kind of thing. All important questions when you're drawing 'all visible tiles' on the screen. You could certainly write functions to figure it out, though they'd be much more complex (and recursive) than for Euclidean or even spherical spaces. If I had to do it right now, mind you, that'd be the approach I took, too. I do wonder, though, if there is a cleaner way.
Well, I'm pretty sure most, if not all, metrics have a central point (or something similar). Euclidean space, for example, has (0,0) as its center. A sphere has either 0° longitude 0° latitude as a center (or a trivial point at least), or the intersection of the xyz axes with the sphere if measured with 3d coordinates (in which you'd have 6 "easy points").

The distance/metric part would be a problem though. I suppose, as you said, an algorithm could figure it out, but it would still be better to have it as simple as possible. Speed and difficulty of adding new code mainly.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: Hyperbolic geometry is awesome

Post by A Random Player »

I've found it (or I think I have). And we were extremely close: It came from cellular automata, a branch of math I'm also interested in.
https://www.google.com/#q=hyperbolic+pl ... es&spell=1
Refined my search after a while of searching
http://www.univ-orleans.fr/lifo/Manifes ... urice.html
First link, shouldn't be bad.
http://www.univ-orleans.fr/lifo/Manifes ... aurice.pdf
Some slides.. 300 of them. (Apparently I read them all :shock:)
A later page shows that they are indeed numbered with a tree-like structure, though slightly more complicated: A Fibonacci tree. As replacement rules, W->BWW, B->BW, W.

I SHOULD HAVE KNOWN :x

Oh, and the slides are interesting and actually pretty, almost like art. Try looking through them.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
Post Reply