© 2015 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
#WWDC15
What’s New in SpriteKit
Tim OriolNorman WangTyler Casella
Graphics and Games
Session 604
What is SpriteKit?
What is SpriteKit?
2D graphics framework for gamesSuper easy to useLets you design your game in the most natural way possibleAutomatic access to the latest and greatest
What is SpriteKit?Supported across iOS and OS X
What is SpriteKit?Xcode integrated live editor
New Additions
Viewport
Viewport
SKCameraNode
Represents the center of the viewportSKScene propertyMove the camera not the worldStatic elements can be moved with the camera
SKCameraNode
SKCameraNode is a SKNode• Actions• Constraints• Rotation• Scale
SKCameraNode
SKCameraNode is a SKNode• Actions• Constraints• Rotation• Scale
SKCameraNode
SKCameraNode is a SKNode• Actions• Constraints• Rotation• Scale
SKCameraNode
SKCameraNode is a SKNode• Actions• Constraints• Rotation• Scale
SKCameraNode
SKCameraNode is a SKNode• Actions• Constraints• Rotation• Scale
SKAudioNodePositional audio
Leveraging AVAudioEnginePosition calculated via node positionListener node property on SKSceneCreate with filename or URLFull control via avAudioNode property
Listener
SKAudioNodeSKAudioNode
SKAudioNode
SKAudioNode
Listener
SKAudioNode
Listener
SKAudioNode
SKAudioNode
SKAudioNode
References and Instancing
Leverage the NSCoding capabilityInstances of SKAction and SKNodeReusable componentsShare across multiple projects
SKReferenceNode
Place reference nodesBundle based filename or any URLEditor supported
SKReferenceNode
SKReferenceNode
SKReferenceNode Serialized SpriteKit File
Named SKActions
Create in XcodeShare and reuse action files
[SKAction actionNamed:]
[SKAction actionNamed:duration:]
SpriteKit Action Files
Playback control actionsplay, pause changePlaybackRateTo: duration: changeVolumeTo: duration:
Normal texture animationanimateWithNormalTextures:
New SKActions
Playback control actionsplay, pause changePlaybackRateTo: duration: changeVolumeTo: duration:
Normal texture animationanimateWithNormalTextures:
New SKActions
Playback control actionsplay, pause changePlaybackRateTo: duration: changeVolumeTo: duration:
Normal texture animationanimateWithNormalTextures:
New SKActions
System Integration
Metal Backed
iOS and Mac Metal backed on devices that support itOpenGL on systems that don'tZero action required for developersAll SpriteKit apps automatically upgradedSKShaders automatically upgraded
We Speak Swift and Objective-C
Nullability enhancementsObjective-C genericsEnhanced type safety
SceneKitSKTransitions
Use SKTransitions in SceneKitSceneKit Metal supportAutomatic context matching
GameplayKitStep up your game
Entity/Component systemsState machinesAgents and behaviorsPathfindingAI strategistsRandom sourcesRule systems
GameplayKitPathfinding
Pathfinding operates on a navigation graphGraphs are collections of nodesNodes are joined by connectionsEach connection has an associated cost
A
B
C
D
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitPathfinding
GameplayKitAutomatic graph generation
If you’re using SpriteKit, we have provided a set of functions to automatically generate these from existing SKNodes.PhysicsBody, texture, or bounds.
[SKNode obstaclesFromNodeBounds: nodes]
[SKNode obstaclesFromNodePhysicsBodies: nodes]
[SKNode obstaclesFromSpriteTextures: nodes accuracy: accuracy]
GameplayKitAutomatic graph generation
If you’re using SpriteKit, we have provided a set of functions to automatically generate these from existing SKNodes.PhysicsBody, texture, or bounds.
[SKNode obstaclesFromNodeBounds: nodes]
[SKNode obstaclesFromNodePhysicsBodies: nodes]
[SKNode obstaclesFromSpriteTextures: nodes accuracy: accuracy]
GameplayKitAutomatic graph generation
If you’re using SpriteKit, we have provided a set of functions to automatically generate these from existing SKNodes.PhysicsBody, texture, or bounds.
[SKNode obstaclesFromNodeBounds: nodes]
[SKNode obstaclesFromNodePhysicsBodies: nodes]
[SKNode obstaclesFromSpriteTextures: nodes accuracy: accuracy]
GameplayKitAutomatic graph generation
If you’re using SpriteKit, we have provided a set of functions to automatically generate these from existing SKNodes.PhysicsBody, texture, or bounds.
[SKNode obstaclesFromNodeBounds: nodes]
[SKNode obstaclesFromNodePhysicsBodies: nodes]
[SKNode obstaclesFromSpriteTextures: nodes accuracy: accuracy]
SpriteKit ToolsNorman Wang
SpriteKit ToolsIntroduction
Games rely on tools for iteration and scalability• Game logic, animation, or art assets
Improve work flow and build game fasterFocus on building the gameplay
+
SpriteKit ToolsTexture atlas
cave_base.pngcave_destroyed.png
minionSplort.png
big_tree_base.png
big_tree_top.pngcave_top.pngbig_tree_middle.png
SpriteKit ToolsTexture atlas
SpriteKit ToolsTexture atlas
SpriteKit ToolsTexture atlas in Asset Catalog
SpriteKit ToolsTexture atlas with On Demand Resources
SpriteKit ToolsTexture atlas with On Demand Resources
SpriteKit ToolsParticle editor
SpriteKit ToolsParticle editor
SpriteKit ToolsXcode Quicklook
SpriteKit ToolsXcode Quicklook
SpriteKit Tools2D editor
Full visual editor for 2D games No more compile and checkNo code requiredVisual layoutLive physics simulationLive shader editing
SpriteKit Tools2D editor
Full visual editor for 2D games No more compile and checkNo code requiredVisual layoutLive physics simulationLive shader editing
SpriteKit ToolsNew features
More editor features this year• Custom classes• Camera• Audio node• Reference node
Increased collaboration and reusability
SpriteKit ToolsNew features
More editor features this year• Custom classes• Camera• Audio node• Reference node
Increased collaboration and reusability
SpriteKit ToolsNew features
More editor features this year• Custom classes• Camera• Audio node• Reference node
Increased collaboration and reusability
SpriteKit ToolsNew features
More editor features this year• Custom classes• Camera• Audio node• Reference node
Increased collaboration and reusability
SpriteKit ToolsAction editor
All new action editorTimeline basedRealtime preview2D and 3D supportCinematic and Interactive animations
SpriteKit ToolsAction editor
All new action editorTimeline basedRealtime preview2D and 3D supportCinematic and Interactive animations
SpriteKit ToolsReferences and instancing
Instances of SKAction and SKNodeReusable componentsData-driven modelShare across multiple projectsSeparate resource filesNo code required
SpriteKit ToolsReferenced actions
Create once, reuse on multiple nodes, projectsReference via editor or codeLeveraging the new SKAction actionNamed: Build a custom library of actionsBuild very complex actions
SpriteKit ToolsReferenced nodes
Create once, reuse on multiple nodes, projectsReference via editor or codeLeveraging the new SKReferenceNode APIBuild a custom library of nodesShare between multiple scenes, and projects
SpriteKit ToolsReferenced nodes
Create once, reuse on multiple nodes, projectsReference via editor or codeLeveraging the new SKReferenceNode APIBuild a custom library of nodesShare between multiple scenes, and projects
DemoBuilding a SpriteKit game
Tyler Casella
Summary
Exciting year for SpriteKit developers• Audio node, Camera node, Reference node, Reference action• All new timeline based action editor• Asset Catalog integration• App Thinning • On Demand Resources• Metal integration• GameplayKit integration
More Information
SpriteKit Documentation and Videoshttp://developer.apple.com/spritekitApple Developer Forumshttp://developer.apple.com/forumsDeveloper Technical Supporthttp://developer.apple.com/support/technical
General InquiriesAllan Schaffer, Game Technologies [email protected]
Related Sessions
Going Social with ReplayKit and Game Center Mission Wednesday 1:30PM
Enhancements to SceneKit Mission Wednesday 2:30PM
Introducing GameplayKit Mission Thursday 11:00AM
Deeper into GameplayKit with DemoBots Mission Thursday 1:30PM
Related Labs
SpriteKit Lab Graphics B Wednesday 11:00AM
Game Controllers Lab Graphics D Thursday 2:30PM
GameplayKit Lab Graphics B Thursday 2:30PM
SpriteKit Lab Graphics C Friday 10:00AM