Apple's GameplayKit framework provides pathfinding, goal-based movement, rulesystems, entity-component systems, finite state machines and random distribution classes for game developers. Also included is a class and related protocols for building turn-based AIs based on minmax tree search. Available for iOS 9 and OS X 10.11.
Questions tagged [gameplay-kit]
190 questions
5
votes
3 answers
GameplayKit - Confusion about sending messages between components
I'm diving into GameplayKit with Spritekit and from what I gather, you subclass GKEntity and then start adding GKComponents to that entity. The entity would more or less just be a bag of components that fill some function.
The part I'm confused…

hamobi
- 7,940
- 4
- 35
- 64
4
votes
0 answers
How to assign a sprite to an entity in scene editor with gameplaykit
I've currently been using my own entity system for a game I'm working on, but I just learned about Gameplaykits usage of skentity and skcomponent.
It seems like a good design pattern and I want to learn how to use it. I have been following this…

Discoveringmypath
- 1,049
- 9
- 23
4
votes
2 answers
GameplayKit + SceneKit, GKAgent rotation conversion
I've been having some fun using GameplayKit in a Scenekit (and ARKit, although that isn't important to this question) application.
Specifically, I have been using Entities, Components, and Agents for Behavior, and it has all been working great,…

Ryan Pfister
- 3,176
- 4
- 24
- 26
4
votes
1 answer
Leaks using GKStateMachine in GameplayKit
I’m having leak problems with GKStateMachine.
My App is a pretty straight code to test the problem. This is the GameScene:
import SpriteKit
import GameplayKit
class GameScene: SKScene {
lazy var gameState:GKStateMachine = GKStateMachine(states:…

iOSTony
- 165
- 1
- 11
4
votes
1 answer
What algorithm does GameplayKit pathfinding use?
Has anyone found reference to what type of algorithm GameplayKit uses for pathfinding? I have reviewed Apple's documentation and was not able to find anything.
Ultimately I am curious to its performance vs. A* implemented without GameplayKit. …

Calm Turtle
- 292
- 3
- 18
4
votes
1 answer
How to update GameplayKit entities and components in a SceneKit Game
I have a SceneKit game that I'm attempting to integrate with GameplayKit.
In order for GameplayKit to work, I need to update my components and entities by calling their updateWithDeltaTime(seconds:) method.
In the SpriteKit/GameplayKit examples…

gargantuan
- 8,888
- 16
- 67
- 108
3
votes
2 answers
What is the best way to make decisions in iOS with Swift
I want to make a simple app with a simple AI.
I did allot of research and found some articles about decision-trees, Rules and behavior-trees.
I saw a video of the WWDC2016 where the new GKDecisionTree was presented.
Maybe this could be simple…

Boke
- 75
- 2
- 7
3
votes
1 answer
Using updates current time to keep track of game time
I am curious if anybody has been able to figure out a way to keep how long a scene has been active for. This is critical for when I need to fire certain events, like say "spawn ship 5 minutes into game play".
The issue with the update cycle, is…

Knight0fDragon
- 16,609
- 2
- 23
- 44
3
votes
0 answers
GameplayKit Ai with no board model
I'm currently developing a game where the players fire projectiles at each other from either side of the screen. (like that Bow masters game on the appstore.)
I'm currently trying to integrate an Ai into the game to play as the opposite team using…

Astrum
- 375
- 6
- 21
3
votes
0 answers
GKMinmaxStrategist - not working for starting move (Swift 4)
I am working on a two-player strategy board game with the option to play against CPU and I am using the GKMinmaxStrategist to give some brains to the CPU player.Just for background, there are two "factions" in the game (King, Enemy) and the one…

SanMu
- 645
- 1
- 6
- 19
3
votes
1 answer
how to access entity from code - gameplay kit
I have a node I added in the scene. Also in the scene I give it a component to bounce. The component looks like this:
class BounceComponent: GKComponent, ComponentSetupProt {
var bounce: SKAction?
var node: SKSpriteNode?
@GKInspectable var diff:…

Discoveringmypath
- 1,049
- 9
- 23
3
votes
0 answers
Loading entities GKScene and SKReferenceNodes via SpriteKitBuilder automation
It seems that GKScene does not "magically" load entities that come from SKReferenceNodes into its entities array, I am wondering if anybody knows how to get this working without adding custom extensions or classes.
There is no code to show, the idea…

Knight0fDragon
- 16,609
- 2
- 23
- 44
3
votes
1 answer
GKEntity and state machines
I'm working on a small project using SpriteKit and GameplayKit. It's my first time using an entity/component system and I'm loving it. But now, I'm at a point where I need to keep track of my entities states (Spawning, Normal, Removing) so they…

BadgerBadger
- 696
- 3
- 12
3
votes
1 answer
GameplayKit > Scene Editor Navigation Graph > How to use it for pathfinding?
Not long ago, Apple introduced GameplayKit elements to Xcode's Scene Editor, which is great. However, I seem to have issues with the Navigation Graph element:
What I try to achieve is to draw a GKGraph from the Scene Editor, retrieve it in code,…

Filip Juncu
- 352
- 2
- 10
3
votes
1 answer
Value of type 'GKEntity' has no member 'componentForClass'. why I can`t find this method in swift 3.0?
I'm trying to run this line:
guard let spriteComponent = entity?.componentForClass(SpriteComponent.self) else {
return
}
and receiving this:
Value of type 'GKEntity' has no member 'componentForClass'
Apparently apple has removed this method…

Sanf0rd
- 3,644
- 2
- 20
- 29