- Home /
2D game performance keeps slowing tremendously when resolution is at 1080p (1920 x 1080)
I have been working on the main menu options of my 2D game for PC builds for some time now under a resolution of 720p (1280 x 720), and it had been running very smoothly above 60 fps most of the time. I basically have been working with PNG images as sprites and backgrounds for building a proper aesthetic without the reliance of post-processing or unique shaders.
I have decided, however, to restructure the game into a higher resolution of 1080p to meet today's more common gaming platform standards. This meant having to enhance the sizes of most of my previous art assets by 150%. Upon applying all these assets into the new build though, the game suddenly has slowed down to an average rate of 40 fps, and no matter how much I try to optimize the game by compressing images and removing pointless methods in the code, the game remains sluggish.
I don't fully understand why no improvement can be made to the game at a higher resolution. Though, I am certain the general causes are related to the larger texture files upsetting the GPU. For instance, I have a 3840 by 1080 px sprite that resembles a fog that is meant to scroll across the screen in a repetitive loop. I did what I could to compress the size, but no luck. I also resorted to rendering the image as a material for a quad instead to allow its wrap mode to repeat, but it also doesn't bring much improvement and it doesn't allow me to filter the alpha properly to my expectations. In addition, I have a lot of large tree sprites set in the background to move along the background when I execute the illusion of moving across the scene. Again, I have compressed them to reduce filesize usage, but no change. It all still works perfectly at 1280 x 720 resolution, so I'm baffled on why the render time would change so drastically from a 50% increase in screen size.
I'm beginning to think the issues are due to my graphics card (AMD Radeon HD 7730M and Intel(R) HD Graphics 4000). It might also be due to my version of Unity being at 2018.2.20f1. Can anyone tell me if these are the possible reasons for my game's slow performance? Or am I really neglecting a certain technique to further optimize the processing power usage? I swear, I have tried nearly everything I've read up upon to make it happen, like Static batching or Occulsion culling. Please let me know of any other solutions.
3840 by 1080 px is a massive sprite especially if its an animated one. What is your art style? Do they genuinely need to be that big? Not only that because its not power of 2 its also a poorly optimised one.
Your game is probably really poorly optimised. This is often the case with poorly optimised systems. They are fine until you put any amount of stress or load on them and then they completely fall apart. Without more information about how the game is structured, any efforts that have been made to optimise, profiling information etc its really hard to say specifically whats slowing your game down.
These are some examples of the art assets in use. The top one is a frontward fog that should only take the bottom third of the screen. Its color and texture should be somewhat similar to the fog that takes up the full screen, which I cannot upload here due to size. The tree is one of up to four present in the scene. These trees are programmed to zoom in as they scroll to the left of the scene to simulate the idea of walking past them. The zoo$$anonymous$$g feature is obviously going to use up more processing power, which is why I make sure to remove them once outside the canvas. Are these any indication of problems for optimization?
Here's a sample of the overall game scene to further clarify the details of the art assets in use. Note the transparent fog engulfing the canvas. Please don't $$anonymous$$d the offset hand and GUI text. They are meant to be enlarged later on, since they were originally created for 720p res.
Good question. Just to ask, are there any downsides for you for just giving a try of updating to the latest Unity (2019.3.0f6), to confirm whether the issue there still exists or is gone? If there's no downsides to that upgrade, then I would say (normally) the newer the better.
Once you've done that, you might want to look at the Unity Profiler to see what is causing the most lag. In particular, if you still have the old pre-resolution-increase version in a repo, consider the before-after situation in the Profiler. This could pinpoint the exact thing that's now taking longer.
Good luck!
I actually upgraded to 2019.3 earlier last night. There seemed to be a small percent of improvement in runtime, but the overall processing is still slow as a sloth. I sent a screencap of the project as seen within my reply to a previous answer, which displays the stats of the game's process. Strangely, the FPS often reads around 80, but it still moves like it was 40. I've checked the profiler and noticed a lot of the GPU's usage is co$$anonymous$$g from the transparent rendering, but may also have to do with the constant draw calls of the art assets, according to the frame debugger. In any case, does whatever I post in the image give any further clarification on the issue I'm going through?
Does the lag still appear in the build, i.e. when adding an FPS counter, compiling, then running the Exe? I'm asking as Unity Editor sometimes adds odd, non-fully-representative lag. (Though it's usually indicative of something wrong indeed.)
Answer by suIly · Feb 03, 2020 at 07:13 PM
It's the 4k fog that scrolls across the screen that's slowing it down, try reducing it to 720 or 1080p :)
Could you clarify? $$anonymous$$y game IS at 1080p, and I'm not sure what you mean by reducing IT. I am not aware of any setting that can reduce a PNG texture or sprite based on a screen resolution. Did you mean reduce the max size of an image to something like 1024 or 512? Either way, I have already compressed the fog as best as I could without disrupting to much of the detail. So I don't think that alone is the problem.
Your answer
Follow this Question
Related Questions
Why my game is so god damn slow on Droid ? 0 Answers
Sudden Framerate drops at random times?? 2 Answers
Optimizing framerate on lots of billboards 2 Answers
VSync won't disable 3 Answers
Movement cutting frames in half? 1 Answer