What would be the best way to implement, store, and render spherical worlds, such as the ones in spore or infinity but without the in-between stages of spore, and multiple worlds ala infinity universe. Make no assumptions on how the planet itself is generated or its size/scale.
-
2Can you give us a bit more details as to what you actually want? – Eclipse Jan 23 '09 at 17:14
-
1How to implement, store and render a complex game environment is a huge undertaking. You may get better responses with more specific questions, Tom. – Drew Dormann Jan 23 '09 at 18:22
-
Ive built games before, just never with spherical game worlds!! – Tom J Nowell Feb 09 '09 at 10:36
4 Answers
For rendering, you'll need to use some sort of level-of-detail algorithm in order to seamlessly move from close to the planet's surface to far away. There are many dynamic LOD algorithms (see here). An older algorithm, called ROAM, can be adapted to handle spherical objects, or planets (spherical ROAM). Geometry clipmaps is a newer, more popular algorithm that can be adapted to spherical surfaces as well.
As for storing the data, you may want to look into procedural generation (depending on your needs) for texturing, heightmaps, etc. This is similar to how Infinity and Spore do things. You can read a little about procedural texturing here. Procedural heightmaps are simpler, depending on how complex/realistic you want your terrain. On the simplest level, you can simply displace your vertex height by a perlin noise function.

- 3,486
- 1
- 33
- 36
If you are looking for something to store data about the surface in, you might look at HEALpix. It is software developed by the astronomical community specifically for mapping the sky (another spherical surface).
HEALpix creates a mesh that describes the position and size of the surface faces and assigns each one an ID. You can then use that ID as the key or index to access as much detail as you want about that particular level.
HEASpix provides methods to find neighboring surface areas and can give center and vertex positions for each mesh point.
It is a hierarchical mesh that allows you to subdivide each face as much as you want so you could in theory have parts of the mesh at low resolution and other parts at higher levels of detail if you wanted. It has the nice property that it is infinitely divisible (up to your memory limits) and each pixel of the grid at a given resolution has the same area as all the other ones at that resolution level.
The distribution package provides a lot of stuff that you probably won't need but the core libraries should be useful.

- 5,695
- 3
- 25
- 23
This is probably NOT what you are looking for... But what the heck. It's a good story.
Eons ago, back when dinosaurs still roamed the earth and memory was still measured in kilobytes, I played with some software to generate planets fractally.
The idea was to create a 2NxN rectangle representing the planet. Cut the planet in half a bunch of times shifting the two halves slightly each time. (Sine wave for the cut with random phase shift and amplitude. Another random sine wave for the shift.) Afterwords, flood the lower-level areas with water and color-code the rest by altitude.
Then put a sphere of Diameter N on top and project, wrapping an NxN region of the map around half the sphere. Move the sphere around the map and it looked like it was rotating.

- 8,320
- 27
- 30
-
this actually appears to be very similar to the way Populous 3 implemented faux sphere worlds. – Tom J Nowell Feb 02 '09 at 11:55
-
Interesting. I never played Populous, but I'm not surprised this technique was used. – Mr.Ree Feb 02 '09 at 12:30
I would suggest using some sort of polygon model in memory to implement them the worlds, use a file to store them and render them using some sort of 3d-engine. Either that, or just a pointer center and a radius, along with an overlay to describe the geography of the world.
Edit: Thanks for a bit more detail. Depending on how much detail you need, you'll need to use some sort of method to break up the texture into smaller parts - you can just generate the texture for 20 faces and construct an Icosahedron around the center point. Take a look at map projections for some thoughts on how this is handled in real life.

- 44,851
- 20
- 112
- 171
-
Yeah but how exactly would the world be represented in memory? Sure I could generate a sphere in memory out of quads but the problem there is that I'd have to texture map the thing and it would be all squished at the poles and stretched at the equator, its not as simple as it first appears =p – Tom J Nowell Jan 23 '09 at 17:15
-
That does have the disadvantage that you have more than one shape for a side - but it does have more side. – Eclipse Jan 23 '09 at 19:41
-
Ooh - this one has 60 side all the same shape: http://en.wikipedia.org/wiki/Deltoidal_hexecontahedron - it has an unrolled net here: http://en.wikipedia.org/wiki/File:Deltoidalhexecontahedron_net.png – Eclipse Jan 23 '09 at 19:44
-
perhaps but when zoomed out I want the curvature of the sphere to be visible, wont that result in vertexes showing through? – Tom J Nowell Feb 02 '09 at 12:31