TechnologiesGames & 3D

GameplayKit

iOSmacOStvOSwatchOSvisionOS

GameplayKit provides the game-logic foundation for building gameplay independent of rendering, on iOS, macOS, tvOS, and visionOS. You structure game objects with the entity-component model using GKEntity, GKComponent, and GKComponentSystem, and drive autonomous behavior through GKAgent2D and GKAgent3D agents that pursue GKGoal and GKBehavior objectives. The framework supports pathfinding with graph types such as GKGridGraph, GKMeshGraph, and their GKGraphNode nodes around GKObstacle obstacles, AI opponents via GKMinmaxStrategist and GKMonteCarloStrategist over a GKGameModel, and decision-making with GKDecisionTree. It also includes randomization and procedural generation, producing coherent noise from sources like GKPerlinNoiseSource and GKVoronoiNoiseSource into a GKNoiseMap.

Entities and Components 7

Structure game objects with the entity-component model, independent of rendering.

  • Cl
    GKEntityiOS 9.0+
    An entity is the general purpose object in an entity-component system.
  • Cl
    GKComponentiOS 9.0+
    A component is the data and logic for one part of an object in an entity-component system.
  • Cl
    GKComponentSystemiOS 9.0+
    A component system is a homogeneous collection of components that are intended to be called at the same time.
  • Cl
    GKSCNNodeComponentiOS 11.0+
    A component that encapsulates a SceneKit node.
  • Cl
    GKSKNodeComponentiOS 10.0+
    A component that encapsulates a SpriteKit node.
  • Cl
    GKSceneiOS 10.0+
    A scene stores and handles loading of data related to a particular scene.
  • Pr
    GKSceneRootNodeType
    Protocol that specifies the type of objects that can be used as root nodes of a GKScene.

Agents, Goals, and Behaviors 7

Drive autonomous movement and steering through agents that pursue goals and behaviors.

  • Cl
    GKAgentiOS 9.0+
    An agent is a point mass whose local coordinate system is aligned to its velocity. Agents have a variety of
  • Cl
    GKAgent2DiOS 9.0+
    A 2D specalization of an agent that moves on a 2-axis logical coordinate system. This coordinate system does not
  • Cl
    GKAgent3DiOS 9.0+
    A 3D specialization of an agent that moves on a 3-axis logical coordinate system.
  • Pr
    GKAgentDelegate
    Delegate that will receive messages regarding GKAgent updates.
  • Cl
    GKGoaliOS 9.0+
    Defines a spatial directive.
  • Cl
    GKBehavioriOS 9.0+
    A collection of GKGoals or GKBehaviors with weights that can be applied to a GKAgent
  • Cl
    GKCompositeBehavior
    A behavior that combines several behaviors, each with its own weight, to influence an agent.

State Machines 2

Model discrete game states and the transitions between them.

  • Cl
    GKStateMachineiOS 9.0+
    Models a finite state machine that has a single current state.
  • Cl
    GKStateiOS 9.0+
    Represents a single state in a state machine.

Pathfinding Graphs 10

Build and search navigation graphs to route agents through a game world.

  • Cl
    GKGraphiOS 9.0+
    Representation of a directed graph of GKGraphNodes
  • Cl
    GKGraphNodeiOS 9.0+
    A node in a directed graph. Edges are directed and can have variable costs.
  • Cl
    GKGraphNode2DiOS 9.0+
    GKGraphNode coupled with a 2D position
  • Cl
    GKGraphNode3DiOS 10.0+
    GKGraphNode coupled with a 3D position
  • Cl
    GKGridGraphiOS 9.0+
    A pathfinding graph whose nodes form a regular two-dimensional grid of cells.
  • Cl
    GKGridGraphNodeiOS 9.0+
    GKGraphNode coupled with a position on a 2D grid
  • Cl
    GKMeshGraphiOS 10.0+
    A collection of GKGraphNodes that are governed by a mesh formed by the space between a set of GKPolygonObstacles
  • St
    GKMeshGraphTriangulationMode
    Adjusts how graph nodes are created when you triangulate a GKMeshGrapk
  • Cl
    GKObstacleGraphiOS 9.0+
    A collection of GKGraphNodes that are governed by a set of extruded GKPolygonObstacles
  • Cl
    GKPathiOS 9.0+
    An ordered series of points that agents follow or stay within while moving.

Obstacles 4

Define impassable regions that pathfinding and steering must avoid.

  • Cl
    GKObstacleiOS 9.0+
    Represents an impassible area in 2D space.
  • Cl
    GKCircleObstacleiOS 9.0+
    An obstacle with an impassible radius
  • Cl
    GKPolygonObstacleiOS 9.0+
    An obstacle with an impassible closed polygon
  • Cl
    GKSphereObstacleiOS 10.0+
    An obstacle with an impassible radius in 3D space

Spatial Partitioning 9

Organize objects in space for efficient proximity and region queries.

  • Cl
    GKQuadtreeiOS 10.0+
    A tree data structure where each level has 4 children that subdivide a given space into the four quadrants.
  • Cl
    GKQuadtreeNodeiOS 10.0+
    The individual node(s) that make up a GKQuadtree.
  • Cl
    GKOctreeiOS 10.0+
    A tree data structure where each level has 8 children that subdivide a given space into the eight octants.
  • Cl
    GKOctreeNodeiOS 10.0+
    The individual node(s) that make up a GKOctree.
  • Cl
    GKRTreeiOS 10.0+
    An R-tree is a data structure that partitions axis aligned bounding rectangles into groups spatially.
  • En
    GKRTreeSplitStrategy
    Used to adjust the way in which RTree nodes are split when they grow too large.
  • St
    GKBox
    Representation of an axis aligned box via its min corner (lower-left) and max corner (upper-right)
  • St
    GKQuad
    Representation of an axis aligned quad via its min corner (lower-left) and max corner (upper-right)
  • St
    GKTriangle
    A structure describing a triangle defined by three points.

Artificial Opponents 8

Build AI players that evaluate game state and choose strong moves.

  • Pr
    GKStrategist
    A protocol for AI components that select moves by evaluating a game model.
  • Cl
    GKMinmaxStrategistiOS 9.0+
    The Minmax Strategist is a generic AI that selects a game model update for a given player that maximises
  • Cl
    GKMonteCarloStrategistiOS 10.0+
    The Monte Carlo Strategist is a generic AI that selects a game model update for a given player that results
  • Pr
    GKGameModel
    A protocol for abstracting a game model for use with the GKMinmaxStrategist class. The minmax
  • Pr
    GKGameModelPlayer
    A protocol used to represent an individual player within a game model.
  • Pr
    GKGameModelUpdate
    A protocol used to encapsulate the data needed to affect an update to a game model.
  • Cl
    GKDecisionTreeiOS 10.0+
    An object that models decision-making by branching through questions to reach an outcome.
  • Cl
    GKDecisionNodeiOS 10.0+
    A node in a decision tree representing a question, answer, or resulting decision.

Rule Systems 3

Express game logic and fuzzy reasoning with rules evaluated against facts.

  • Cl
    GKRuleSystemiOS 9.0+
    A rule system consists of 3 things:
  • Cl
    GKRuleiOS 9.0+
    The concrete class that the GKRuleSystem uses to evaluate the current state and facts with predicated rules.
  • Cl
    GKNSPredicateRuleiOS 9.0+
    A convenient subclass of GKRule that leverages existing NSPRedicate functionality for evaluating the predicate

Randomization 8

Generate reproducible random values with selectable sources and distributions.

  • Pr
    GKRandom
    A protocol for random sources that can generate random numbers. This is the minimal interface needed
  • Cl
    GKRandomSourceiOS 9.0+
    A concrete random source that can generate random numbers. The implementation details are up to the system and
  • Cl
    GKARC4RandomSourceiOS 9.0+
    A deterministic pseudo-random source that generates random numbers based on an arc4 algorithm.
  • Cl
    GKLinearCongruentialRandomSourceiOS 9.0+
    A deterministic pseudo-random source that generates random numbers based on a linear congruential algorithm.
  • Cl
    GKMersenneTwisterRandomSourceiOS 9.0+
    A deterministic pseudo-random source that generates random numbers based on a mersenne twister algorithm.
  • Cl
    GKRandomDistributioniOS 9.0+
    A random distribution is a random source itself with a specific mapping from the input source to the output values.
  • Cl
    GKGaussianDistributioniOS 9.0+
    A gaussian distribution is biased towards the mean value, the possible outcomes are spread out from the mean
  • Cl
    GKShuffledDistributioniOS 9.0+
    A shuffled distribution tries to make sure individual samples are not clustered whilst retaining a uniform distribution of values

Procedural Noise 12

Produce coherent noise for procedural textures, terrain, and content generation.

  • Cl
    GKNoiseiOS 10.0+
    GKNoise is the object used to manipulate and combine noise in continuous 3D space. It takes a GKNoiseSource as input.
  • Cl
    GKNoiseMapiOS 10.0+
    GKNoiseMap represents an extracted portion of sampled points from continuous 3D noise. Extracted values are useful
  • Cl
    GKNoiseSourceiOS 10.0+
    A GKNoiseSource instance is a description of procedural noise in 3D space. Noise sources generate values
  • Cl
    GKCoherentNoiseSourceiOS 10.0+
    Coherent noise is smoothly-changing, semi-random noise. A given input always produces the same output.
  • Cl
    GKPerlinNoiseSourceiOS 10.0+
    Perlin noise is useful for creating natural-looking textures and realistic-looking terrain.
  • Cl
    GKBillowNoiseSourceiOS 10.0+
    Billow noise is similar to Perlin noise, with more rounded shapes and clearly-defined transitions beween values.
  • Cl
    GKRidgedNoiseSourceiOS 10.0+
    Ridged noise is similar to Perlin noise, with sharply-defined, relatively thin peaks.
  • Cl
    GKVoronoiNoiseSourceiOS 10.0+
    Voronoi noise partitions the space into angular, polygonal "cells", which are reminiscent
  • Cl
    GKConstantNoiseSourceiOS 10.0+
    Produces a single, constant value at all positions in the space.
  • Cl
    GKCylindersNoiseSourceiOS 10.0+
    Produces 3D cylindrical noise with an infinite number of cylinders-within-cyliners of constantly-increasing radius.
  • Cl
    GKSpheresNoiseSourceiOS 10.0+
    Produces 3D spherical noise with an infinite number of spheres-within-spheres of constantly-increasing radius.
  • Cl
    GKCheckerboardNoiseSourceiOS 10.0+
    Produces noise in a checkerboard pattern.

Extends 7

NSArraySCNNodeSCNSceneSKNodeSKSceneSKTileMapNodeSKTexture
← Games & 3D