Search Unity

Rewinding and Prediction, maybe in Unity 3.0?

Discussion in 'Multiplayer' started by Samb88, Mar 12, 2010.

  1. Samb88

    Samb88

    Joined:
    Mar 26, 2009
    Posts:
    208
    Hey, I got some headache over the last days... weeks..... months, because of networking with our good friend unity. let's say we have any kind of game were a player can move around and collide with everything, also other players.

    so, we all know it won't be synched on all clients, like in a shooter, someone shoots at another one. the server now needs to rewind the game, like "RewindTo(networkTime-sendPackageTime)", then check if the bullet hits anything. it won't work to just fill an array every frame, because we need to know what the physicengine says in that moment.

    now to the opposite thing, the predicting. this is a feature I really miss. you need it for all kind of games, for minigolf games, to show where the ball will go, to show where the cannonball will fly etc.) and we also need that for our online games. like in racing games. so the server know "they are going to collide, we need more packages!!!"

    so, what about those features? are they coming in unity3 (because of the physikengine update) or is it even possible with the current version?
     
  2. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    I think networking and physics are two _absolutely_ different things.

    But I, of course, may be wrong! :D
     
  3. Samb88

    Samb88

    Joined:
    Mar 26, 2009
    Posts:
    208
    Well, I don't use Character Controller, so all my players are physic based. So if the server needs to know where a physic object is moving, it should ask the physics engine :)
     
  4. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    I agree that some type of built in predictive motion concept would be nice... a forward extrapolation of sorts, but this is something that you can do yourself, and to be honest it would be something that would be specific to your exact movement types.... like a plane that generally fly's along a predetermined spline etc should be easy enough to do. A player that can move erratically would not be so easy...

    With regards to your physics bullet example, i think you are going bout it the wrong way. In the case of Networking, once a player object fires a bullet at another object, it becomes an issue of ownership. If the player object owns the bullet, then it decides in it's "client session" wether it hit its target or not, regardless of what it "looks like" on other machines... alternately, you could shoot a bullet and make the bullet owned by the object being shot at, and then let that targets clients machine decide if it is a hit or not and notify the rest of the world.

    I dont feel you could ever get a physics simulation working on a network game where everyone see's exactly the same thing and all physics return all the exact results.... Definitely not in a P2P networking setup.... maybe with a client/server setup where teh server ran all of the physics.