3D video games are very demanding applications. They need to output dozens of pictures every second, while updating artificial intelligence, physics, networking or user interface. Unsurprisingly, game developers are usually very interested in performance. Let's have a look at how we are working to keep the framerate above 60 !
The first part of solving performance issues is to prevent performance issues, before you even start developing the game. Building a rendering engine that works well on most hardware is a gigantic task, most of the actual optimization work is done there by people who basically dedicated their lives to rendering performance. If you want to work on the game itself and not just on the underlying technology, a game engine such as Unity3D or Unreal Engine is a must have. Using proven technology that you know to be efficient and making sure the gameplay isn't too hard on performance by design are the first step of optimization. Helium Rain runs on Unreal Engine 4, an engine that has very good performance on various platforms ; we have no regrets at this point ;)
Of course, choosing a fast game engine is not the end of the story. Game developers need to make the game nicer than the competition, and the competition is already pushing the hardware ; and not all games are created equal : a 2D side-scroller can always have better performance than a 3D MMORPG. For example, a title like Minecraft is very hard to optimize because it's an open, fully dynamic world that runs on a virtual machine (what could go wrong ?).
So game developers also need to take care not to have too many elements on the screen. Here are a few variations of the technique.
In Helium Rain, we have very high draw distances (in the kilometer range), but we also have aggressive level of detail. The overall shape of ships is kept, but small parts and special effects are only visible from a reduced distance. It's not something that the player can see, but it gives us large performance improvements.
Sometimes it's still not enough. One problem that we had was that the performance dropped significantly during battles, while large squadrons of peaceful ships were fine.
Fortunately, Unreal Engine includes a very nice profiler. A profiler is a tool that you run with your program in order to find performance bottlenecks. It measures every event, every function in your game and reports to you which parts of your code are the most demanding. We ran this tool during a battle and studied the results.
We found out that our combat AI was costing us around 300 microseconds per frame, per ship. It may look very small, but with thirty ships in the scene, this time climbs to 9 milliseconds - enough to curb the framerate. In this case, the solution was very easy - the AI didn't need to be updated at every frame. We also found out that projectiles were very costly. We had hundreds of fast-moving projectiles with trailing effects, physics and collisions - and all of this was costing way too much.
Profiling your game when something goes wrong is the easiest way to understand the problem.
At this point, it's early to say what kind of computer will be needed to run Helium Rain. We want to make it as light as possible, but space sims are very complicated animals. They have a lot of moving objects on the screen, with physics, and a whole universe to update in background, while most games try to keep dynamic elements to a minimum.
The goal is to make the game run smoothly on a mid-range gaming PC, and design it for a higher-end machine.