[CoOp] NetworkInterpolatedTransform and NetworkRigidbody

TobiasTobias admin
Let's try something new.
The idea of this thread is to cooperatively work on two components used for physics in networked games.
Everyone is asked to provide improvements, feedback and help.
We will provide initial sources and moderate changes, whenever possible. Later on, the code can be put into a public repository, too.


NetworkInterpolatedTransform and NetworkRigidbody
are two components well known from Unity's networking samples. They are used to minimize the effect network lag has on physical objects.

Initial Sources
Some time ago, Leepo wrote a small testcase for these components, attached to this post.
There is also a discussion about good settings for these classes: viewtopic.php?f=17&t=2447&p=11424#p11424
Another relevant topic: viewtopic.php?f=17&t=1930&p=9186#p9186

Comments

  • Holy cr**!

    You are awesome. I hope we will find some solution. Has the photon team looked on the timestamps? Are they correct?
  • Timestamps should be ok. I don't know of any issues.
  • Fantastic thank you.
  • As much as this question comes up I figured there would be better response on this topic. Not sure how much help I can be but I will read things over.

    Do we have a TODO list to work from?
    Should the documents be hosted on a repository somewhere for everyone to share/edit?
    How awesome is Exit Games support?
  • Thanks for joining our cause :)

    We don't have a TODO list yet. We could build one from initial feedback and requirements when they get posted.
    We can create a bitbucket for this, which also can contain the documentation.

    > How awesome is Exit Games support?
    Difficult question for me ;)
  • In the interests of pushing stuff forward to the next level, are we going to have a central location for useful community driven scripts for PUN/other stuff, github for instance?

    And I couldn't see any areas of improvement in the marble script, although this article is of interest from MS: http://www.mmorpg.com/discussion2.cfm/p ... 22#2228522 (scroll up). It's a variant of what's being used here and worth the read.
  • So far, there was not a lot of feedback or improvement, so this topic has fallen asleep again.

    Github would be a good choice for coop, yes. At the moment it's pretty busy here but I should be able to squeeze-in the setup.
    Thanks for the link. I will dig in to that in a while. It looks like a pretty exaustive description of what's needed and fitting solutions. Nice!
  • Hi ALL,

    GR8 that you mention this topic, i've been searching for a week now. im making a pong style game, which uses photon. im using colliders for actually rebounding the ball on the paddles.
    i had some problems regarding the sync of the paddle. P2 ( client ) , the way he sees it, try to hit the ball, but the ball penetrates his colliders, on the other hand , P1 ( server ) , the way he sees it, doesnt see that P2 actually hitting the ball ( lag )...
    I hope I managed to explain some of my problems.
    anyway I'll be glad to help improving this issue....
  • In the MarbleTest project, one issue I've run into is that sudden changes in velocity appear rather jerky for marbles that are not owned by the client. It's easier to see this if you modify the rigidbody to have a mass of .1 and a linear drag of 10, which better matches what a player object might use. Spawn 2 clients, and in client 1 hold the left key for a bit, then immediately switch to the right key. Watch in client 2 and notice the jitter/jerk in the marble when it changes direction.

    I've found three options that help:
    1) Increase the InterpolationBackTime to around .300. The displayed position will be further behind reality, but it moves very smoothly.
    2) Decrease the rigidbody movement speed.
    3) Increase the sendRate/sendRateOnSerialize to 20.

    It seems that avoiding extrapolation is the main goal, which each of the above do. Has anyone else had a problem with this? Is there a better way to work around it?
  • I don't think this is heavily used, so feedback will be sparse.
    The values you propose might make more sense than what's set as default. You only have the choice to accept more lag or potentially more corrections which break the "physically-correct impression".
    Can you work with the values you use now?
  • I'm surprised this isn't used more, it seems like many PUN projects would want to make use of networked rigidbodies. I thought maybe something was a bit off with the code, since the marble didn't seem "laggy", but actually jerking around suddenly (rather than interpolation). I wasn't sure why the extrapolation portion was being used so frequently with an interpolation back time of 100 ms, and my ping at a steady ~65ms.

    Anyway, making the adjustments I mentioned seems to have sufficiently improved things, so I'll stick with that for now.
  • You are right: I also expect this to be a hotter topic. Obviously not too many are using that or don't talk about it.
    We decided to put some more work into those common topics, so I hope we can polish this soon. I will definitely revisit your post then!
  • I tried this script and it worked perfect with less than 30 monsters, but im trying to sync 100+ monsters, is there any way I can work with that amount?
  • PUN is not exactly made with hundreds of entities in mind. Monsters? Sounds like you could considerably optimize your network-load by sending "target positions" for your AI instead of using a dumb position-sync. I assume monsters "plan" where they want to go, no?
  • dig0rulez wrote:
    I tried this script and it worked perfect with less than 30 monsters, but im trying to sync 100+ monsters, is there any way I can work with that amount?

    which script are tested? NetworkRigidbody.cs OR NetworkInterpolatedTransform.cs

    i need too to smooth movement in network :geek:
  • Tobias wrote:
    PUN is not exactly made with hundreds of entities in mind. Monsters? Sounds like you could considerably optimize your network-load by sending "target positions" for your AI instead of using a dumb position-sync. I assume monsters "plan" where they want to go, no?

    This makes me ponder ways to send dynamically generated, frame aligned pathing graphs for hordes of NPCs as a single fifo queue... Send a single graph once every 10-30 seconds, and send updates graphs every n-th game frame with deltas. This begs the question how does the framework handle sparse data - does it have any shiny aliasing for nulls or are we on our own for that?
Sign In or Register to comment.