Thanks to Programmer16, I discovered a few bugs that were sapping FPS, and in the process, found a couple other inefficient things that were eating up frames.
Forest Fires
I was a bit perplexed by Programmer16's comment in my prior entry about how many texture swaps he was getting in a seemingly simple scene. Well, after a little bit of snooping around, I found the culprit: trees. Yes its true, the trees were the reason the texture binding was happening so often, even though there were none on screen. As it turns out, when the trees catch on fire, they create a fire emitter, but when that emitter dies off, the tree just keeps it there, updating it and attempting to render it. Since the emitter is 'dead', the rendering does nothing, except bind a new texture, which is then immediatly swapped out for the next objects texture, which is not a good thing. Needless to say, this bug is fixed now, so problem solved!
Stupid Code
While I was tracking down that fire bug, I stumbled upon the following line of code in my animation class:
usedisplaylists = false;
Yeah, turns out I was rendering everything in immediate mode, which is not a good thing to do, so I switched that flag to true, and I immediately got a 200 frame boost in FPS, which is nice[grin] Anyways, this improvement is in the new Angels 22 Performance Test that you can download below:
Now this program doesn't let you fly around or drive anything(I still want to tweak that), it does let you zoom around the level using the arrow keys, and it even lets you spawn bombs at the center of the screen, so you can cause some real carnage. There are 3 figures at the top left of the screen, the first on is the FPS(which varies about + or - 5 frames because my timer is crappy), the next figure is the number of times glBindTexture is called per frame, which doesn't really matter to you guys. The last figure is how many textured quads are being rendered each frame. All I really care about is what kind of FPS you guys are getting. I would also like to know at what point it starts to get choppy and laggy (you can use the QUADS RENDERED figure to help me out on this one). Anyways, the link is below, so download it, run it, and let me know how it does.
Angels 22 Performance Test Mark II (997Kb)
-------------------Controls------------------------
Arrow keys - move around
Enter - Spawn bomb
Escape - quit
(That should be it, but I probably left a button in there I shoudln't)
Nuclear Artillery
Today I sat down and coded up the huge artillery piece that Mark drew up, and after about 2 hours of trying to align the various parts together (its pretty well segmented for the firing animation) I finally got it working right. So here it is, barrel elevated at a 45 degree angle, and ready to fire. It's actually animated right now, but you'll have to wait to see that, because I don't feel like wrestling with Windows Movie Maker to make a movie for it, but I will soon. Anyways, here's a screen of the cannon, rendered in game (I really need to expand my test level, I'm running out of new places for screenshots[grin]):
Well, please download the Performance Test and let me know how it runs, you know the drill[smile] As always, ideas are welcome, and I'll talk to you guys later. Peace Out!
I tried your new performance test and got some odd results. Although my FPS would go alot higher (I got over 200 at one point), it fluxuated hella-bad. Just sitting there (doing nothing, before even pressing a key) it was jumping from between 27 to 170.
The good news is that it didn't drop below 27 even at over 4500 quads rendered.
AMD Athlon 64 3200+ 2.01GHz
256MB Sapphire Radeon X700 Pro
3GB RAM
Windows XP (Home)