Dev Blog 1
We are considering posting two blogs a month with one dedicated to tech talk in the middle of the month and the other dedicated to more general updates at the beginning. So now that we have introductions out of the way, let's talk about some tech!
Early Performance and Optimization
First and foremost we want to discuss our commitment to in-game performance and how we plan to tackle many of the common problems we’ve seen in the indie gamedev world. Future dev blogs will definitely expand on this topic.
We have all heard the word “optimization” when discussing why a game is not running smoothly. “They haven’t optimized the game yet” and “this game was optimized poorly”, things like that. The concept of optimization is extremely complicated because every facet of the game plays a part. Networking, servers, art assets, sounds, animations...everything can contribute to (or harm) overall game performance and be subject to poor “optimization”. Some people think its just a matter of ticking a few boxes or changing a few lines of code when in reality it is much more analogous to forming the foundation of a building; you have to do it right from the beginning otherwise you’re going to have very big problems later on. You can have the fastest and most optimized server architecture in the world and your game can still run terribly if you’re replicating objects too far away or your foliage has too many draw calls. One of the big things we tackled early on was the ground assets, particularly grasses as there are thousands upon thousands of meshes being rendered and it is one of the quickest ways to ruin your in-game FPS if not handled properly.
There are two main factors to consider; polygon count and quad overdraw. Most people know what polygon count refers to (the 3D complexity of a model) but fewer people know what quad overdraw is. When creating a grass mesh you can either individually model each blade of grass, which comes with a higher polygon count, or you can create a mesh with a series of flat planes and “block out” where the grass is in the 2D texture with transparency. Rendering transparency has a cost that begins to stack as more and more planes of transparency are layered on top of each other, like looking through several slightly dirty windows, this is quad overdraw. Individually modeling the blades of grass eliminates this cost but increases polygon count significantly. Therefore, optimizing the planes by removing as much of the extra transparency space as possible reduces your quad overdraw costs at the expense of only mildly increasing polygon count. This proved to be the best combination of aesthetics and performance and is what we could consider to be “Optimized Grass”. Below you'll see an Optimization View Mode in the UE4 editor called "Quad Overdraw" showing two different grass meshes, one with very high and one with very low quad overdraw. These are the types of performance tools included in UE4 that effectively highlight your problem areas with clear visualization.
Considering the Context
Testing this can be tricky though since you are balancing CPU (polygon count) vs GPU (quad overdraw) costs. Eliminating quad overdraw looks very nice on paper, but with that comes skyrocketing CPU costs due to the necessary model complexity to make this happen. The CPU is handling such a wide variety of tasks you have to be very careful here. Bottom line, CPU costs are a higher priority so when you are “optimizing” here you need to consider polygon count first, and quad overdraw second.
You’re probably thinking “wow, that was a lot of talk about grass, why was that important?”. Aside from grass being a sneaky thing that can kill your FPS when poorly optimized, it is the fundamentals that are important. Considering all sides of optimization early in the process to achieve the best result possible at the end. This a concept we are using for everything in Breaking Point, because to optimize poorly is sometimes worse than to not optimize at all. We will speak more about these concepts in the future with other in game assets!