I need a suggestion. I am making a game with lots of SKShapeNodes. So my FPS is about 18. Has anybody suggestions about how to increase FPS in games like this? Amount of SKShapeNode in the full game scene are 220.
1
votes
1 Answers
1
votes
SKShapeNode
is rather performance intensive because SpriteKit is rasterising (computing the pixels of your shape) every frame instead of calculating it once and than reusing it.
The two options I see are :
- Creating
SKTexture
(s) object(s) with your shape nodes, and than displaying those textures withSKSpriteNode
instead of displaying directly yourSKShapeNode
objects. - Making some/all of your
SKShapeNode
objects children ofSKEffectNode
and set itsshouldRasterize
property totrue
, what it means is that it will rasterise theSKEffectNode
children once, cache what has been rendered and reuse it while there is no change.
What you should use depends on what you are trying to achieve, is the shape of those nodes changing over time ? Are those shapes moving around ? Is it all of them changing/moving or only some of them ?