▶
Deep Dive into the game Optimisation
Before I begin this deep dive into this post, I would like to thank everyone who participated in the poll. I have already received responses from over 300 participants, and the data I have obtained is very important and valuable (along with some recent quality-of-life suggestions that were added this morning). In the current results of the poll, I've noticed that many players are concerned about the performance of the game. So, I believe a post focused on this topic would greatly help players understand the game's performance issues (and also help me maintain my own mental health). This post will mainly focus on CPU performance, with a section about GPU performance at the end.
(You can skip this part if you're only interested in the technical aspects) I might be seen as aggressive towards players who complain about performance issues, and while there may be reasons for this, it's still out of place, and I apologize if I come across that way. I can be quite straightforward and severe about such matters. Contrary to what people may think, I'm not a robot. I know my update rate can give the opposite impression, but I assure you I'm human. And like any human, I have mood swings, difficult days, as well as pride and ego. We all do; there's no need to pretend otherwise. Especially as time goes on and I sink more and more hours into game development, I find it difficult to take breaks for more than a day without feeling guilty. This is a common experience among developers, and I'm not immune to it. (I mean, i've been trying to take a week-long break for 4 day in a row now, and still making update to the game...) Optimization has always been an important focus during the development of Rogue: Genesia. While many may believe it's not optimized, the game is actually very well optimized. The main reason is that there's a lot going on, and I mean A LOT. But it's not just a lot... it's A LOT LOT! It doesn't help that the maximum displayed damage numbers per frame are set at 10 by default (this can be changed in the options). To give you an idea, this is what it would look like with a higher limit of around 400 damage numbers per frame:
And yes, what's happening in those screens is quite tame and easily runs at 60 FPS in the game. However, there are performance issues in the game, and I'm not blind to them. I know it's still a concern. Nevertheless, I've reached the maximum level of optimization that can be done, and it's frustrating to hear comments like, "How badly the game is optimized," "Other games in this genre are better optimized," "It's just sprites, why is it running so poorly?" "It's just a 2D game," especially considering the effort I've put into improving the game's performance. I can understand their frustration too. There are situations where the game becomes a slideshow, and their concerns are valid. It's a strange situation where I usually try not to respond or be aggressive, but my frustration can sometimes take over, and my replies can come across as aggressive or, at the very least, unfriendly. Well, anyway, the counseling session is over. Let's get into the nitty-gritty of what's causing the performance issues and how they can be improved upon!
Many of the significant performance issues players experience are due to the CPU being overloaded by the game's processes, and in this context, graphics have little impact.
First, by profiling performance, identifying performance-intensive elements, and devising solutions to reduce the performance cost of these elements. Let's begin with profiling, and I'll start with an example I encountered this morning, which led to a rework of the Thunder Spirit. I had a save file just before an Elite Swarm encounter (I know these are particularly bad for performance), with a ton of weapons, attack speed, and projectiles. It was the perfect scenario to turn the game into a slideshow.
A bit confused ? let me guide you In the top half, we have the performance graph, which represents the duration of each frame. Here's what each color represents:
The section with the purple line represents everything happening in the Fixed Update. This includes collision detection from projectiles and the processing of these collisions, such as applying damages, activating card effects, and validating monster deaths. As you can see, it accounts for a significant portion of the performance cost. The thing about the Fixed Update is that it can occur multiple times during a single frame when performance starts to seriously degrade. This leads to a vicious circle where worsening performance increases the number of times the Fixed Update is called in a frame, further degrading performance. This usually happens when the FPS drops below 10.
In the section under the blue line, you can see the Update part, which occurs every frame. Typically, when performance significantly degrades, this is the main trigger. Let's zoom in on the Update part.
The green line represents where most of the game logic is executed, including enemy movement, projectile updating, and weapon attacks. In red, you can see the coroutines, which are functions that are called with a time delay. For example, the katana multi-slashing uses coroutines, as does Thunder Spirit, which is the main focus here. One notable observation is that Thunder Spirit alone consumes half of the entire logic processing used by the game, indicating a potential area for optimization. Upon closer examination and exploring different aspects, it was discovered that the initiator for Thunder Spirit, responsible for gathering nearby enemies, was also resource-intensive. Checking the distance of hundreds of enemies every time Thunder Spirit procced was highly costly and could consume up to 10-20% of the total processing time for a frame. Ultimately, a complete rework of Thunder Spirit was necessary to reduce the lag it could cause. This rework resulted in a performance improvement from around 4-6 frames per second (fps) to 5-9 fps, which, while not insignificant (a 15-25% performance gain), It's still not enough to have proper performance So yeah, let's continue to do that and rework what really lags the game then? Well, cases like this are quite rare. The vast majority of performance costs come from simply processing projectiles with enemies, which is roughly: Check collision > Check if the collision is with an enemy > Apply Damage to the enemy > Call related events. Nothing consumes more performance than it should. And I don't see any other way to handle these in a more performant way. The issue is the sheer amount of projectiles the game has to handle. To give you an idea, in the previous example, there were a total of 3500 successful collisions between a projectile and an enemy. 3500 IN 1 FRAME. No amount of optimization would be able to handle these sorts of situations. So the next thing I did was reduce the number of elites spawned in Elite swarm, reducing the spawn rate by 8. Would surely increase performance 8-fold? Nope, while decreasing the enemy count did improve performance, it roughly went from 5-9 fps to 10-13 fps, another significant gain, but still far too low to be called "good performance." The main issue is just the sheer amount of projectiles processed. Even with a lower enemy count, the projectile count wouldn't be reduced. Update 0.9 came with a weapon cap, with the goal of reducing the performance impact of having too many projectiles spawned. But even 2 or 4 weapons with enough attack speed and projectiles would bog down any computer, regardless of the power of its CPU. So here I am, trying to find a solution to reduce the projectile count (all other solutions weren't enough until now). There are, of course, different ways to do it: cap the projectile count and attack speed more aggressively, remove Fractal from the game, reduce the projectile lifetime, cap the maximum number of projectiles that can be spawned, or nerf attack speed/projectile bonuses. But it's essentially a player nerf that needs to happen, I don't see any other way around it. So I'm still trying to find a better solution and keeping it as a last resort if everything else fails. I did hired someone back in janurary, but due to serious issues, she couldn't deliver on time and had to step down for multiple month, Today, she still working on that, but due to the many change to the game code since then, she'd had issues with it. So there is a bit of hope about that, but there is still a limit to what optimisation can do. I would also like to address a suggestion I've seen appear many times: creating a "not visual" mode. Do you remember the graph at the beginning?
The yellow part is how costly the graphics part is for the CPU. As you can see, it's a negligible fraction of the issues, and spending effort to make this sort of change would be insignificant compared to the issues at bay. Even more so when you consider that almost half of the processing time goes to visual effects, which don't happen when the Visual Effect setting is set to low in the Video settings. (The engine upgrade to Unity 2022 was a major improvement to the visual effect performance cost since it allowed the instantiation of multiple similar visual effects.)
Now, let's talk about GPU performance. So far, if your GPU can run the game, it shouldn't be an issue even in situations of high load due to the CPU being overwhelmed. Most of the performance cost of the game comes from either visual effects (when a lot is happening), post-processing, volumetric fog, and the resolution of the game, All of these effect quality settings can be lowered or disabled for better performance. The game at the minimum settings in 1920x1080 resolution should run on most specs, from my experiences. In-game graphics settings also have a significant impact on your GPU performance. Lowering the quality in-game will significantly boost your FPS. To give you a detailed breakdown, here is the game running on ultra settings in an absurdly high resolution (8000x6000)
And looking at the details, 21ms of calculation is used by the post-processing (mainly depth of field), 12.9ms is used by ambient occlusion, and 6.3ms is used by volumetric lighting.
All of these effects are resolution-dependent, so a lower resolution will immensely reduce the GPU usage. Let's check how much time it now takes to render with a 1920x1080 resolution (which I believe is enough for the game).
As you can see, the render time has been dropped from 66ms to 4.7ms. (Ignore the Upper graph, as it's inaccurate due to this being done in the editor.) Now, let's set the game to minimum settings at the absurdly high resolution from before (8000 x 6000).
Most of the usage of gpu is : [olist] GBuffer: This is normal due to the ridiculously high resolution and the number of pixels it needs to handle (48 million pixels, or about 24 times more than a 1920x1080 resolution).
Deferred lighting: This accounts for the cost of lighting all the sprites per pixel. While forward rendering is usually faster, it incurs increasing lighting costs with the number of lights, whereas deferred lighting has a much cheaper cost per light.
Post-processing: This includes effects like bloom, color correction and Tone-mapping.
[/olist]
Even when you combine the usage of all these elements (15ms), it is still lower than just the post-processing on Ultra settings (21ms).
Could the GPU performance be improved? Likely only a little bit. The game runs on Unity HDRP Scriptable Pipeline, which consumes a certain baseline of resources.
Removing remaining effects won't significantly boost performance. Most of these are necessary for the visual style of the game, and the minimal settings already strip off most costly ones.
Finally, I don't think more optimization is necessary for the graphics part. The game on low settings at 1920x1080 can run on computers that don't even meet the minimal specs, and recommended specs can run the game at 1920x1080 on ultra settings.
Sure, the performance gets much lower at higher resolutions, but I don't think running the game at 4K would bring anything graphically (outside of a slightly sharper UI).
The only thing that could be done is an implementation of FSR/DLSS, especially as it's a supported feature by Unity 2022, but it's clearly a low priority as it would only increase performance for higher-resolution displays.
I hope you can now understand what is affecting the performance of the game, what my priorities are, the issues I'm facing, and my own questions on how I can improve them.
You are more than welcome to react, ask questions, or let me know if something wasn't clear. Thank you for reading this.
[ 2023-09-03 02:03:41 CET ] [ Original post ]
Hello
Before I begin this deep dive into this post, I would like to thank everyone who participated in the poll. I have already received responses from over 300 participants, and the data I have obtained is very important and valuable (along with some recent quality-of-life suggestions that were added this morning). In the current results of the poll, I've noticed that many players are concerned about the performance of the game. So, I believe a post focused on this topic would greatly help players understand the game's performance issues (and also help me maintain my own mental health). This post will mainly focus on CPU performance, with a section about GPU performance at the end.
My Reaction to Performance Complaints
(You can skip this part if you're only interested in the technical aspects) I might be seen as aggressive towards players who complain about performance issues, and while there may be reasons for this, it's still out of place, and I apologize if I come across that way. I can be quite straightforward and severe about such matters. Contrary to what people may think, I'm not a robot. I know my update rate can give the opposite impression, but I assure you I'm human. And like any human, I have mood swings, difficult days, as well as pride and ego. We all do; there's no need to pretend otherwise. Especially as time goes on and I sink more and more hours into game development, I find it difficult to take breaks for more than a day without feeling guilty. This is a common experience among developers, and I'm not immune to it. (I mean, i've been trying to take a week-long break for 4 day in a row now, and still making update to the game...) Optimization has always been an important focus during the development of Rogue: Genesia. While many may believe it's not optimized, the game is actually very well optimized. The main reason is that there's a lot going on, and I mean A LOT. But it's not just a lot... it's A LOT LOT! It doesn't help that the maximum displayed damage numbers per frame are set at 10 by default (this can be changed in the options). To give you an idea, this is what it would look like with a higher limit of around 400 damage numbers per frame:
And yes, what's happening in those screens is quite tame and easily runs at 60 FPS in the game. However, there are performance issues in the game, and I'm not blind to them. I know it's still a concern. Nevertheless, I've reached the maximum level of optimization that can be done, and it's frustrating to hear comments like, "How badly the game is optimized," "Other games in this genre are better optimized," "It's just sprites, why is it running so poorly?" "It's just a 2D game," especially considering the effort I've put into improving the game's performance. I can understand their frustration too. There are situations where the game becomes a slideshow, and their concerns are valid. It's a strange situation where I usually try not to respond or be aggressive, but my frustration can sometimes take over, and my replies can come across as aggressive or, at the very least, unfriendly. Well, anyway, the counseling session is over. Let's get into the nitty-gritty of what's causing the performance issues and how they can be improved upon!
CPU Performance and Late-Game Slideshow
Many of the significant performance issues players experience are due to the CPU being overloaded by the game's processes, and in this context, graphics have little impact.
So, how does a developer optimize a game?
First, by profiling performance, identifying performance-intensive elements, and devising solutions to reduce the performance cost of these elements. Let's begin with profiling, and I'll start with an example I encountered this morning, which led to a rework of the Thunder Spirit. I had a save file just before an Elite Swarm encounter (I know these are particularly bad for performance), with a ton of weapons, attack speed, and projectiles. It was the perfect scenario to turn the game into a slideshow.
A bit confused ? let me guide you In the top half, we have the performance graph, which represents the duration of each frame. Here's what each color represents:
- Yellow represents "Idle time" which indicates moments when the CPU is either waiting for the GPU or waiting for the vsync.
- Orange represents "Physics" which includes everything related to collision and physical body movement.
- Blue represents "Scripts" encompassing calculations made in the game's code.
- The brownish-green section is labeled as "Other" accounting for a variety of miscellaneous processes done by the game engine.
The section with the purple line represents everything happening in the Fixed Update. This includes collision detection from projectiles and the processing of these collisions, such as applying damages, activating card effects, and validating monster deaths. As you can see, it accounts for a significant portion of the performance cost. The thing about the Fixed Update is that it can occur multiple times during a single frame when performance starts to seriously degrade. This leads to a vicious circle where worsening performance increases the number of times the Fixed Update is called in a frame, further degrading performance. This usually happens when the FPS drops below 10.
In the section under the blue line, you can see the Update part, which occurs every frame. Typically, when performance significantly degrades, this is the main trigger. Let's zoom in on the Update part.
The green line represents where most of the game logic is executed, including enemy movement, projectile updating, and weapon attacks. In red, you can see the coroutines, which are functions that are called with a time delay. For example, the katana multi-slashing uses coroutines, as does Thunder Spirit, which is the main focus here. One notable observation is that Thunder Spirit alone consumes half of the entire logic processing used by the game, indicating a potential area for optimization. Upon closer examination and exploring different aspects, it was discovered that the initiator for Thunder Spirit, responsible for gathering nearby enemies, was also resource-intensive. Checking the distance of hundreds of enemies every time Thunder Spirit procced was highly costly and could consume up to 10-20% of the total processing time for a frame. Ultimately, a complete rework of Thunder Spirit was necessary to reduce the lag it could cause. This rework resulted in a performance improvement from around 4-6 frames per second (fps) to 5-9 fps, which, while not insignificant (a 15-25% performance gain), It's still not enough to have proper performance So yeah, let's continue to do that and rework what really lags the game then? Well, cases like this are quite rare. The vast majority of performance costs come from simply processing projectiles with enemies, which is roughly: Check collision > Check if the collision is with an enemy > Apply Damage to the enemy > Call related events. Nothing consumes more performance than it should. And I don't see any other way to handle these in a more performant way. The issue is the sheer amount of projectiles the game has to handle. To give you an idea, in the previous example, there were a total of 3500 successful collisions between a projectile and an enemy. 3500 IN 1 FRAME. No amount of optimization would be able to handle these sorts of situations. So the next thing I did was reduce the number of elites spawned in Elite swarm, reducing the spawn rate by 8. Would surely increase performance 8-fold? Nope, while decreasing the enemy count did improve performance, it roughly went from 5-9 fps to 10-13 fps, another significant gain, but still far too low to be called "good performance." The main issue is just the sheer amount of projectiles processed. Even with a lower enemy count, the projectile count wouldn't be reduced. Update 0.9 came with a weapon cap, with the goal of reducing the performance impact of having too many projectiles spawned. But even 2 or 4 weapons with enough attack speed and projectiles would bog down any computer, regardless of the power of its CPU. So here I am, trying to find a solution to reduce the projectile count (all other solutions weren't enough until now). There are, of course, different ways to do it: cap the projectile count and attack speed more aggressively, remove Fractal from the game, reduce the projectile lifetime, cap the maximum number of projectiles that can be spawned, or nerf attack speed/projectile bonuses. But it's essentially a player nerf that needs to happen, I don't see any other way around it. So I'm still trying to find a better solution and keeping it as a last resort if everything else fails. I did hired someone back in janurary, but due to serious issues, she couldn't deliver on time and had to step down for multiple month, Today, she still working on that, but due to the many change to the game code since then, she'd had issues with it. So there is a bit of hope about that, but there is still a limit to what optimisation can do. I would also like to address a suggestion I've seen appear many times: creating a "not visual" mode. Do you remember the graph at the beginning?
The yellow part is how costly the graphics part is for the CPU. As you can see, it's a negligible fraction of the issues, and spending effort to make this sort of change would be insignificant compared to the issues at bay. Even more so when you consider that almost half of the processing time goes to visual effects, which don't happen when the Visual Effect setting is set to low in the Video settings. (The engine upgrade to Unity 2022 was a major improvement to the visual effect performance cost since it allowed the instantiation of multiple similar visual effects.)
GPU performance
Now, let's talk about GPU performance. So far, if your GPU can run the game, it shouldn't be an issue even in situations of high load due to the CPU being overwhelmed. Most of the performance cost of the game comes from either visual effects (when a lot is happening), post-processing, volumetric fog, and the resolution of the game, All of these effect quality settings can be lowered or disabled for better performance. The game at the minimum settings in 1920x1080 resolution should run on most specs, from my experiences. In-game graphics settings also have a significant impact on your GPU performance. Lowering the quality in-game will significantly boost your FPS. To give you a detailed breakdown, here is the game running on ultra settings in an absurdly high resolution (8000x6000)
And looking at the details, 21ms of calculation is used by the post-processing (mainly depth of field), 12.9ms is used by ambient occlusion, and 6.3ms is used by volumetric lighting.
All of these effects are resolution-dependent, so a lower resolution will immensely reduce the GPU usage. Let's check how much time it now takes to render with a 1920x1080 resolution (which I believe is enough for the game).
As you can see, the render time has been dropped from 66ms to 4.7ms. (Ignore the Upper graph, as it's inaccurate due to this being done in the editor.) Now, let's set the game to minimum settings at the absurdly high resolution from before (8000 x 6000).
Most of the usage of gpu is : [olist]
[ 2023-09-03 02:03:41 CET ] [ Original post ]
Rogue: Genesia
Huard Ouadi
Developer
iolaCorp Studio
Publisher
2022-09-19
Release
Game News Posts:
193
🎹🖱️Keyboard + Mouse
🎮 Full Controller Support
🎮 Full Controller Support
Very Positive
(5325 reviews)
Public Linux Depots:
- [387.69 M]
Game is not tagged as available on Linux on Steam.
Walk upon a new world and slay foes endangering it.
Master of all weapons, Rog can use anything to slay his numerous foes.
Kill, grow stronger, and kill some more!
Fend against vast enemy forces, reaching hundreds of foes on screen at any given time
In this action rogue-lite, you play as Rog.Master of all weapons, Rog can use anything to slay his numerous foes.
Kill, grow stronger, and kill some more!
Make your build from more than 60+ passive upgrades and 16 weapons.
You define Rog's adventure
You can choose which path Rog takes, feel brave enough to take on a powerful foe, or would you prefer to rest at the shop? The choice is yours!30+ Powerful Items to discover
On this journey, you'll collect many unique and powerful artefacts that will greatly impact your game experience, harness their power to help you on your quest!GAMEBILLET
[ 6132 ]
GAMERSGATE
[ 2625 ]
FANATICAL BUNDLES
HUMBLE BUNDLES
by buying games/dlcs from affiliate links you are supporting tuxDB