Last year I wrote about my Generic Node Component which I use as the basis for displaying nodes in an ECS-based game. Since then, I’ve refined this approach in a couple of ways.
SpriteKit
AVAudioPlayer Causing Frame Rate Drops in SpriteKit
It started with a trip to Singapore.
This was a natural deadline to get AdventureKit to 1.0.
It was going so well. In the last week, I had added my first animated walk cycle and even included some reach animations for my main character.
Managing State in Adventure Games
One of the things that I got stuck on last year while developing AdventureKit was tracking state. After coming back to it again this year I realise I was coming at it from the wrong direction.
Halving and Doubling protocol
In one of my many previous posts on screen sizes I mentioned that I have decided to use points and asset catalogs with scaled assets for AdventureKit.
Screen Sizes. Again.
A couple of weeks is all it took for me to revisit this.
It seems that Apple read my previous post about using iPad-sized assets across all devices and said to themselves “Best put a stop to that nonsense.”
Sticking Nodes to Corners
I have a Direction
enum that I use to position UI layers in my adventure game. It supports 8 compass directions plus a case for centre:
public enum Direction : String, CaseIterable, Codable { case center, north, northeast, east, southeast, south, southwest, west, northwest }
Managing ECS Components
A lot of what drives my entities happens in pseudo-systems. These systems are GKComponent
subclasses where the update(deltaTime:)
method goes in an extension in order to separate the verb part of the component from the noun part:
Revisiting Scene Sizes
Update: I would say this method is still valid if you want to use single assets across all devices, but I am now using points and asset catalogs (even though it’s a lot of extra work).
I honestly thought I had it figured out.
I hadn’t.
I mean, I had. Except it’s always more complicated than that.
Let’s talk about scene sizes.
(Again.)
Interaction Nodes
The default way of working with SpriteKit is to have the SKScene
instance capture all the inputs and then have logic within that scene file to figure out the user’s intention.
In order for this to work, SKNode
instances added to this scene have their isUserInteractionEnabled
property set to false
by default. This property prevents these nodes from capturing input and are effectively invisible to the event chain.
Moving from Delegates to Closures
One of the advantages of blogging about my work is that it makes me think carefully about what I’m doing. After finishing my post on my instruction system, I started reading more about closures which led me to reconsider some of the decisions I’d made.