Home       About Me       Contact       Downloads       Part 7    Part 9   

Part 8: World Building

January 11, 2011

Fig 1: A small world
small world
In Part 6, I decided that I wanted the game "world" to consist of a field of asteroids, so that players would have a reason to bunch up. I don't want people sprawling out in all directions and never meeting one another.

So the next question is how large should an asteroid be? In the Minecraft data that I've been playing with, I've imported a 128 by 128 by 128 block. This is plenty of material for a single person to build with (it's over two million cubes.) If I want to support 500 people on an asteroid, each with this number of cubes to play with, then there are two ways to figure the size of the asteroid.

If we do this by surface area, 128 by 128 for 500 people is 8,192,000 cubes. A sphere with that surface area has a radius of 807 units. But I assume people will burrow into the asteroid and build underground cities, or hollow out the center and fill it with city, leaving the surface as a park, etc. If we do the calculation by volume, a cube 128 by 128 by 128 for 500 people is 1,048,576,000 cubes, but a sphere with that volume has a radius of only 630 units.

Fig 2: Too small!
too small
I built a sphere with radius 630 in my demo, so that I can walk around on it. See Figure 1. The horizon is a bit close, but I think it's probably workable. By the way, I am not making that sphere out of cubes. I just used a cube texture so I could get a feel for how much space buildings would take up there. It's made of polygons.

There are two risks on a small world like this: 1) a close horizon will look peculiar, with buildings clearly tilting away from you in the distance, and 2) building with cubes will be a problem. In Figure 2 you can see what I'm worried about. If the world is too small, the local "vertical" will change too quickly, making nearby buildings look tilted, or making it impossible to join up different structures because blocks are at different angles.

Assuming my asteroid is the right size, it's time to give it some landscape. If we were doing a flat landscape, we could use what's called height mapping. On each grid point, we have a height and draw triangles between adjacent points. Shamus Young explains it all here.

I can take a sphere and use latitude and longitude instead of X and Y, and add a height map to the radius of the sphere. Using some noise as the height map, I can deform the sphere and get a lumpy world. See Figure 3. And I can walk around that in my demo (Figure 4) to see how it looks.

Fig 3: Deforming a sphere with noise
sphere with noise

Fig 4: Walking through the low hills
low hills

I'm not really happy with this. I wanted something more dramatic, but I think little mountains on a little world will look stupid. So I start playing with the demo again. I have a sphere made of cubes, 128 by 128 by 128 (the largest thing my demo supports right now.) I also have a block of noise the same size. See Figure 5. Can I do anything with these?

Fig 5: A sphere, and some noise. Hmm...
sphere and noise

If I subtract the noise (thresholded above some value) from the sphere, I get Figure 6. That looks interesting, but I don't like the perfectly spherical surface. Taking my cue from Florian's writeup (here), I multiply the distance from the center of the sphere with the noise, and then threshold it. That gets me a nice little rock. See Figure 7.

Fig 6: A sphere minus noise
sphere minus noise
Fig 7: A sphere times noise
sphere times noise

If I just wanted an interesting asteroid shape, this would do fine. But I really like the idea of building cities within the world, and light streaming in through gaps in the surface.

I subtract a bit of the noise from this asteroid shape, and get Figure 8. That's looking much more interesting. So I add some lights and throw it into the ray tracer. In the dark, with a starry sky, it looks like Figure 9. Then of course, I have to make a movie. That's in Figure 10.

Fig 8: Subtract some more noise
sphere minus noise
Fig 9: A ray trace of The Rock
ray traced

Fig 10: Flying through the asteroid

This has been a short week for me due to health issues (pulled a muscle in my shoulder), so that's all I have for you. My next step will be to make this world larger. As I said, I want a radius of around 630 cubes. This is radius 64 or a bit less. I also want the world made out of polygons so it looks nicer. And all this needs to be implementable in a real game, as opposed to my slow ray tracer.

One item worth discussing at this point is how a world like this will feel. I imagine it crawling with cities and other structures, the way the TwentySided Minecraft server is. If I allow people to build within the asteroid, I have introduced a fundamental problem -- there's a lot of scenery really close. That means I can't use the usual trick of letting things fade into mist in the distance.

On the surface I have no problem. The short horizon would work just like mist, hiding buildings quickly when they get too far away. So what do you all think? An Escher-like ball of city in the center of an asteroid, or a small world where you walk over the horizon in a few minutes? And what should I do about gravity? Should it be local to the structure somehow (so that you just point up from whatever you are standing on), or point down to the center?

I've also made this world very dark -- both literally and in mood. Once this is filled with bits of Minecraft buildings, it's going to look fairly forbidding. If a game were set this this world, an Assassins Guild would figure prominently. Of course, since this is just one asteroid, the next one over could be covered with bunnies and unicorns. (obviously a trap!)

Let me know what you think.

Home       About Me       Contact       Downloads       Part 7    Part 9   

blog comments powered by Disqus