Joseph McMahon - SpriteKit as an Intro to SceneKit and Metal

Joseph McMahon - SpriteKit as an Intro to SceneKit and Metal

Joseph McMahon presenting at the September 2015 Brooklyn Swift Developers Meetup: http://meetup.com/Brooklyn-Swift-Developers/events/225289456/

Video: https://youtu.be/MSLi7ACh2Ks

Tweet

Transcript

  1. SpriteKit as an Intro to SceneKit and Metal Joe McMahon

    Citrus Studios
  2. None
  3. 1. Hardware 2. Apple Frameworks 3. Code & Demos 4.

    Why SpriteKit?
  4. About • WPI for MS Robotics Engineering – 3D software,

    computer vision, controls • Tishman Construction – 3D CAD, apps for skyscrapers joemcm.com
  5. Citrus Studios • 4 people –Code –Art –Music & SFX

    –Project management • Launching Orbert in December for iOS 9 citrusstudios.io
  6. Orbert • SpriteKit – UIKit, AppKit • Core Animation •

    AVFoundation • GameplayKit orbert.io
  7. 2D 3D GPU SpriteKit SceneKit Metal

  8. None
  9. None
  10. iPhone 6s + iPhone 6s Plus (A9)

  11. iPad Pro + iPad Mini 4 (A9X)

  12. Rumors • Macbook Pro 2016 – Intel Skylake chipset –

    Nvidia GeForce GTX 950 • Develop OS X first
  13. None
  14. import SpriteKit class Level: SKScene { ... init(size: CGSize, ...){

    super.init(size: size, ...) ... } override func didMoveToView(){...} override func update(){...} ... } subclass SKScene initializers parameters allocate SKScene vars allocate variables initialize game update game helper functions
  15. Old SpriteKit Features • SKShader • SKLightNode – Shadows •

    SKPhysicsBody – Per pixel • SKConstraint and Inverse Kinematics • SKFieldNode • SK3DNode • Xcode – Texture Atlas – .sks 2D Scene Editor – SKReferenceNode
  16. DEMO

  17. New SpriteKit Features • SKAudioNode • SKCameraNode • Xcode –

    Particle Editor – Live editor – animations and cut scenes!
  18. let myCamera: SKCameraNode = SKCameraNode() // init() allocations omitted var

    hero: SKSpriteNode = SKSpriteNode() var objects: [SKSpriteNode] = [] override fund didMoveToView(){ camera = myCamera addChild(hero) hero.addChild(myCamera) for object in objects{ addChild(objects[object]) } }
  19. DEMO

  20. Old SceneKit Features • Xcode – .scn 3D Scene editor

    – SCNReferenceNode
  21. New SceneKit Features • SKTransitions • Automatic shadow occlusion

  22. import UIKit import SceneKit class Level: SCNScene { ... init(size:

    CGSize, ...){ super.init(size: size, ...) ... } override func didMoveToView(){...} override func update(){...} ... }
  23. import SpriteKit class Level: SKScene { ... init(size: CGSize, ...){

    super.init(size: size, ...) ... } override func didMoveToView(){...} override func update(){...} ... }
  24. addChild(hero) // SpriteKit rootNode.addChildNode(hero) // SceneKit

  25. DEMO

  26. Metal • Low level access to GPU • Integrated with

    SpriteKit and SceneKit • Designed for the A7 (5s)
  27. https://www.youtube.com/watch? v=IbZpqAUahKQ http://flexmonkey.blogspot.com/ @FlexMonkey

  28. Metal • Model I/O

  29. import UIKit import SceneKit import MetalKit // Only exists on

    iOS devices // MetalKit includes ModelIO class ViewController: UIViewController { let theView = SCNView() let scene = SCNScene(named: "Art.scnassets/ Building.scn")! override func viewDidLoad() { super.viewDidLoad() theView.scene = scene } }
  30. DEMO

  31. Other Frameworks • GameplayKit – Pathfinding – State machines –

    Artificial Intelligence • Game Center – GKLocalPlayer – GKPlayer • ReplayKit
  32. Conclusion • Start small, with SpriteKit • Work up to

    SceneKit and Metal
  33. Subclasses of SKNode SK3DNode SKAudioNode SKCameraNode SKCropNode SKEffectNode SKEmitterNode SKFieldNode

    SKLabelNode SKLightNode SKReferenceNode SKShapeNode SKSpriteNode SKVideoNode
  34. Conclusion • Frameworks aren’t just for iOS • Maybe it’s

    better to make an OS X app first • tvOS? • watchOS?
  35. Conclusion • Now is a great time to develop GPU

    intensive apps for iOS and OS X – 800,000,000 iOS devices @ WWDC2014 – 40,000,000 OS X devices – New hardware – OS X 10.11 El Capitan on September 30th
  36. Myths • SpriteKit and SceneKit are just for games •

    Metal is too hard • Games are all easy
  37. Questions? @jmcmahon443