AtomProgrammer AtomProgrammer - 1 year ago 223
Swift Question

SpriteKit Vector graphics performance

For my SpriteKit game I am using a single pdf vector graphics for my SKSpriteNodes rather than many png sprites for all device resolutions for every entity in the game. the benefits of not having to worry too much about the graphics of the game have dramatically helped but my question is simple, would using vector graphics be a bad idea performance wise? I am sorry if this question has been asked, I have searched but haven't found an answer I am looking for.

Answer Source

Wait, you are NOT using a PDF as texture for the SKSpriteNode

Instead you are probably using a PDF into the Xcode Asset Catalog right?

enter image description here

In this case, first of all this is a really good idea and it does NOT impact the performance of your game. Infact when you load a PDF image into the Xcode Assets (and you set the Scale Factors to Single Vector), you are not using the PDF into your app or game.

As soon as you compile the app, Xcode automatically generates the PNG versions for the several resolutions.

E.g. if you game does support any device running iOS 9 then Xcode automatically generates the 1x, 2x and 3x PNG (bitmap) images from your original PDF (vector).

Another great benefit of this approach: if in the future Apple does release a device with a 4x pixel density, Xcode will likely be updated to support that and you'll just need to recompile your app to automatically generates the 4x images.


So the answer to your question is: NO. The PDF image will not impact your game performance simply because the game is not using the PDF, it's using the PNG instead (even if you can't see it).