Slide 1

Slide 1 text

Intro to SpriteKit and GameplayKit Kartik Patel

Slide 2

Slide 2 text

SpriteKit

Slide 3

Slide 3 text

Create 2D sprite-based games using an optimized animation system, physics simulation, and event-handling support.

Slide 4

Slide 4 text

SKView • SKView is placed inside a window • Can be combined with view in the hierarchy

Slide 5

Slide 5 text

SKScene • holds sprites and other content to be rendered • implements per-frame logic and content processing • view presents one scene at a time • can us SKTransition to animate between two scenes

Slide 6

Slide 6 text

last chance to make changes to the scene didFinshUpdate() after constraints associated with notes in the scene are applied didApplyContraints() after all physics for the the frame have been simulated, see SKPhysicsBody didSimulatePhysics() called with time elapsed so far in the simulation, primary place to implement your own in-game simulation update(_:) after all actions for the frame have been processed didEvaluateActions() SKScene

Slide 7

Slide 7 text

SKNode • nodes are the fundamental building blocks for all content, with the scene object acting as the root node for a tree of node objects • does not draw annything, but applies it’s properties to it’s descendants • nodes objects are responder objects, descending either from UIResponder or NSResponder

Slide 8

Slide 8 text

SKTexture • shared images used to render sprites • can create textures by loading image files or creating at runtime

Slide 9

Slide 9 text

SKAction • scene’s contents are animated using actions • when the scene processes frames of animation, the actions are executed • actions can span multiple frames

Slide 10

Slide 10 text

GameplayKit

Slide 11

Slide 11 text

Architect and organize your game logic. Incorporate common gameplay behaviors such as random number generation, artificial intelligence, pathfinding, and agent behavior.

Slide 12

Slide 12 text

GameplayKit areas of functionality robust, flexible implementations of standard algorithms Randomization game world as a graph, plan optimal routes Pathfinding reusable gameplay code Entities & Components let game characters move themselves Agents, Goals, Behaviors untangle complex procedural code State Machines Separate game design from code, implement fuzzy logic reasoning Rule Systems model for your turn- based game Minmax

Slide 13

Slide 13 text

Demo

Slide 14

Slide 14 text

Resources https://developer.apple.com/reference/spritekit https://developer.apple.com/reference/spritekit/skscene https://developer.apple.com/reference/gameplaykit https://developer.apple.com/library/content/documentation/ General/Conceptual/GameplayKit_Guide/ https://github.com/kartikpatel/Combat