0
votes

I have found out thanks to this article: http://blog.element84.com/comparing-sprite-kit-physics-to-direct-box2d.html and personal experience that Sprite Kit is not deterministic when using physics simulations. However I was wondering if the collision logic actually deterministic when handling the node's position in a deterministic way. i.e. Repeatability works fine but my position handling.

Thanks!

UPDATE: Added more detail

In SpriteKit, physics simulations don't seem to be deterministic since they are evaluated in the game loop and depending on the frame rate of the device they can be executed at different rates. My question, is collision detection (such as the didBeginContact method) for physics bodies independent from the loop and called right after the position of the node has changed. I am trying to use only the collision properties from Sprite Kit to achieve repeatability in 2 instances that might perform at different frame rates.

1
This should help understanding how a scene is processed.developer.apple.com/library/ios/documentation/GraphicsAnimation/….Knight0fDragon
@Knight0fDragon Here it says "Your game can also receive callbacks when physics bodies come into contact with each other." that seems to be separate from this life cycle, that's why I wonder that.luis
What that is saying your app can receive callbacks other than didSimulatePhysics during this time, didBeginContact being one of these callbacksKnight0fDragon
right but it never says in there that everything is ran in the same loop, anyway, I found out all callbacks are called in the same loop.luis

1 Answers

0
votes

Just in case this could help someone, I just found out that all collisions happen in the Sprite Kit loop, therefore they are not repeatable nor deterministic for that matter.