6 ms·
Geodesic Asteroids: Classic arcade game gets correct physics
- ionwake 12y agowait im confused, why a torus and not a sphere?
- fiatmoney 12y agoGoing 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 12y agoWhat if it was a sphere, but the camera moved along with the ship -- with a dead zone in the middle?
- musgravepeter 12y ago(nbodyphysics here) I initially had the same thought, but when you think of a Mercator map, the top edge is a point, the north pole. On a torus it's a line, the inner circle.
- musgravepeter 12y agoThe other comment makes an excellent point about the mapping. That's also crucial.
- santaclaus 12y agoWhy stop at a torus? Go Genus-2!
- musgravepeter 12y ago(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...
- pimlottc 12y agoThis is really cool! I could really use a longer gameplay video though to get a hang of how the screen mapping works.
- musgravepeter 12y agoThanks! You can get a free version for iOS, Android and Blackberry... (Same as paid version, just no bonus ships)
- 33a 12y agoThis 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 12y agoVery 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 12y agoIt uses numerical techniques instead of explicit formulas.
- waqf 12y agoI'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?)
- e12e 12y agoMy first expectation upon seeing the title, was that the author had done something to how irregular (3d) asteroids were affected by gravity (pulling each other and the ship) and explosions, rotations and orbits etc. [ed: not to mention fuel/weight/recoil for the ship and/or plasma boiling off asteroids from lasers etc...).] To me this is more an example of "correct math", not "correct physics" -- although I suppose it depends on one's point of view :-)
- im2w1l 12y agoJust want to clarify a little. Since x^2+y^2 = 1, the projection of the torus onto the xy-plane is a circle. The same is true for the zw-plane. A position on the torus can be specified by specifying the position in the xy-plane, and the position in the zw-plane. Since the projections are both circles, those two positions can be represented by one angle each. And this is exactly what you see on your screen. The right-left axis is the xy-angle, and the top-bottom axis is the zw-angle. The edges of your screen correspond to an angle of 180/-180 degrees.
- musgravepeter 12y agoI 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?