Home
|
Welcome bla bla
1. Game description"Space Balls" is intended to be a 3D version of the game "Supaplex" or "Boulder Dash". Your main 'enemies' are the heavy balls you need to push around, and being a 3D game, they are in space. That's why "Space Balls". Your goal is to collect as many diamonds as necessary to complete the level. Although it doesn't seem to be a
difficult task, making such a game, I've encountered some
very interesting problems, some of which I couldn't
solve. But it's not a very difficult task either. This
document is intended to give some technical hints to the
not so experimented programmers. I would also like to
hear from you, if you have some ideas that could help
solve the open problems. 2. GenesisThe idea was given to me by
Jake, one evening as we played some simple games on a
palm top. And then I thought I could make a 3D version of
Supaplex. 3. First stepsThe transition from 2D to 3D is
not easy. Because I wanted do make a very realistic game.
First of all, comes the question: how do you see the
scene in 3D ? Because in Supaplex you could see the whole
screen, but in 3D there will always be hidden objects.
Like in the pictures below, where you cannot easily guess
what's behind the "base" cubes: The answer came
quickly: use some transparency. So the base cubes will be
of two types: stone and ice for example. The pictures are
not very accurate, due to the jpeg encoding, but you get
the idea. The problem is the more transparent overlapping
surfaces you render, the less you see through. That's why
I had to remove the inner faces and vertices of every two
adjacent cubes, so that I get as less faces as possible.
This wasn't difficult at all, a trivial algorithm O(n2)
worked just fine, provided the level dimensions are
relatively small (max. 100). Plus, we send fewer vertices
and faces to the renderer. 4. The speed problemEven on my GeForce II GTS,
rendering 1000 spheres (which is just a 10x10x10 cube),
cca. 500 vertices each, could be a performance problem.
And I wanted everything realistic, with textures,
specular and lights. But the projection of a sphere is a
circle, no matter from where you look, so the answer came
easily: billboards. 5. The discrete space and the unsolved problemsIf we take a look at Supaplex, we notice that the spheres can actually "stand" on top of each other, if they cannot fall anymore. Provided the low resolution of old VGA cards, and the fact that the spheres are not exactly circular in shape, it doesn't bother the eye. But in 3D it would look like this:
This is not realistic at all, and I wanted to make a
realistic game. Which proved to be impossible. That's more like it ! 6. First animation problemsThe size of the level I tested
was 25x25x25. Using the division described above, I
needed a matrix of 25x2x25x2x25x6 WORDS, which gives us
about 732k of memory. As I made the animation, I was only
concerned about the rendering speed, from the D3D point
of view, and I ignored what the CPU and the rest of the
system were doing, so I wrote: Big mistake, even from testing ! FPS was about 15-20, no matter how many spheres were moving. I created immediately after that
a linked list of moving objects and I got FPS of 180 !
About 10 times faster ! 7. Real animation problems and the impossibility to go onNow comes the trouble: even in a
discrete space the spheres can fall and land in a very
large number of possibilities. And the grid setup above
cannot handle all of them. Watch the following pictures:
7+1 is missing(read Terry Pratchett for an
explanation) 9. ConclusionThere are two ways out of this dead end. First one is to give up the discrete space. There will be no grid, objects can have any shape and position and so on. With a good collision detection algorithm, it's not a big problem to make it. But I want to make a mere game and not a falling balls simulator ! I don't know how playable the thing will be. Plus the level design will be a pain in the ass, as well as solving the puzzle itself. The second way is to stick to the "ball on top of other ball doesn't fall" assumption, and with some tricks to render them as naturally as possible. I choose this way, because I don't like letting things unfinished. I decided to port the so far coded game to OpenGL, so that NT users and UNIX users can play it. And in my opinion D3D 7 is far from the performance, accuracy and easiness of OpenGL. That's why I won't continue, nor publish the D3D version. If someone has bright ideas or wants the D3D sources, just mail me. |
|||||||||||||