0

I have a SpriteKit game that I have created, and I have been trying to improve the frame rate for a while (currently it drops down to around 45). Most recently I have been checking for the number of "draws" I have as this has been recommended to me. I am doing this by setting the variable showsDrawCount to true when I present my scene. Currently, my scene has 55 draws.

enter image description here

Will this slow down my frame rate? If so how many draws do there need to be to start slowing down the frame rate? and how should I decrease the draws? Thanks in advance.

edit: I have fixed part of the problem by moving the draw functions from sceneDidLoad to didMovetoview and it has reduced my draws to

enter image description here

by the way the thing that is taking the majority of my draws (18 I believe) is this: enter image description here

note: the phone that I am testing on is the iPhone 5s, and it has the PowerVR Series 6 GPU

joshLor
  • 1,034
  • 1
  • 12
  • 27
  • 2
    "is this too many" leads to an opinion based answer. Also, too many for what GPU? For what situation? – Krythic Apr 07 '17 at 03:58
  • @Krythic Thank you for the commentary I updated the question. – joshLor Apr 07 '17 at 04:08
  • Take a look at this http://stackoverflow.com/a/22856964 – Whirlwind Apr 07 '17 at 05:52
  • 55 passes to draw 22 nodes? Shurely shome mishtake? that's more than one pass for each node - do you have many SKShapeNodes, nodes with non-standard blending mode etc etc? Is `ignoresSiblingOrder` true or false?I think we'll need to see some code before we can help. – Steve Ives Apr 07 '17 at 07:44
  • I'm getting 60fps with 181 nodes in 22 draw calls, so you might want to investigate why you need so many draw calls - check sibling order, textures, SKShapeNodes etc. – Steve Ives Apr 07 '17 at 09:29
  • what kind of nodes are these? – Knight0fDragon Apr 07 '17 at 14:28
  • @SteveIves I believe that I have found a large part of the problem. I have been drawing my shape nodes in scene did load. Scene did load has been running twice so it is almost doubling my number of draws. – joshLor Apr 07 '17 at 14:55
  • @joshLor Apparently 'sceneDidLoad' is called twice, but it's only called when the scene is loaded. It should have no effect on your frame rate or draw calls. – Steve Ives Apr 07 '17 at 14:59
  • @SteveIves Scene did load is called twice as you can see here: http://stackoverflow.com/questions/39590602/scenedidload-being-called-twice – joshLor Apr 07 '17 at 15:29
  • @joshLor I know, but surely sceneDidLoad is not part of the game loop and so should not impact frame rate? – Steve Ives Apr 07 '17 at 15:32
  • 1
    @SteveIves Oh it is just creating twice the elements that it should as it is creating them twice – joshLor Apr 07 '17 at 15:34
  • Ok - I see what you mean. But you still seem to have too many draws for the number of nodes. You might be able to halve the number of nodes, but you should be able to more than halve the number of draw calls. – Steve Ives Apr 07 '17 at 15:36
  • @SteveIves I added so information to my question so that you can see it – joshLor Apr 07 '17 at 16:00
  • @joshLor I still think you have too many draws fro the number of nodes. It'd be interesting to see your code. – Steve Ives Apr 13 '17 at 13:40
  • @SteveIves Do you mean in total or for the given image – joshLor Apr 13 '17 at 14:22
  • @joshLor for your scene that uses 35 draw calls for 16 nodes. – Steve Ives Apr 13 '17 at 14:24
  • @SteveIves not including that sprite I have 11 nodes with 17 draw calls. – joshLor Apr 13 '17 at 14:29
  • @joshLor You still have more draw calls than nodes, whereas examples in this thread have less draw calls than nodes. If you could post your code it would help people to see why this is so. – Steve Ives Apr 13 '17 at 14:33
  • @SteveIves I am also drawing out two other sprite that together make up the difference I believe. – joshLor Apr 13 '17 at 14:54
  • @joshLor This is a bit old, but as a test I created an app with 4600 sprites on screen - it uses 1 draw call and runs at 60.0 FPS (iPhone 6S), so you really need to work out why your nodes/draw calls ratio is a bit out of whack. – Steve Ives Jun 29 '17 at 08:17
  • Yeah, I figured out some other things that were slowing it downa timer and admob – joshLor Jun 30 '17 at 19:09

0 Answers0