So, time for a little update guys. In the past months I've been working on improving the performance of AoD, and here I'm updating you on some of the results I've obtained.
These tests were done with a PC with the following specs:
- Athlon 64 X2 6000+
- 3,62 GB RAM
- GeForce GTS 450
- Windows XP SP3 32 bitThe Beginning
So, let's start from a fixed point image from before we started our optimizations and see the metrics. This screenshot was taken with almost default settings.
The First Tweaks
- Polycount: 1.972.426
- Drawcalls: 784
- FPS: 34.9
So we started doing some tweaks. Since we are using a practically flat terrain, we made the engine use a lower poly version of it, and we gained a small performance improvement.
- Polycount: 1.833.162
- Drawcalls: 768
- FPS: 36.1
But we still need to do more, so we decide to tackle the shadows. In that screenshot, shadows are set to the highest default settings. They look great, and they don't disappear even with the camera up high, but the performance is atrocious. The problem is that they are made for first person games, so they are designed to be seen at a distance. Here is a close shot of the shadows:
As you can see, the polycount is really high. That's because the game is still rendering all those far shadows our game doesn't need. So we made a small change. Nick coded the engine to dynamically change the distance of the shadows depending on the camera distance to the ground, which allowed us to have great looking shadows up close and far, and full shadow coverage when the camera is up high. Here is a shot of the shadows up close (check that it looks exactly the same as before, but with a 100% FPS increase!).
And now we are showing the scene with the original camera, to check the performance we gained.
The Big Jump
- Polycount: 1.535.075
- Drawcalls: 583
- FPS: 47.5
That's a great increase, but we wanted more, much more. We looked at the terrain, and it was casting shadows, which were completely unnecessary since the terrain was completely flat in this particular level. We made a toggle on the terrain so we can disable them at will (some levels will make use of them).
- Polycount: 1.040.879
- Drawcalls: 526
- FPS: 48.7
While the polycount is definitely lower, the performance increase was small. That's due to the great work the GG guys did on the terrain. But anyway, every little bit helps. But that was not enough, not enough at all. So made use of a new setting the engine got, that allowed us to tell the shadows to use a lower poly version of the object for determining the shadows. I started creating these "shadow meshes", which are a basic outline of the model, just creating everything I wanted to cast shadows, nothing more. The PSSM shadows always use that model for casting shadows, and nothing else. Plus I removed some plants and small objects that were casting shadows... And well, I'll let the screen and metrics speak for themselves:
- Polycount: 605.387
- Drawcalls: 441
- FPS: 69.2
The performance difference is amazing. A 100% increase in performance compared to the first screen. The screen looks a little different since I did some tweaks to the groundcover (the grass you see in the level), and added some different textures and maps to the models, but it's practically the same.Unexpected Side-Effects
This new setting the we got with the engine helped us with something we wanted to do a long time ago: The ability to hide roofs when entering a building and don't have the sun pouring in. Since the PSSM are using the "shadow mesh" for casting shadows, hiding the visible mesh has no effect on the sun shadow. This was a godsend for us. Check out the screen:
Looks nice, eh? =)
But that's not all... We later did a small change, that had an artistic reason, but that gave us a cool performance increase. Basically, we didn't like the look of the game perspective, so we changed the FOV from 70 to 45. This gave us a nice "Isometric" look like the games of yore, and a cool fps increase! Here are the shots and the metrics, as usual:
- Polycount: 605.849
- Drawcalls: 380
- FPS: 78.6
And this performance is at the highest camera distance. Using it at a medium distance nets more than 100 FPS:Extra Performance Options
Until now, all the performance increases were done keeping the visual quality of the game. Disabling shadows nets a big increase (from 78 to 135 FPS in our game), and reducing or removing the groundcover also nets some gains. On top of that, there are the different options offered by the engine like lower texture resolution, lower lighting system (for low end machines), among other things.
Also, there are ways to increase the visual quality of the visuals. These shots were taken with the default options, using a 1024x768 resolution, no anisotropic filtering, so there's room for more visual candy.What's Next...
Now, we are working on improving performance with a lot of characters on screen which is quite crappy at the moment. My next update would cover that plus some nice additions like texture tinting. Until next time! =)