Post

Replies

Boosts

Views

Activity

Reply to How to construct GKGridGraph using only traversable nodes
Quadtrees could potentially be an option (I'd have to research those more to know for sure), thanks for that idea. But I thought that what I was trying to do with GameplayKit was pretty much the exact use case for why the GKGridGraph is provided by Apple, to construct a grid-aware graph of nodes that can be walked by A*, which is I am assuming what is used behind GKGraph.findPath(). So...to some extent, if GKGridGraph cannot efficiently do what I've described above, I really don't know what the purpose is of the GKGraph classes other than to build very simple games, ones that have very small grids. In my tests it took 2,000 milliseconds to remove 20% of the nodes in a 50x50 grid, which is a couple orders of magnitude too slow for my purposes. I am fine coding my own data structures from scratch to power my game engine, but I really thought that GKGridGraph was supposed to provide the exact functionality that I'm trying to use it for, so I am very reluctant to just start coding my own data structures. Really I would just love to get some sample code from Apple/anyone showing how to add a specific array of subclassed GKGridGraphNodes to a GKGridGraph and have the resulting graph be self-aware of the underlying grid structure that resulted from adding the nodes. This page: jonathanfischer.net/lets-build-gameplaykit-grid-pathfinding shows a close example to what I am trying to do, but Apple's GK API docs suggest that their GKGridGraph implementation should be able to do what I'm wanting to do. What am I missing?
Topic: Graphics & Games SubTopic: General Tags:
Mar ’22
Reply to How to construct GKGridGraph using only traversable nodes
For anyone who might have any thoughts, here is a page that shows how to create a subclass of GKGridGraphNode and construct a GKGridGraph using your custom node: github.com/thesecretlab/iOSGameDevCookbook3rdEd/blob/master/01-layingout.playground/Pages/Graphs.xcplaygroundpage/Contents.swift That is from the book iOS Game Development Cookbook, and it was the only actual code example I was able to find on the internet showing how to subclass GKGridGraphNode for usage in a GKGridGraph. Theoretically that technique sounds fine: create a GKGridGraph using the main constructor, then remove nodes in the grid and replace with your custom nodes using connectToAdjacentNodes. The problem is that GKGraph.remove() method takes around 1,000x times longer to remove a node than it does to add a node. I don't know why. I wanted to create an on-the-fly ephemeral grid graph for each agent that needs pathfinding per turn in my game, and use the graph to find an optimal path using GKGraph.findPath() then just throw away the graph once the path was found, then rinse and repeat. That idea will not be possible due to the performance of the remove() method as it takes way too long to create the grid graph. If anyone has any ideas, please let me know. I am stumped and pretty much totally roadblocked at this point from using GameplayKit, as usage of the grid graph is a fundamental part of my game engine.
Topic: Graphics & Games SubTopic: General Tags:
Mar ’22
Reply to Future of Spritekit?
I've been learning SpriteKit for 9 months now, basically learning it and working in it full time. I am building a rather complex strategy game targeted to mobile. I am a professional software engineer, but first-time game developer. My experience learning SpriteKit has been both good and bad, and here in 2022 I am still wondering what the future of SpriteKit is, as it is not clear at all, and this question was posted 4 years ago. The good part of my experience has been that SpriteKit seems to be an extremely well-designed framework, and seems to perform really well, as long as you closely follow Apple's recommended way of doing things. My game loads up huge dynamic tile maps, and places thousands of objects/nodes on the maps. So far SpriteKit and the SKTileMapNode have worked amazingly well. However, the documentation, online support, availability of books, and learning materials has been extremely lacking, which has made learning it very frustrating. I really wish Apple would provide more examples of how to do certain things in SpriteKit. This is the aspect I see as the most concerning in terms of its future: there seems to be way too little support from Apple for how to use this nice framework. I don't know the reasons why Apple does not put more effort or money behind teaching the community how to use this framework (I'm sure they have their reasons), but to me this is the biggest problem in terms of its future: teaching the community of developers how to use this wonderful framework. I am continuing to try to use SpriteKit, but the days are numbered until I switch to Unity, not because I want to, but because it seems like there are more learning resources out there for Unity. I do think that SpriteKit would be much more actively used if there was more robust documentation and code examples. It truly is a nice framework when you eventually figure out how to do certain things with it.
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Aug ’22