Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Third Party [Photon] facing very strange problem.

Discussion in 'Multiplayer' started by samshosho, Nov 12, 2017.

  1. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    I have setup a drag race using Photon.
    Even though both devices have exact same car setup. They sync from the same iCloud keys, so they are identical.

    However the car on a 32bit device(iPad 4th Gen.) always speeds up way too fast against car on 64bit device(iPhone7 plus).

    Is there a logical explanation for that?
    Using Real Car Controller v.3
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Logically it would merely seem like the problem is both devices are running at different speeds, and Real Car Controller v.3 isn't framerate independent, or your code isn't.
     
  3. samshosho

    samshosho

    Joined:
    Apr 12, 2010
    Posts:
    370
    How to make the code framerate dependent ? multiply by time.deltatime?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yep, for the parts where the input is not a constant, but changing over time (acceleration for instance).

    To test this is working on a local machine, you could enable vsync and change Application.TargetFramerate to emulate different speeds, and run the game side by side on same machine. You can then see if one of them is reaching the target at a different rate to another. Ideally they would both be within an acceptable range. This is just an initial way to test your delta time code is correct.

    Alternatively if you're really not into deltatime, you can just shovel the acceleration code into fixed update, it wont be amazingly accurate but it won't be too bad either. This is considered a hack.
     
    tobiass likes this.