I do a small step-by-step (25 seconds per move) network game on Phaser.js (P2 physics), according to the air hockey principle.
The essence of the work is as follows. When one player walks (runs his chip on the principle of angry birds, that is, it delays and indicates the direction), then the sprite ID, velocity.x and velocity.y are transmitted to the server. And from the server, respectively, this data goes to the second player and the chip with the same ID is assigned the data of the applied acceleration. Everything basically works as it should. Both players have all the chips on the field in the same way. But, from time to time (at least 1 time per game) there is a failure and the chips of one player move around the field differently from the chips of another.
All sprites have body.setCircle (radius). The border of the field is set manually (rectangle on the white line).
Can anyone come across a similar problem and tell you how to solve it. Maybe in addition to speed, you need to transfer some parameters to the server?
