Page 1 of 1

IsReading() in ISerialize

Posted: Tue Feb 20, 2018 9:49 am
by tinkertrain
Hi, I'm simply wondering when the IsReading() function in ISerialize.h returns true? I've read the comment, that it returns true when it does a deserialization pass, but can't quite figure out how to trigger this pass.

Thanks!

Re: IsReading() in ISerialize

Posted: Tue Feb 20, 2018 3:39 pm
by Cry-Flare
Hey there,

I am no networking expert in CE but from my understanding:

When you are syncing objects across the network, you are either sending or receiving data.
If you are sending data, then you are "writing", from the object to the serialization data.
When you receive data, you are "reading", from the serialized data back to the object.

The deserialization pass is automatic, and should happen when there is new data from the authority that needs to be synced with the entity in question.

Check out the Rollingball template for a basic example of syncing an object across the network.

Re: IsReading() in ISerialize

Posted: Tue Feb 20, 2018 7:50 pm
by tinkertrain
Hi,

Thank you! Will check it out!

Re: IsReading() in ISerialize

Posted: Tue Feb 20, 2018 8:38 pm
by fury22uk
Well, u use it for example in NetSerialize function. TSerialize ser is passed as a parameter there and if you send aspect from client to server, then you can do check on client like if (ser.IsWriting ())
And same with IsReading on server. And vice versa, when sending opposite.

Re: IsReading() in ISerialize

Posted: Wed Feb 21, 2018 7:05 pm
by personwithhat2
Each network-related TSerialize object abstracts either a Network-reading or Networking-writing class implementation.

IsReading() will return true if the class is a 'reader' => hence during net serialization if its reading....then it'll be true... XD