Matter-js: Server game loop realisation

Created on 4 Jun 2020  路  1Comment  路  Source: liabru/matter-js

Results different on server and on client, but the game field and code the same.
Different is runners ticks realisation. It depends on result?

Server code:
let runner = Matter.Runner.create({ isFixed: true });
while (collectedBalls.length < generatedBallsCoords.length) {
Matter.Runner.tick(runner, engine);
}

Client code:
let runner = Matter.Runner.create({ isFixed: true });
Matter.Runner.start(runner, this.engine);

P.S. I need to run physics on server very fast to get result of game, before clients start animating the same simulation as server did...

Also I installed timesteps fix https://github.com/liabru/matter-js/pull/777

duplicate

Most helpful comment

I'm also interested on how to achieve this.
I want to simulate the same animation on the server to predict what is going to happen.
The prediction should happen as fast as possible.
How do i do this?

>All comments

I'm also interested on how to achieve this.
I want to simulate the same animation on the server to predict what is going to happen.
The prediction should happen as fast as possible.
How do i do this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

car1ot picture car1ot  路  3Comments

jack-guy picture jack-guy  路  3Comments

moe091 picture moe091  路  3Comments

253153 picture 253153  路  3Comments

kunchenguid picture kunchenguid  路  3Comments