0
votes

We are builds a game with Spritekit that requires physics engine to be deterministic.

The concept of the game: 2 players - 2 devices. Each player waits for another to play the turn. On each turn player is applying impulse on one of physics bodies and sends via websocket the impulse and the body on which impulse was applied. The problem is that each physics simulation the results is different.

According to this article http://blog.element84.com/comparing-sprite-kit-physics-to-direct-box2d.html (Test 3) we have found the problem in Spritekit Physics Engine. We tried to switch SpriteKit with Cocos2d 3 + Chipmunk and got the same problem (little bit better than SpriteKit).

Now, the only way we have found is to switch to Box2d, but we have no idea how to connect the engine to our project.

According to this article : SpriteKit Nodes Sticking to Edges of Scene / Not Bouncing it seems to be possible.

Our project is written in Swift.

Similar game : https://itunes.apple.com/en/app/soccer-stars/id826523703?mt=8

Any suggestions?

1
your physics bodies contain equal weights? and secondly sprite kit uses box2d internally for similar impulse just define mass of a bodydragoneye
yes the mass is equal. The problem is the sameAlex Shuraits
Can u post that part of code ( Physics one)dragoneye
I don't think any of the physics engines are deterministic. If you need that you had likely better script movement yourself.Jonny

1 Answers

0
votes

I'm think this can't work because all the physics engines will be different on different devices. The ways to handle network physics are discussed very well here:

Introduction to Network Physics by Glenn Fiedler