- Home /
[Network] Serialize or not to Serialize?
I want some competent opinion on that question.
Let's asume i need to send a position of some object from server to client. I have two options, i can either make a class with x,y,z then serialize it into string and send to client using rpc function(string), or i can create a simply rpc function(x,y,z) and send it this way.
Using serialization in my case is a way easiler then to create functions for every kind of data i want to send over RPC. The question is: how much slower is it to send serialized data instead of simply ints ans strings?
Thanks in advance.
Answer by Chris_Dlala · Sep 26, 2014 at 11:16 PM
Hi.
I think it depends heavily on what the data is and the frequency. We currently send position (and the majority of other) information via RPCs with each parameter. However, for a long time we used OnSerializeNetworkView. We do send complex objects serialized to a string as well. Generally we use parameters for delta or small updates and serialized data for sending whole states. For the function(x,y,z)
example I would have thought that RPC would be quicker, however using OnSerializeNetworkView would allow you to change sync frequency.
I hope that made some kind of sense and was helpful =D
Your answer
Follow this Question
Related Questions
Networking pattern for team-based play 1 Answer
RPC isn't called on objects with another name, even though they have the same script. 1 Answer
View ID AllocatedID: # not found during lookup. Strange behaviour may occur 1 Answer
Animation over network using rpcs 0 Answers
How to use an RPC to send an animation over the network? 2 Answers