Jump to content

Multiplayer game object misalignment


Codeaddictx
 Share

Recommended Posts

Thats exactly what I am doing. There is a central login point where coordinates are emitted to all clients. But some funny reasons I can't explain they won't just align. A simple test was to move one of the players  directly over the other and left it there. It appears so on the first screen, but on the second, it was few pixels away from it.

Link to comment
Share on other sites

41 minutes ago, Codeaddictx said:

Thats exactly what I am doing. There is a central login point where coordinates are emitted to all clients. But some funny reasons I can't explain they won't just align. A simple test was to move one of the players  directly over the other and left it there. It appears so on the first screen, but on the second, it was few pixels away from it.

hey man. I'm soon going to start diving into multiplayer implementation like you. I have zero experience in that. I think you need to double check few things:

1) How you are reading the positions: position property, getAbsolutePosition(), scene.pick() data, window mouse event etc

2) When you are transmitting the data and whether the last coordinates you expect did really get received by the other client, and that they are really the last

3) How you are setting the positions: position property, etc.

I do not have much information, nonetheless this is general guideline of what I would investigate on.

I'm thinking, it would be useful to mock the events received from the server, like put them in a file and have that file be read line by line. Then I would be able to test the receiving client in isolation...

UPDATE: just a little more clarification:

Clearly, using coordinates reported by objects of the game engine is the right thing to do, because that's what's expected to remain consistent, unlike screen resolution, render width or mouse location on window.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...