I’m working on a 2D metroidvania type game with detailed and large backgrounds roughly 24,000 px x 16,000 px per level. Developing on a windows10 machine 64bit, with 16gb ram.
initially I’ve separated the backgrounds into smaller pieces at first 3 to 6 files at 3,000 px by 3,000 px resolution weighing in from 3mb to 13mb for each file. this was an utter disaster no matter what I’ve tried I couldn’t load them without a stutter.
Now I’ve spliced the backgrounds into hundreds of images at 1024px by 1024px 54kb to 250kb each and stacked hundreds of sprite2Ds next to each other and it works well for a quarter of the background and stuttering begins after 50 ish images about 1/4 of the total I need per level.
I’ve tried every texture filter option under the sun, I’ve enabled occlusion culling, tried smoothing the camera, lowered resolution of all images to 72DPI, tried writing a script to make sprites invisible that are outside of cameraviewport, tried using textureRectangle instead of Sprite2D (that was even worse results), V-sync has been off, The stutter increases with resolution change and my aim is 3840x2160.
I’m honestly pretty burned out and I feel like I’m missing technical expertise like how to trouble shoot what is causing the frame drops. I’m also out of ideas on how to have large cool backgrounds in my game without seperating them via loading screens.
If anyone has any examples or similar projects please let me know what else I can do.
Did you figure out a fix for this issue? I’m having stutters whenever my mouse moves with just a 3440x1400 backgrounds using Parallax2D nodes using 1 tilesheet.
Hi @alsofungames after bashing my head against the wall for months I began paying attention to “Memory: MiB” in my sprites. Keep MiB number as low as possible. it’s seen in the bottom right of your texture file when you expand.
I won’t pretend to understand how it works but what I noticed is that DPI has an exponential impact on it. saving backgrounds at 72DPI creates 6 MiB while my initial 300 DPI it would be like 40,000+ MiB so splice your backgrounds according to your needs I went with 1500x1500px for buttery smoothness.
Also pre-load all levels on your initial start menu as it’ll just help with walking through different levels. Honestly as much as I’d like to help you this is a highly personal issue so if this doesn’t help reach out and I’ll do my best to trouble shoot with you.
You’re not alone and this is insanely infuriating.
Isn’t using power of 2 textures for better performance a thing anymore? Picked up the habit in the early GPU days, enforced by working on mobile games 20 years ago at a big studio.
You need the texture to fit on your GPU VRAM ideally, otherwise you’re losing a lot of performance by having to load and reload the texture, possibly leading to cascading side effects.
Performance is about data : is the form it’s in friendly to the hardware you’re running on ?
Have you tried multiple 1024x1024 textures to build your background?
I haven’t heard of this thank you for letting me know.
In my prototypes I’ve gone down to as low as 200x200 images with occlusion culling etc. and it was still lagging due to the actual images being higher res than they needed to be. I will be trying to apply your suggestion going forward.