Starting Game Design in Swift and Sprite Kit

To begin with game design in Swift I needed to learn more about the development engine. One way game designers make games for IOS is by using a library called Sprite Kit. Sprite Kit is especially useful for game design as it uses a rendering loop where the information for each frame is processed before being shown to the screen. It also has some other features which are used for game design such as a physics engine and support for sound integration.

update_loop_2x
Here is the way the frame cycle works in Sprite Kit. The diagram shows in which order the methods are called.

Like in Processing, Sprite Kit has a series of methods that are called in sequence in order to calculate what objects need to be moved or affected before the game displays the next frame.

Understanding this is important to making our game as we will need to process when the user taps the screen to make the character jump. We will also need to calculate when certain events need to be triggered.

2014-06-13-DiffusionOfInnovation-thumb
Eid, 2014

Although Swift and Sprite Kit provide a good framework for game development there are also some problems that might arise from using this language and framework. One of the main problems is that since the language is so new (it only came out in 2014) there is a lack of tutorials and bug support for the language as it is still in it’s early adopters phase, as seen in the diagram above.

Apple’s global smartphone market-share is hovering at around 20%. Meanwhile, mobile device usage has already surpassed desktop device usage and continues to grow. These stats make two things very clear: the future is mobile and mobile extends FAR beyond the Apple ecosystem. Developers wishing to engage the majority of mobile audiences need to reach beyond Apple’s ecosystem and Swift won’t help.

The best hope for cross-platform mobile development continues to rest with HTML5, CSS and JavaScript. These technologies are widely used, widely understood, widely supported and (perhaps most importantly) their fate is not controlled by a single company. By using web technologies, developers can write their app once and launch it to Android, iOS, Windows Phone or any modern device. And in cases where HTML doesn’t support a specific mobile feature technologies like PhoneGap exist to ‘bridge the gap’.

(Gabe, 2014)

Another problem with Swift (and developing for IOS in general) is that the language is currently Mac exclusive. To use XCode (Apple’s IOS IDE) you need an Apple account and device to develop on and to test your app on a physical device you need an Apple developer account. This will make it hard for those of us on our project without an Apple device to work on the project.

Overall Swift and Sprite Kit should bring some benefits to game development for IOS, however it also brings some challenges that we should be wary of.

Developer.apple.com, 2015. About Sprite Kit. Available from: https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html [Accessed 10.03.2015]

The Huffington Post, (2015). Apple’s Swift is Great, but Objective-C is not Going Anywhere. [online] Available at: http://www.huffingtonpost.com/ahmed-eid/apples-swift-is-great-but_b_5492239.html [Accessed 16 Apr. 2015].

The Huffington Post, (2015). Why Most Developers Should Avoid Apple’s New Swift Language. [online] Available at: http://www.huffingtonpost.com/gabe-sumner/why-most-developers-shoul_b_5454013.html [Accessed 16 Apr. 2015].