About GameplayKit
GameplayKit is a collection of foundational tools and technologies for building games in iOS, OS X, and tvOS. Building, evolving, and maintaining a sophisticated game requires a well-planned design—GameplayKit provides architectural tools to help you design modular, scalable game architecture with minimal effort. Creating great games also requires deploying complex algorithms to solve the problems underlying common game mechanics—GameplayKit also provides standard implementations of such algorithms, allowing you to spend more time on the features that make your gameplay unique.
Because GameplayKit is independent of high-level game engine technologies, you can combine it with any of those technologies to build a complete game: SpriteKit for 2D games, SceneKit for 3D games, or a custom or third-party game engine using Metal or OpenGL ES. For games with less demanding graphics needs, you can even use GameplayKit with UIKit (in iOS or tvOS) or AppKit (in OS X).
GameplayKit provides seven core areas of functionality, which you can combine or use independently to create your game:
Randomization. Use these robust, flexible implementations of standard algorithms as the building blocks for many kinds of game mechanics.
Entities and Components. Design more reusable gameplay code by building on this architecture.
State Machines. Use this architecture to untangle complex procedural code in your gameplay designs.
The Minmax Strategist. Create a model for your turn-based game and AI player objects that use the model to plan optimal moves.
Pathfinding. Describe a game world as a graph, allowing GameplayKit to plan optimal routes for game characters to follow.
Agents, Goals, and Behaviors. Use this simulation to let game characters move themselves based on high-level goals and react to their surroundings.
Rule Systems. Separate game design from executable code to speed up your gameplay development cycle, or implement fuzzy logic reasoning to add realistic behavior to your game.
Examples
The example games discussed in this book are available as sample code, so you can download each as a complete project to see GameplayKit (and other technologies) in action:
Boxes: GameplayKit Entity-Component Basics — A basic demonstration of GameplayKit’s Entity-Component system, discussed in the Entities and Components chapter.
Dispenser: GameplayKit State Machine Basics — A basic demonstration of GameplayKit’s state machine system, discussed in the State Machines chapter.
Pathfinder: GameplayKit Pathfinding Basics — A basic demonstration of GameplayKit’s pathfinding system, discussed in the Pathfinding chapter.
Maze: Getting Started with GameplayKit — A simplified classic arcade game, using many of the design and gameplay features in GameplayKit. This project is discussed in the Entities and Components, State Machines, Pathfinding, and Rule Systems chapters.
FourInARow: Using the GameplayKit Minmax Strategist for Opponent AI — A simple board game built using UIKit (iOS only), illustrating use of the
GKMinmaxStrategist
class and related protocols, discussed in The Minmax Strategist.AgentsCatalog: Using the Agents System in GameplayKit — A demonstration of the
GKAgent
class and several of the individual goals an agent can follow, as well as how to combine goals into complex behaviors. The Agents, Goals, and Behaviors chapter discusses this project.DemoBots: Building a Cross Platform Game with SpriteKit and GameplayKit — A full-featured game, using nearly all of the systems in GameplayKit, and also demonstrating techniques for designing and building a multi-level game project using SpriteKit, on-demand resources, and new features in Xcode 7. Parts of this project are discussed in the Agents, Goals, and Behaviors and Rule Systems chapters.
See Also
The example games in this guide are built with the UIKit, SpriteKit, and SceneKit frameworks. Before using GameplayKit in concert with one of these technologies, you should be familiar with the relevant concepts and tools, and generally familiar with building apps for Apple platforms. See the following documents for more information about whichever game engine technology you plan to work with:
SpriteKit Programming Guide and SpriteKit Framework Reference
Start Developing iOS Apps (Swift) or App Programming Guide for tvOS, and Xcode Overview
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2016-03-21