sprite kit - GKGraph GKGraphNode GKGridGraphNode, what's relationship for them? -


i've read document still confused of them, guy can give me explaining, e.g.any image comparison? thanks.

the wikipedia article on pathfinding might help, might related topics on graphs , graph search algorithms linked there. beyond that, here's attempt @ quick explainer.

nodes places can be, , connections other nodes define can travel between places. together, collection of (connected) nodes form graph.

gkgraphnode general form of node — these nodes don't know in space, connections other nodes. (that's enough basic pathfinding, though... if have graph connected b , b connected c, path c goes through b regardless of nodes located, below.)

enter image description hereenter image description here

gkgraph collection of nodes, , provides functions work graph whole, the important 1 finding paths.

gkgridgraphnode , gkgraphnode2d specialized versions of gkgraphnode add knowledge of node's position in space — either integer grid space (like chessboard) or open 2d space. once you've added kind of information, gkgraph containing these kinds of nodes can take distance account when pathfinding.

for example, @ image:

enter image description here

if we're using gkgraphnode, we're talking nodes connected which. if ask shortest path d, can either acd or abd, because it's qual number of connections either way. if use gkgridgraphnode or gkgraphnode2d, we're looking @ lengths of lines between nodes, in case acd shortest path.

once start locating nodes in (some sort of coordinate) space, helps able operate on graph whole in space. that's gkgridgraph , gkobstaclegraph come in.

  • gkgridgraph works gkgridgraphnodes , lets things create graph fill set of dimensions (say, 10x10 grid, diagonal movement allowed) instead of making create , connect bunch of nodes yourself.
  • gkobstaclegraph adds more free-2d-space graphs letting mark areas impassable obstacles , automatically managing nodes , connections route around obstacles.

hopefully helps bit. more, besides reference docs , guide, apple has wwdc video shows how stuff works.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

javascript - Rivets.js rv-show not working with rv-each -