I am currently making a POC (Proof of concept) with a simple pong :
I have a board
2 rigidbodies players (instantiated each with the Onnetworkleveloaded and Network.instantiate).
1 Rigidbody Ball.
I let the Physics engine do its works when a player touch the ball…
The problem is as follow :
When the server touch the ball : ok, i can see the movement of the ball in the server and client. but if the player touch the ball, the movement is seen on server and client but the movement is not as expected.
Is it due to the owner of the networkview on the ball ? do i have to change the owner each time the ball is touched by the client player or server player ?
I am unsure but I would go for an authoritative server, where the server makes the calculation.
When the application runs, if you are not the server, put the ball isKinematic On. If you are the server, keep isKinematic Off. Make the server the owner of the ball so it is the server who update and make all the calculation for the ball position, speed.
Thanks for your help, i was thinking about authoritative server that night.
But like this :
All is controlled by the server (calculation …).
Only Input are coming from Players.
When input comes on the server, the server “play” the input on the appropriate object in the scene.
I will try this and so, the isKinematic flag like you specified.
Finally, after 1 day work i successfully have a networked PONG like using rigidbodies and Physic engine.
All objects are instantiated on the server (and so controlled by it) except 1 object : the UserControlInput (instantiated on each client (here only 1).
I check every 250 ms if my input have change since last call if there is a change i send data over the network to the server. (using RPC and RPCmode.server only)
The server then apply the input on the player2 (which is the client).
So, each player have a networkrigidbody script => this correct the position of the player (Syncbetweek server and client).
Here is a link of the results :
thanks for all…
PS: this is not intended to be released but only for POC / test…about networking with U3.
PS2 : Does the iphone need wifi ? or can we use networking with iphone over GSM EDGE 3G ?
When i run it on my iphone it contact my masterserver (which is hosted on a dedicated server), the server is ok, when i launch a client on my desktop, it cannot contact my iphone … ?