Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Shooting by mouse de-synchronization #148

Closed
xPaw opened this issue Feb 22, 2012 · 13 comments
Closed

Shooting by mouse de-synchronization #148

xPaw opened this issue Feb 22, 2012 · 13 comments

Comments

@xPaw
Copy link
Contributor

xPaw commented Feb 22, 2012

If you shoot using mouse keys, it will make both players shoot in multiplayer, and by doing that it will cause de-synchronization in player origins.

@zorro300
Copy link
Contributor

So no more mouse-shooting in MP ? Or is it fixable

@xPaw
Copy link
Contributor Author

xPaw commented Feb 22, 2012

Should be fixable, i didn't look. I need to setup egit for eclipse properly, then i will be able to fix moar bugs!

@zorro300
Copy link
Contributor

I have that setup but my fork queue keeps bugging through , whenever I want to apply the new forks , they all turn red

@framp
Copy link
Contributor

framp commented Feb 22, 2012

I'm trying to fix it, I don't think I'm too far

What I've done (schematically) until now:
In network/packet:

  • define a ChangeMouseCommand in network/packet/ChangeMouseCommand.java which copies the mouseButtons data
    In MojamComponent
  • use a synchedMouseButtons array instead of mouseButtons
  • synchronizer.addCommand(new ChangeMouseCommand(mouseButtons));
  • edit handle(int playerId, NetworkCommand packet) to save the mouseButtons in the right synchedMouseButtons

The mouse data is sent succesfully and I'm able to print it succesfully. The only thing which isn't working is the remote player aiming right now (probably due to offset problems I believe)
If you have suggestions: https://github.com/framp/Catacomb-Snatch-1/commit/2f2f5459d4808504330358960462d4aa3a33c10e

@Borsty
Copy link
Contributor

Borsty commented Feb 22, 2012

Commented.

@framp
Copy link
Contributor

framp commented Feb 23, 2012

Added a pull request
#219
The players now have the right mouse events mapped correctly, but there is still something in the mouse implementation which make the multiplayer game go out of sync.

@richie3366
Copy link

Probably because the new facing direction is not transmitted to the other player ?

@framp
Copy link
Contributor

framp commented Feb 23, 2012

Well the Player.setAimByMouse should calculate the new facing using the sent mouse data.
I tried sending the new facing direction together with the mouse values (I even tried sending aimVector) but the problems persisted.

@framp
Copy link
Contributor

framp commented Feb 23, 2012

Woah! Looks like Flet definitely fixed it:
4485792

@zorro300
Copy link
Contributor

Theres already a new bug with the latest update about the mouse ---> #239

@richie3366
Copy link

I think you should try to edit the setPosition method by doing the same system for the states (eg. currentX, currentY, nextX, nextY), it should probably work better ;)
Edit : And by the same, change the tick() method

@Flet
Copy link
Collaborator

Flet commented Feb 23, 2012

@richie3366 yep, would be more prudent. Go ahead and fork/push if you want to give it a go :)

@Flet
Copy link
Collaborator

Flet commented Feb 23, 2012

closing issue, but @richie3366 has a good point

@Flet Flet closed this as completed Feb 23, 2012
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

6 participants