As I’ve been working with Entity Component Systems in SpriteKit, I’ve come to realise that Apple’s implementation of the pattern is subtly different to what I understand is the ‘pure’ form of this pattern.
Our man (and the potential protagonist for my first adventure game) taking a break on a balcony that looks very much like the one we have here in Veste, Italy.
Since I started my series about handling movement, I’ve learned a lot more about Entity Component Systems and I’m changing the way my engine is structured to reflect this.
While this sounds like a Typical Simon Rabbit Hole, it has fundamentally changed how I approach game engine development and I have made some huge strides with very minimal effort. Thanks to the advantages of ECS, some features that I thought would have to wait for many versions down the line have become trivially easy to implement.
We recently visited Masseria il Frantoio again (the link details our first visit) and this time we got to stay for two nights.
Out in the garden, by the olive trees, there is this cute little shed that serves as an honesty bar, where you can grab whatever drinks and snacks you want and just note it down.
In part one, I set up a Movement Component that moved sprites around a space without any regard for the type of scene that they inhabit.
However, many adventure game scenes have some sort of perspective where it’s possible for players to move around an object.
Imagine a game where, say, a character in a trench coat is visiting a square in Lecce, Italy. For some reason, there’s a crate in the middle of it:
In my initial prototype I used SKActions exclusively to handle movement. It’s a fire and forget solution—I create an action with a destination point and a duration and run that action on a sprite. SpriteKit will move that sprite to the given point over the given time without me having to think about it again.
let moveAction = SKAction.moveTo(x: hasTarget, duration: length / moveSpeedInPointsPerSecond)
It’s great for many situations. However, there are a few limitations:
Since my last update, we have settled in Lecce, Italy for four weeks and I am back in the saddle and racing that horse as hard as I can towards the bright and glorious sunset that is AdventureKit 1.0.
Tortured metaphors aside, I have made some significant progress in the last two weeks. All of the Development tasks in my roadmap are just about complete which means I can now edit scenes directly on the iPad and have the changes appear in running scenes!