

Geodesic Asteroids: Classic arcade game gets correct physics - musgravepeter
http://nbodyphysics.com/blog/

======
waqf
I'm a strong proponent of thinking about interesting geometries and physicses
like this in games, but I'm reluctant to describe this physics as more correct
than the original.

The original had correct physics for the simplest possible torus, the
mathematically abstract flat one. You've replaced it with correct physics for
some arbitrary irregular torus that happens to embed into 3-space :)

(In fact, you can embed the original, flat torus in 4-space, as x² + y² = z² +
w² = 1. If you put that into your geodesic solver, all the weird cross terms
will go away and you'll get normal Asteroids physics.)

(And now with santaclaus' comment, I'm wondering what geometry I would
advocate for a double torus. It can't be flat because of the Euler
characteristic or something, but can it at least have constant curvature
everywhere?)

~~~
musgravepeter
I agree with your point about embedding.

The game solves the geodesic equation using the instrinsic geometry of the
torus in 2D space without reference to any embedding. It is in this sense that
one might call the physics "correct"

The motion is then mapped into either a 2D or 3D representation and I agree
this has a strong effect on how things look.

I'll need to think about the four space example.

What is the metric for a mathematically abstract flat torus?

~~~
waqf
If your model for the torus is the unit square with edges identified together,
then the metric is the usual Euclidean metric, dx² + dy². (Alternatively, the
metric induced from the embedding into Euclidean 4-space, with a
parameterization like φ=atan2(y,x), θ=atan2(z,w), should give you the same
answer give or take some factors of 2π.)

(Also, Mathoverflow relevant to the double torus question:
[http://mathoverflow.net/questions/194451/canonical-
immersion...](http://mathoverflow.net/questions/194451/canonical-immersion-of-
the-double-torus.))

------
33a
This reminds me of a game I wrote for Ludum Dare a while back:

[http://0fps.net/2011/09/13/ludum-
dare-21-results/](http://0fps.net/2011/09/13/ludum-dare-21-results/)

The title of the game was "Help! I'm trapped in a compact riemannian manifold"

You can grab the source for it on GitHub, though the build process is pretty
janky as I wrote it in 48 hours and wasn't very careful with the distribution:

[https://github.com/mikolalysenko/ludum-
dare-21](https://github.com/mikolalysenko/ludum-dare-21)

~~~
musgravepeter
Very hypnotizing! I assume you have a heuristic for geodesic motion? I doubt I
could write down the metrics for some of those surfaces in a Lundum Dare
timeframe.

~~~
33a
It uses numerical techniques instead of explicit formulas.

------
pimlottc
This is really cool! I could really use a longer gameplay video though to get
a hang of how the screen mapping works.

~~~
musgravepeter
Thanks! You can get a free version for iOS, Android and Blackberry... (Same as
paid version, just no bonus ships)

------
santaclaus
Why stop at a torus? Go Genus-2!

~~~
musgravepeter
(Nbodyphysics) Yeah - maybe if there's interest. The code gets a bit messier
since I need multiple co-ordinate patches and there is a discontinuity...

------
ionwake
wait im confused, why a torus and not a sphere?

~~~
fiatmoney
Going around the "top" of a sphere ends up looking weird in a 2D projection
(like your standard Mercator projection map) - you end up next to where you
went in. If you want to come out on the bottom, you typically want a torus.

~~~
warfangle
What if it was a sphere, but the camera moved along with the ship -- with a
dead zone in the middle?

