Spellcaster Studios

Make it happen…

Issues with performance

Today I was trying to test the game in fullscreen under Linux and I found a weird performance issue…

In the initial cutscene, the game was running very slow (about 30 FPS), but when I moved the player to the left a bit (so more geometry on screen), the game jumped to the normal 60 FPS… Going back to the initial position, I got the same result again (30 FPS)…

First, I suspected the multithreading (the initial position is on the boundary of the area, which could cause trigger a parallel area generation), but I turned off multithreading and the results were the same…

Then I tested some stuff, and found out this only happened when the game was running at 1920×1080… At 1600×900 it didn’t happen! Doing some more fine-grained performance measurement, I identified the problem was in the “SwapBuffers” call, which is when the CPU/GPU are forced to go hand in hand…

So, maybe it’s the resolution? But a 30% increase in resolution shouldn’t loose me over 75% frame rate!

This is when I tried using gDebugger to narrow down where the slowdown was happening, but I couldn’t get it to work, leaving me with the only viable solution: start to turn off stuff…

When I finally turned off Ambient Occlusion, I got rid of the performance hit… I was not expecting that, so I tried reducing the resolution of the ambient occlusion (it’s being done at the same resolution as the screen), and it still was gone, so it’s the size of the render targets! For some reason, my video card (a nVidia GTX460) struggles with such big render targets, so I’ll have to change the code to switch the resolution on those cases…

screen651

The “shadow” you’re seeing on the render above was some error I introduced on my tests… Smile

Now listening to “Griefshire” by “Elis”

Link of the Day: I love good physics simulations… although not real time, it’s still impressive:

Comment