Large sprite issues

So currently I’ve been working on a boss fight in my game which includes a boss with the canvas size of 1800x900. I know this is kind of messy since it’s almost as big as a 1920x1080 screen, so it sure will slow down the game theoretically. It literally makes the game crash daily because it uses too much of the memory. However, it’s not only a huge object, but also an object with over 600 frames and 50 animations. I’m hoping to find a way to reduce lagging without removing or remaking this boss.

The other reason why I’m still not giving up is that in my previous game, I made a boss with slightly smaller canvas size (1350x900) which caused no lagging at all. I have some hypothesizes:

  1. The current boss has much more frames and animations than the previous one.
  2. The movement of the camera in the current game is more frequent and faster.
  3. The current game uses animation names to switch animations while the old game uses animation numbers.

By the way, my game resolution is originally 2400x1440, but since it is too big for most of the computers, I change the camera zoom and apply lower resolution. This method did improve the performance at the beginning, but it doesn’t seem to be working anymore.
image
Maybe I decided the canvas size too early when these problems weren’t so apparent. Anyways, I’m still looking forward to finding a solution to keep the current canvas size and improve performance.

To answer your initial question “is there something that can be done outside of remaking this boss”:
No, there is not.

A 1800x900 size sprite is 6.5 mb of VRAM in a GPU (textures are uncompressed when loaded into a GPU, so the memory size would be length * width * RGBA (4 pixels for color and alpha)). That’s for a single frame. at 600 frames for a single animation, that’s 3.9 gigabytes for your animation to be stored in your GPU’s ram.

For context, Hollow Knight’s largest single sprite size is 500x500, with the screen size ones broken up into separate parts. This allows for the parts not currently being rendered to more easily be culled from memory. Also, most of Hollow Knight’s bosses have most of their parts as non-animated single frames that are moved with game logic, so there’s no animation frames being loaded.

Edit: Your previous posts mentioned you were using Skul as a reference/comparison. I did some digging and Skul’s native resolution is 640x360 and their largest sprite has a max height of 400. Your assets, unfortunately, may just be too large for your GPU (or most game engines). Scale and create captivating 2D pixel art | Unity Blog | Unity Blog

2 Likes