playMaker

Author Topic: Photon - Laggy / Jerky Ball movement on Pong game  (Read 3547 times)

bizilux

  • Full Member
  • ***
  • Posts: 171
    • View Profile
Photon - Laggy / Jerky Ball movement on Pong game
« on: July 23, 2014, 03:06:38 PM »
hey all...

i made pong game, and now im trying to make it multiplayer with photon. i think i will make tutorial series out of it, and also add it on unity store as completed project... but first i need to solve this problem.

so i've followed demoworker tutorial, and got my pong game up and running with photon, however ball movement is... well not smooth.

i've read alot about it, yes im using Lerp, its basically the same setup as with that demo worker.

i tried reliable delta compressed and unreliable mode.... unreliable seems to work better...
i also tried changing Vector 3 Lerp 2, Amount from 5, to all the way to 30.


pong is a fast game where you need to have exact ball position... so yes, cant have any lag. :/

there is a huge difference in smoothness between server and client versions of the ball.
« Last Edit: July 23, 2014, 03:09:58 PM by bizilux »

bizilux

  • Full Member
  • ***
  • Posts: 171
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #1 on: July 24, 2014, 09:52:13 AM »
video:

recording has low frames per second, but i think it can be clearly seen that movement of the ball on left screen is smooth, and on right screen is... well not smooth... it doesnt even come to borders, it just cuts it off sooner than that.

and i attached my lerp settings
« Last Edit: July 24, 2014, 10:33:12 AM by bizilux »

bizilux

  • Full Member
  • ***
  • Posts: 171
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #2 on: July 25, 2014, 05:52:51 PM »
okey in case someone is wondering... i made no progress on this problem :)

so yeh... still searching for help! :) hehe

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14564
  • Official Playmaker Support
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #3 on: July 29, 2014, 05:50:13 AM »
Hi,

 Without access to the project itself it's hard to tell but my gut feeling is one or both of these possible routes:

-- you are mixing update and late update and physics right? if you use physics, you must use the right call ( likely everything on LateUpdate) to properly avoid jittering.

 in this case, check out the ecosystem, I am slowly but surely making a series of "Advanced" actions that are exacty replicas of PlayMaker actions only you can choose the update call properly, and thus totally control and get rid of this kind of jittering.

-- prefer NOT to synchronize the position at all time, but instead send discrete events everytime the ball hit the wall, givine the direction it will now go, which is enough to then compute on all clients the movement of the ball after each of these events are fired. This way you completly avoid lags, and the onle point of "blurryness" in your logic is the lag of the event being sent over the network, which is dramatically less then lags that would happen on a constant stream of data.

 Bye,

 Jean

bizilux

  • Full Member
  • ***
  • Posts: 171
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #4 on: July 29, 2014, 07:23:26 AM »
hey jean. thanks for answer. i was hoping you will chip in and help me :)
unfortunately i am on vacation this week on sea. and i do have unity with me but internet connection is too slow to test photon. so i will report back next week when i try this from home :)

jackforyou

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #5 on: July 03, 2016, 08:05:42 AM »
How can you solve this issue?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14564
  • Official Playmaker Support
    • View Profile
Re: Photon - Laggy / Jerky Ball movement on Pong game
« Reply #6 on: July 22, 2016, 06:26:55 AM »
Hi,
 
You would have several ways to solve this.


1: using RPC call, for every collision, where only the MasterClient owns the ball and decide on hits and all, so everyother clients would simply get this rpc which would contain a position, a direction and a speed, and maybe a reference of the object ibounced off.

with this you will have no jerkiness because each client will animate the ball precisly, not in a "serialized" way several times per update.

2: increase rate and put a greater lerp value for smoother results

3: lastly, are you sure you are using late update for positions, maybe this is the problem after all, or part of it.

Bye,

 Jean