Search Unity

Networking Example Problem

Discussion in 'Multiplayer' started by showoff, Oct 16, 2009.

  1. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    Hello unity user. I have a question about the networking example. I download the sample files and I integrated them into my project but I’m having two problems that I don’t know how to fix. The first problem is that I’m using the sample files to try and network my racing game but when I get everything working correctly the cars lag like crazy. It makes it very unplayable. The second problem I have is the networking ids host player isn’t correct. For example when the host starts the game his id goes to the person joining the game and the person joining the game gets the host id which causes the host to control the other person’s car and the other person to control the host car. I don’t know but I could be wrong about the ids but I think that’s what is causing my player control problem.
    Has anyone else encountered these problems and what was your solution?
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    The interpolation in the network sample is a pretty simplistic one. For real production usage you want to implement real interpolation and extrapolation.
    With a racing game thats pretty simple as the physics allow good calculations of the past and the future to do that.

    The second problem is near granted that you don't have distinct local and remote player prefabs, actually having input components etc on objects other than the hosts. that happens for example in the authorative server example if you tell it to always spawn local player only
     
  3. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    thanks for the reply dreamora but i am using the same scripts that are in the networking tutorial. I have the networkingrigidbody script apply to my car which has the interpolation and extrapolation in the script and the players are spawn OnNetworkLoadedLevel(). I am also using heavy modify version of the car script from the networking example which turns off the car controls if the car isnt the hosts car.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    The network example is just that, an example.

    I recommend to not missinterpret it as a solution you can just use in any case (that would be a multiplayer racing kit). Its there to show you the concept.

    But for a strong interpolation and especially extrapolation, which is not present at all, you will have to invest own work. it won't do that on its own just as an example.

    There are likely further things you will want to look into as well, aside from the potential requirement to add more stuff to the sync and/or rpcs
     
  5. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    No dreamora I think your misunderstanding what im trying to do. i didnt misinterpret it as a solution. i just use it as it is an example to get something up and running really quick on my end and from there I wanted to improve and change it but first i am trying to figure out how to fix my problem. mainly the player controls side of things. I figure someone else may have ran into the same problem and they could help.
     
  6. mcnikolas

    mcnikolas

    Joined:
    Sep 13, 2009
    Posts:
    42
    Well i have the same problem with my game! I started using the network example and in that concept i 've created my code.The game lags like crazy when the two cars are close to each other but when they are far away everything is ok!.

    I writing this post because i'm hoping that you have found a solution!(i'll check interpolation/extrapolation by the way ;-) )