0

Most of my game's levels are bigger than the screen size, so the camera follows the player around the level. The level is populated with several objects, such as platforms and mines. Looking at the level as a whole, these platforms and mines don't ever move around the level (never doing anything in the update method or using SKActions), but on the screen they appear to be moving around because the camera is following the player. I understand setting the scene's shouldRasterize property to true should improve performance for nodes that don't move. So my question is does the scene view the platforms and mines as moving or stationary/ will setting the shouldRasterize property to true help me out in this case?

claassenApps
  • 1,137
  • 7
  • 14

1 Answers1

0

As you noted shouldRasterize does save the rendering of a node (and every descendants) in memory. So if the next frame nothing has changed the cached rendering is used.

You said that nothing really changes in you scene. Are you sure? Not even the player? If so then shouldRasterize = true should make the rendering faster. Otherwise, if even a single visibile node changes is appearance over the time, you should not set shouldRasterize to true.

Just test it

Testing the best approach is very easy in this case. Simply run your game in both modes (shouldRasterize = false and then shouldRasterize = true) and check when the framerate is higher.

Final considerations

Why are you considering this kind of optimizations? Is your game slow? If your game is simply a scene scrolling without any movements and it is slow maybe there is some problem that you should fix before applying any optimization.

Luca Angeletti
  • 58,465
  • 13
  • 121
  • 148