Set position conflict with physics

0 favourites
  • 3 posts
From the Asset Store
10 Beautiful Pokemon-like Building Pixel Art Sprite Sets
  • I have troubles when I try to change physic player position. I'm working on multiplayer project on my own and every 0.1 seconds I send player position to server, then server sends this to all other players. But I noticed that it has some differences between object positions on different screens. Then I noticed that when I try to change the position, physic change it back. All works fine if I turn off physic. Sorry, I can't provide a capx cause it's multiplayer require special server files which I made by myself. How can I fix my problem?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • In a client server setup, the client shouldn't be doing physics calculations. Only the server should. The server is the system that decides where every object is and how they are interacting with each other. On the client side, you may need to extrapolate player positions given their current state and position but this should really be a minor calculation to keep the client as close to up to date as possible while waiting for the server to update it. The client should have all behaviors disabled and should send all control events to the server.

  • thank you! I will use your inctructions on the bigger project, but now I have this project only like a hobby. What about the physic conflict - I found a solution. I just calculate velocity from time.For example (mouse.x - player.x) / 0.1, where 0.1 is time and (mouse.x - player.x) is distance on X. I really appreciate your help. Good luck

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)