I hit Twitter up for comment and got a +1 or so there. Maybe I'll download the SpriteBuilder source on the weekend and do some exploration.
@birkemose Interesting is good.
@collidernyc Yes - its a can of worms. You're also right about how PlayMaker is integrated with components. I think the Chipmunk physics integration would be a good model - where physics runs its simulator and updates x & y on objects, the state machine would update when events were triggered and update a whole range of properties. You could access the statemachine that was attached to an object like you can access the
[myNode physicsBody]. For global HSM's that are not specifically attached to one object they could be accessed like the physics node:
// Game play state machine is a global thing
_windStrength = [[_sceneStateMachine getVariableByName:@"windStrength"] integerValue];
// Enter the "chasing" state by telling the monster the game started
// Enter the "idle" state which causes idle animation to play, until player issues command
Of course you'd eventually be able to hook this stuff up visually so that this sort of code would not be needed.
Like the physics springs and joints there'd need to be some sort of graphical representation of the HSM in SpriteBuilder, allowing them to be hooked up to objects.
Key to doing it from a project point of view would be to try to get something small that was useful really early, while balancing a longer laundry list of "must-haves" and "nice-to-haves".
I've got an Android port of my game I gotta do, but if we get some more up-votes maybe this can be a thing I put some weekends into.