0

I make an online HTML5 game, like blobby volley (two jellys are playing volleyball). I have a websocket server on php. The game is running with 50 fps. Here is an example of how it works: I push right arrow button, my client sets moveForward flag to true and sends the message to the server. The server transfers the message to the other client, this client handles it. When a client handles keyup it does the same thing, but sets moveForward flag to false. The problem is it takes server some time to transfer the message to the client, so when the keyup event triggers, the jelly stops immediately on one client but is still moving on the other one, and stops within a second. Any ways to make it more synchronous?

soin08
  • 76
  • 9

2 Answers2

0

You might want to try omitting the server in the gameplay and make it a peer-to-peer comunication between the browsers.

I have no personal experience with this, so the best I can give you is a link to this question. It seems that support for WebRTC has been recently added to most browsers.

Community
  • 1
  • 1
voidengine
  • 2,504
  • 1
  • 17
  • 29
  • Yes, support for WebRTC has been added to the browsers but right now it doesn't have data channel. They will add it soon and that's exactly what I need. – soin08 Jul 22 '12 at 18:26
  • Glad I could help. It would be great if you wrote here how it worked for you, once you use it. – voidengine Jul 23 '12 at 08:03
0

Instead of transmitting the action you could just transmit the position, would be more accurate, but still there would be a small lag I guess.

Kevkong
  • 460
  • 3
  • 16
  • 1
    WebRTC DataChannel has been implemented to Chrome Canary. I've already learned how to set a p2p connection, next step is to add all of the code to the game - routine work. – soin08 Jan 25 '13 at 00:47