Fixing those pesky performance issues
For the past few weeks I’d been having a horrible performance issue, and I couldn’t figure out why. My frame-rate hovered around 20 fps, which is really bad for any game, let-alone a VR game where low frame rate can make you physically ill. This issue only occurred in editor, the performance of the standalone game was a nice solid 90 fps. This forced me to make a standalone build every time I made a change I wanted to test, unless I wanted to debug a slide show (I didn’t). I had taken a couple of cracks at the issue previously with no success. I had made the assumption that it was a graphics issues, and so I was trying to find the issue using the Frame Debugger. I had found nothing, so I just assumed that it was a quirk of in-editor VR performance. After all, performance usually takes a hit in-editor, even if this case was very extreme.
This week, however, I got fed up with it and decided to give it another go. And of course, the issue was something simple. My main thing was I should have been using the Profiler, not the Frame Debugger. If I had, I would have spotted the issue immediately. I had an object posting to the editor log (the internal one) every frame. This is a performance-killer.
All of my lighting is static, except for one, the Sun. This makes sense; none of the lights in the space station move, so they are static, but the Earth moves around the Sun, so that lighting cannot be baked. However, I do not want to apply the sunlight to the space station. since that would mean a performance hit, so I have the Sun light set to only apply to my Earth render layer, and exclude all others.
Now, here’s the catch: I’m using Forward Rendering. In Forward Rendering, lights may exclude no more than 4 layers. If you exclude more than that… it still works for some reason. However, it does complain loudly in the Console Log, but it only does so once.
In the editor log, it complains loudly, and often.
Now that I have found the source of the issue, I can come up with a solution. In the meantime, if I need to work in-editor, I know I can just disable that light and keep my lunch.
I’m going to GDC this year! If you’re in town, I plan on showing Decommissioned at these locations. If you’re in town, stop by!!
This week I whipped up quick intro / exit levels for the game to help guide players into the game. The game’s controls are intuitive but pretty novel, so players definitely need guidance to figure it out. I wanted to do a more active tutorial (less reading, more doing) but time was a limiting factor. Still, I like how it turned out!
I put together a demo control system into the game so I had shortcuts for switching between the intro, main, and exit levels, which should make reset easier. I also added in a timer to facilitate movement through the demo. I chose 5 minutes as my demo time, but I can extend it on the fly if needed.
I also put together a quick demo video that I could leave on the screen when no one was playing to help attract players:
Anyways, that’s all for this week!