Once upon a time, I tried to write a video game. The basic theory was to make a 3d multiplayer space flight combat simulator (read: x-wing clone). I first wrote a software engine for the PPC. My procedure went as such:
Each cycle took about a month. Things continued till the point where you could fly about the stars shooting space torpedoes at things. A front/rear radar kept one oriented. In short, pretty awesome.
- Come up with idea for feature.
- Implement feature.
- Watch framerates drop to 3-4 a second.
- Optimize back to 25-30 fps.
- Goto 1.
And then one day I bought a game called quake. Quake had a special version which could be run with a hardware co-processor. That is, to say, a video card. So I asked for a voodoo1 for my birthday. It came and was pretty awesome as well. I looked at my code and went "hmmmm."
The first attempt was to simply alias my triangle code to glide, but this turned out to be impossible to debug. Then I discovered a graphics library called ConixGL had a mac implementation you could download the documentation for. I procured a copy of MesaGL, which was working on hardware support for the voodoo cards. I started rewriting my engine. After a bit of tweaking I had a basic text display in an 3d environment.
From there it was mostly a matter of refactoring old code. Then one day everything was over. I turned on the framerate counter and fired up the engine in hardware for the first time. "60 fps" the prompt spit out. One of the recent areas I had added was the star field. I had pushed the code to being able to handle as many as 30,000 stars in the background in realtime. Ten thousand only cost a tenth of a frame per second at 25-30fps. And now it could play them at the screen refresh rate. Very intriguing.
So I went back and changed the number of stars to 30k and hit run. 60fps. I tried 50k. 60fps. I tried 100k. 60fps. I tried a million. 59fps. Somewhere around ten million stars things actually slowed down to 30fps again. I discovered what was the problem was: the 2MB of cache was being filled up. My brother had already pre-ordered a voodoo2 with 8MB. I stared at my code. I began to suspect my hard-earned optimization skills had become useless overnight. So things go.
I decided to look at writing multiplayer code. I learned that networking is, by graphics standards, a hard problem. And I realized that to scale things up I would need to most likely rewrite the rest of the project again. And so, I abandoned ship.
Random part of the story: from here I bought a whole string of video cards. Later, I kept them around the house in my test boxes. One day, I read about the nouveau project needing card dumps and found they could use one of the old ones I had lying about. So, if you're using nVidia graphics with open source drivers, the ghost of my game is in some tiny tiny way intertwined with this very line you are reading. ^^