In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file, a memory buffer, or transmitted across a network connection link to be "resurrected" later in the same or another computer environment. When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward.
This process of serializing an object is also called deflating or marshalling an object.[2] The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called inflating or unmarshalling).
For the past couple of days I have been working on a new project to serialize every type of variable that can be used with SC2, at the moment I have most of the basic types along with a two or so of the more advanced variables. If anyone has any comments, feedback, or even questions please post them in here. This will help me finish it up along with programing it for ease of use. Thanks and have a nice day!
Could you explain what the general purpose of serialization is? I've seen it done for other things, but I don't understand the practical purpose of it yet.
Well, one potential use I could see is creating a virtual machine, to overcome the memory use restrictions imposed by blizzard. Fixed-size arrays are inefficient for many tasks and their use is prone to bug generation. By converting data types to byte sequences, they could be stored in one chunk of memory. Basically, it could be used to create our own dynamic memory system. I think it's a good idea and could open up map making to true object-oriented design.
Have you already done some stress testing how fast that conversion is?
If the speed impact isn't too great it could be interesting, especially for maps with a lot of script.
Have you already done some stress testing how fast that conversion is?
If the speed impact isn't too great it could be interesting, especially for maps with a lot of script.
I have started to do some stress testing and so far it looks like basic variables take 0.001 seconds (this could be off, timers aren't this accurate), and more complex variables take a little more time.
If basic variables takes up to 0.001, and standard and the more complex variables ranges from a estimate of 100 -> 10k times that amount...
I see very very laggy coding using object oriented designs, not because the designs are bad, but the source of SC2 isn't designed for using object oriented coding.
If basic variables takes up to 0.001, and standard and the more complex variables ranges from a estimate of 100 -> 10k times that amount...
I see very very laggy coding using object oriented designs, not because the designs are bad, but the source of SC2 isn't designed for using object oriented coding.
Well you messed that up you know, complex variables aren't 100 -> 10k times 0.001 seconds (That is 0.1 seconds -> 10 seconds)....They take approximately 0.005 seconds.
Or better yet I re-ran the tests with more numbers and even discovered how to figure out how long it takes (in ms) for a trigger to run. For a simple variable it takes approximately 0.00900818 ms. And for more complex variables it takes approximately 1.4975295 ms. The most complex variable I am most likely going to have is either Unit Filter or Unit. Unit Filter is the only one of the two it supports right now and to either serialize or deserialize it requires 44 non-string function calls.
I meant complex as in a mod using only object oriented designs I mean, not with this small test.
Because object oriented modding would require several objects to be functional at once, and this might be laggy.
All times are in milliseconds (1/1000th of a second), it is only getting hung on my Unit Filter stuff because I have to rework it so there is no while loop. Or even better to get the actual bit representation in one go.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
http://www.sc2mapster.com/assets/sc2-serialization/
For the past couple of days I have been working on a new project to serialize every type of variable that can be used with SC2, at the moment I have most of the basic types along with a two or so of the more advanced variables. If anyone has any comments, feedback, or even questions please post them in here. This will help me finish it up along with programing it for ease of use. Thanks and have a nice day!
Could you explain what the general purpose of serialization is? I've seen it done for other things, but I don't understand the practical purpose of it yet.
Well, one potential use I could see is creating a virtual machine, to overcome the memory use restrictions imposed by blizzard. Fixed-size arrays are inefficient for many tasks and their use is prone to bug generation. By converting data types to byte sequences, they could be stored in one chunk of memory. Basically, it could be used to create our own dynamic memory system. I think it's a good idea and could open up map making to true object-oriented design.
Would be very inefficient to do the conversion everytime you want to use the objects I guess ...
@7H3LaughingMan: Go
Have you already done some stress testing how fast that conversion is?
If the speed impact isn't too great it could be interesting, especially for maps with a lot of script.
I have started to do some stress testing and so far it looks like basic variables take 0.001 seconds (this could be off, timers aren't this accurate), and more complex variables take a little more time.
If basic variables takes up to 0.001, and standard and the more complex variables ranges from a estimate of 100 -> 10k times that amount...
I see very very laggy coding using object oriented designs, not because the designs are bad, but the source of SC2 isn't designed for using object oriented coding.
Well you messed that up you know, complex variables aren't 100 -> 10k times 0.001 seconds (That is 0.1 seconds -> 10 seconds)....They take approximately 0.005 seconds.
Or better yet I re-ran the tests with more numbers and even discovered how to figure out how long it takes (in ms) for a trigger to run. For a simple variable it takes approximately 0.00900818 ms. And for more complex variables it takes approximately 1.4975295 ms. The most complex variable I am most likely going to have is either Unit Filter or Unit. Unit Filter is the only one of the two it supports right now and to either serialize or deserialize it requires 44 non-string function calls.
I meant complex as in a mod using only object oriented designs I mean, not with this small test.
Because object oriented modding would require several objects to be functional at once, and this might be laggy.
@dra6o0n: Go
All times are in milliseconds (1/1000th of a second), it is only getting hung on my Unit Filter stuff because I have to rework it so there is no while loop. Or even better to get the actual bit representation in one go.