Various Updates

After weeks of work it’s finally done: My game works just as well as it did before. Cool, isn’t it? I do stuff like that more often than I’d like to, but I have to. The goal is always to create the infrastructure for other cool stuff that I plan on doing later. In this case, I now have the infrastructure to control any kind of vehicle, not just the default snowcat. To make this possible, all user-controlled driving is now controlled by Javascript code that I (or anyone else) can create and change rapidly. The supporting built-in code doesn’t differentiate between different vehicles, about anything can be controlled now (planes and helicopters will need much more work, though).

It took a lot of time to get all that crap working. Code that I had absolute faith in failed me, while code that I was certain to cause trouble worked as it should right from the start, with bugs not in core areas (although one of them was still very annoying).

By the way, the strange point of view from my last post was caused by me setting wrong values for the points the camera looks at. So what I saw what was I specified, though not what I meant.

Now the stuff that I’ve did since I got JS working. First of all, the textures for the landscape stopped working since I changed the rendering code there. The problem was that the coordinates where the texture was supposed to show up were all zero. To debug, I just set those values randomly. This gave me interesting results.

The ground has strange stripe patterns

After the bug was fixed, everything looked normal again.

Normal screenshots are boring, but my sister insists I post them so she can show her friends what I'm doing

The next problem was “frustum culling”. This is an optimization that should make sure only those parts of the scene that are possibly visible are rendered. If this was working correctly, it should improve performance a lot, because not rendering stuff that isn’t visible is always faster than rendering stuff that isn’t visible. Of course, it did not work for me:

Nothing except background

For testing, I changed the code so that stuff that is apparently not visible was renderd in yellow and red instead of not at all.

Everything, except the background, is yellow and black

If you look closely, you might realize that my code wasn’t working properly at all. What was the reason for this? That I am stupid, of course. For the landscape I use so-called heightmaps. That is a grey-scale image, where the height of every pixel gives me the height at every point of the map. The distance between these points can be choosen at will, I opted for five meters (at least in this map). Sadly, I forgot to tell this to some parts of my code, so the various sectors of my map thought that they were much smaller than they actually were, even though they were rendered correctly. Now, that I’ve corrected this, everything is back to normal, although the difference with the opimization isn’t very large.

Two normal pictures in one post. When did I ever do that before?

Written on May 26th, 2006 at 11:52 am

0 Comments

    New comments can no longer be posted because it got to annoying to fight all the spam.