Advertisement

Script Object Serialization

Started by May 04, 2009 12:21 AM
1 comment, last by Wavesonics 15 years, 6 months ago
I'm currently looking into ways to synchronize script objects over a network. My current method for application side object is to serialize them, send, then unpack on the client and using a UID, update the corresponding client side object from with the deserialized values. I overload the stream insertion and extraction operators to do the serializing at the moment. What I'm wondering is how I might go about a similar method for Script Objects. My first thought is for each Script class to have a serialize/deserialize method, register a custom stream class and have methods it can use like: stream.putInt() / stream.getInt() This is fine and all, but what sort of application side introspection can the script engine provide about Script side classes and objects? A more automatic serialization handled on the application side would be nicer.
==============================
A Developers Blog | Dark Rock Studios - My Site
asIScriptObject has member functions that can be used to inspect the state of a script object. GetPropertyCount() will tell you how many members the object has, GetPropertyTypeId() and GetPropertyName() will tell you about the type and name of the properties and you can use GetPropertyPointer() to inspect the individual values.
Advertisement
Great, thanks SiCrane!
==============================
A Developers Blog | Dark Rock Studios - My Site

This topic is closed to new replies.

Advertisement