When it comes to developing games for mobile devices, graphics APIs (important in 3D configurators projects) like OpenGL and Apple`s Metal have become the gold standard. These APIs connect the hardware of mobile devices such as GPUs to the software and enable resource-intensive graphics playback to bring complex games and animations to life.
However, it offers much more than just a complete graphics software package. To fully exploit the power of an API, developers need a graphics rendering engine that lies between it and the application framework.
Apple wanted to offer developers integrated, proprietary graphics rendering infrastructure for even better integration with their own hardware, and that`s where SpriteKit and SceneKit come in. Both frameworks are used together with the Core Animation Framework, QuartzCore and GLKit, a forerunner of SceneKit and SpriteKit, to add animations to iOS apps and games.
Both are suitable for different levels of complexity when it comes to adding animations to an application. In this article we take a quick look at SpriteKit and SceneKit, what they are best at end which is best for your project.
SceneKit: 3D scenes & game animation.
SceneKit is the more powerful option of the two, based on the Core Animation Framework and requires a good piece of math and geometry. Think: 3D games that have multiple camera angles, like Fruit Ninja. It`s a high-level 3D graphics framework for creating animated scenes with a rendering engine and a descriptive API that does a little more leg work for you than minor APIs like Metal.
SceneKit was released with Lion iOS and was designed to make it easier for developers to create complex 3D scenes because it “only requires desciptions of the content of their scene and the actions or animations they want to perform”. The hierarchical “Scene Graphics” allows you to execute animations before they are rendered by a device`s graphics processor, increasing efficiency.
SpriteKit: Ideal for simple 2D animations.
SpriteKit is a framework for 2D animations on a simpler level – think of child 2D animations in more efficient applications that don`t need much battery power, like Candy Crush or Angry Birds. SpriteKit came after SceneKit (releases with iOS 7) and gave developers all the tools they needed to create 2D animated sprite-based games from scratch without the need for the OpenGL graphics API.
For the non-developer, sprites are a single file that contains all the graphics for an entire web page or game, from which individual graphics are drawn. A sprite is dowloaded once and smaller graphics are placed on the screen based on coordinates. This essentially means that an application doesn`t have to make numerous, time-consuming and resource-intensive calls to an image and animation server that simply accesses the sprite. SpriteKit in turn processes each rendering with a traditional rendering loop.
Some basics you should know.
Key feature: SpriteKit allows developers to focus on more important and sophisticated design and gameplay aspects, not on minor tasks such as submitting drawing commands to the API.
SpriteKit & SceneKit together.
It is important to note that the two frameworks can also be used together. A 2D SpriteKit scene can be placed over a 3D scene or added as a background, foreground overlay or object texture. Regardless of which framework you use for animation, make sure you are familiar with Apple`s Visual Design animation standards.