Questions tagged [gameplay-kit]

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.

190 questions
2
votes
1 answer

GameplayKit GKGoal: can't get wandering to work

Trying to learn how to use GameplayKit, and in particular, agents & behaviors. Trying to boil down all the tutorials and examples out there into a small, simple piece of code that I can use as a starting point for my own app. Unfortunately, what…
SaganRitual
  • 3,143
  • 2
  • 24
  • 40
2
votes
0 answers

Creating A Racing Line For an AI Path

I am currently creating a top down racing game ( or trying! ) using SpriteKit. I am creating tracks procedurally with catmullrom splines created from points. I have access to three sets of points, the inside of the track, the outside of the track…
Jason
  • 118
  • 12
2
votes
1 answer

How to copy an SKNodes with children

How do i copy an SKTileMapNode or an SKNode containing two or more SKTileMapNode. Structure is: BackgroundNode (empty) SKTileMapNode SKTileMapNode I would love todo the following inside of my Scene: guard let background =…
bemeyer
  • 6,154
  • 4
  • 36
  • 86
2
votes
1 answer

GKMinmaxStrategist modifies model after return of best move

I implemented GKGameModel, GKGameModelPlayer and GKGameModelUpdate protocols in my corresponding classes. After I ask for best move strategist changes my model's board. I understand how it works, making copies of model and tried all moves, but I…
Dima Deplov
  • 3,688
  • 7
  • 45
  • 77
2
votes
2 answers

What is the difference between SKNode's position property and GKAgent2d's position property

SKNode has a position property which represents the node's position in parent. Whereas GKAgent2D also has a position property which according to the documentation is its position in 2D space. How are these two related? And how do we convert between…
nata11
  • 109
  • 1
  • 8
2
votes
1 answer

getting GKObstacleGraph to work with SKTileMapNode

I'm currently working in Xcode 8, using Swift 3 and the new SKTileMapNode from SpritKit to make a 2D dungeon crawler type of game. I'm have trouble getting GKObstacleGraph to work with the tilemap. Please help! I tried to loop through all the tiles…
Bob
  • 155
  • 1
  • 8
2
votes
1 answer

Gameplaykit: Managing multiple objects using GKStatemachines

I'm writing a game that has a number of switch sprites that can be moved by the game player.I was intending to use a 'Game-play-kit' state machine to organize my code. I can't figure out how to manage multiple state machines - specifically I store…
2
votes
1 answer

On upgrade to swift3, getting an error 'cannot override a property with type GKEntity'

After updating to swift3, the commented line is returning an error: Property 'entity' with type 'GKEntity!' (aka 'ImplicitlyUnwrappedOptional') cannot override a property with type 'GKEntity?' import SpriteKit import GameplayKit class…
Shane O'Seasnain
  • 3,534
  • 5
  • 24
  • 31
2
votes
1 answer

GameplayKit GKPolygonObstacle Not Working With GKGoal

Similarly to a question I have posted here, I am now realizing that the problem is more trivial that I anticipated, as this works for some elements of GameplayKit but not others.. I have an obstacle, an SKNode, that I am trying to define as a…
Will Von Ullrich
  • 2,129
  • 2
  • 15
  • 42
2
votes
2 answers

In Gameplaykit, how can I add a delay GKGoal time in GKAgent2D behavior?

I have a GKEntity that has a GKAgent2D component. Its behaviors are GKGoal, toWander: and toStayOnPath:maxPredictionTime:. The entity wanders continuously in the scene; however, I would like it to stop wandering for a while. For example, if the…
Simone Pistecchia
  • 2,746
  • 3
  • 18
  • 30
2
votes
2 answers

GKObstacleGraph not finding path when obstacle introduced

I'm working on a Gameplaykit pathfinding proof-of-concept and I can't get GKObstacleGraph to find paths correctly. In the following code snippet (it should work in an Xcode 7.2 playground), path2 is always an empty array if there is an obstacle…
Jack Cox
  • 3,290
  • 24
  • 25
2
votes
0 answers

GameplayKit's nextIntWithUpperBound() failing in playground

The below code works great in an iOS project, but fails in an iOS playground. Any idea why, other than "it's probably a bug"? Note: you need to open the playground debug area to see the message: "overloads for 'subscript' exist with these partially…
TwoStraws
  • 12,862
  • 3
  • 57
  • 71
2
votes
1 answer

EXC_BAD_ACCESS when reasigning GKGridGraph

I have a graph like this: @property (nonatomic, strong) GKGridGraph *graph; Assgin it with width and height: self.graph = [[GKGridGraph alloc] initFromGridStartingAt:(vector_int2){0, 0} …
HelloimDarius
  • 695
  • 5
  • 23
2
votes
1 answer

GKGraph GKGraphNode GKGridGraphNode, what's relationship for them?

I've read the document but still confused of them, could any guy can give me a clearly explaining, e.g.any image comparison? Thanks.
Jerry Zhao
  • 273
  • 3
  • 14
2
votes
1 answer

GKAgent Not Moving

I have a GKAgent on my project which I am attempting to move by having it follow a path. The path has been created along with its corresponding goals and behavior and it will move so long as I never set its position. Unfortunately I don't want it…