Flash demo: spherical map projected onto rectangular grid

What this is: Have you ever played one of these empire building games, like Civilization or Civilization II or Alpha Centauri? The game world is supposed to be a curved surface, and it is curved in as much that the left and right edges of the map are connected. But that means the world is shaped like a tube, not a sphere. There are no poles, and there is no way to travel in a great circle (the shortest distance on a sphere).

So I had been playing Master of Orion III, which turned out to be not a very exciting game at all, and after I quit (and unstalled) that I started up Alpha Centauri. And of course Alpha Centauri takes place on an 80x80 grid with the left and right edges wrapping around. I'd really like to play a game that takes place on an actual sphere, so I figured out a possible way to project a sphere onto a flat grid. I wanted something where you could set the number of divisions between the equator and the poles, and where the grid distance between any two antipodes would be just about the same.

And this is what I've got so far. You can enter the grid size, which is the number of pixels tall/wide the squares will be, and the number of divisions, which is the number of divisions between the equator and a pole -- 8 divisions results in 17 rows of nodes, 8 rows from the north pole almost to the equator, 8 rows from the equator to just before the south pole, and then the south pole. And with 8 divisions the grid is 32 nodes wide. (Note: Alpha Centauri has the east-west and north-south intervals set equal, which makes the world twice as tall as it should be.)

When you roll over a node, it will highlight all nodes that neighbor that node. So at the north pole, you can reach every node just to the south (because everything is south from the north pole). One thing you will notice right away is that not all nodes have the same number of neighbor nodes.

This is a work in progress, I'm planning to add some A* pathfinding to this so you can see some great circle paths.

Technical note: Why Flash? I don't recommend using Flash for something like this, I used it because it was a handy tool and it is fairly easy to share with people on the web. It is also kind of fun to crank up the numbers and see just how many nodes Flash can handle -- 20 divisions creates 2056 nodes, which is 2056 Movie Clips.

Mathematical note: the surface area of a sphere increases to the square of the radius. So doubling the number of divisions will give you about 4x as many nodes (some are lost to rounding). You'll probably crash your browser if you go for more than 40 divisions. But don't let that stop you from trying.

Mathematical note: if you set divisions to 1, you get a cube!

shoehorn at antimodal.com