hi, in the process of making a character movement in network wise manner. Using RPC for the functions of movements and different actions, so the query is,,, will there be have to add @RPC functional behavior in every script files to all the funtions and network view component on all the gameobjects (still this is not done by me) OR is there any other way that i should know about. Example : Like directly making the camera in network view manner and with single RPC funciton to draw the whole game to work in a networking manner with the position movement actions and all events synch ? It will be good if i am given a simple answer instead of given reference towards the network example
Hmmm I'm not sure if I understand your problem, but lets try. Every function that you will call vai RPC, has to have @RPC before the declaration of the function. Example: Code (csharp): function callRPC():void{ networkView.RPC("GoRPC",RPCMode.Server,"Hello World"); } @RPC function GoRPC(pMsg:String):void{ Debug.Log(pMsg); } With this code, all clients that call the function 'callRPC' will send a "Hello World" to the server. If you need your server to send back some info: Code (csharp): function callRPC():void{ networkView.RPC("GoRPC",RPCMode.Server,"Hello World"); } @RPC function GoRPC(pMsg:String):void{ Debug.Log(pMsg); networkView.RPC("Info",RPCMode.Others,"Hello Client"); } @RPC function Info(pInfo:String):void{ Debug.Log("Info = " + pInfo); } This way, your clients send inputs to the server and the server send back results. This simple model can be applied for character movement also, althought I suggest you use a networkview with state synchronization and interpolation/extrapolation code (from examples). I hope I have helped.[/code][/quote]
yaa thanks beneton. Got your point. I already worked out in the same manner too, its working too. but there is lag in movement update and while making movement, rotation of gameobject and animations all in a separate rpc. Donno its the proper way. As i did that way only. And now thinking to go for state synchronization with serialize network view. its the method used in the network example of car driven on a terrain. so should go for this instead of RPC.
Yeah, I would go for state synchronization. And make sure you use some Interpolation/Extrapolation code. This way the movements and rotations won't me laggy. If you are using Authorative server (as I think you are) make sure you use some Prediction code also, so the clients can feel a slow response from their input.