Sunday, April 27, 2014

Full levels over Network

Full levels are now sent across the network to all connecting clients.
When the server generates a level it also stores the level as a string, this string is then sent to any connecting clients, or to all clients in the event of a level change. The reasoning behind converting to and from a string instead of sending the entire two-dimensional int array is that RPC calls can only handle a handful of data types, and arrays are not one of them. This is in any case only done on connect and level change, so we can afford to take the extra time to interpret the strings.

From the RPC documentation: "Valid RPC parameters are int, float, string, NetworkPlayer, NetworkViewID, Vector3 and Quaternion."

We use Vector3, Quaternion and NetworkViewID sending extensively, in addition to the basic string/float/int sending. Vector3 and Quaternion sending is mainly used for position and rotation information, while NetworkViewID is for linking NetworkViews together.

Picture from the client: (Server and client player objects shown)

No comments:

Post a Comment