zerodowned

Moderator
I'm adding two things for all equipable items on my shard. A count and a cap.

Should I have each of these ( the count and cap ) under their own version for ser/deser?

They will need to be counted and changed individually.

I'm just honestly not sure how info is saved, and if I save both in the same "block" could it eventually cause problems??
I have yet to run into any problems testing it myself and running this system with various saves over the past few months. But now that I'm transferring to Serv, thought it was a good time to clean up some code. :)
 
I think you are referring to the versioning? You need to create a new version in the serialization method only if you have created the items into the world prior to a save. You do not need a different version to hold multiple properties.
 
I thought I misunderstood the question.

Even if you did, someone else reading this thread in the future might have received the exact info they were looking for in your post.

Not meaning to give you are hard time, I'm just a believer in not deleting good info and you had some good reference material there.
 
One of serializations core fundamentals is the order in which you read and write data. This means you must deserialize objects in the same order that they have been serialized.

I think that was it..
 
LOL

Yes, once the item has been introduced into the world and saved once, you will need to make a new version if you plan to change the properties of the item. This is all about backward compatibility for items that already exist.

When you don't version properly, you get that message that we all love about deleting items at server restart!
 
-_- "love"

good to know, i've been adding to ser, loading server, adding to deser and restarting to prevent that from happening
 
Well a very simple answer is :
Whenever you add properties you want to be added into the stream of saves you have a) keep sure the old stack is not interupted and b) you read same versions equal as you write.

Sample :
Version is always our "Header" it decides wich Attributes are going into the Stream or not.
Then we have Attributes in order we like to be saved and have to read them in same order. Its called FIFO-Priniple ( First in First out).
If we add Additional Attributes we count the Version up by 1. So new Principles are going to be written under a new Version logic.
On the same time on reading the data we must take the version as identifier if we can read on the new standarts or we have to read on the old logic.

Version = 0
Save Version HP , Mana , Stamina

If(Version = 0)
Load Version HP,Mana, Stamina

Version = 1
Save Version Name, HP , Mana, Stamina

Load Version
If(Version = 1)
Name
if(Version = 0)
HP,Mana,Stamina

If you are unable to keep the fifo principle in a worse case you could load Informations into the wrong Attributes, in the worst case you try to read 4 Informations when your save only knew 3 and break the stream apart.

A proper strategy for versioning of data should be made :)

Sources :
http://en.wikipedia.org/wiki/FIFO

PS : I wonder why we still versionate via Streams and not changed to something more flexible such as SQL-DB´s or Json or such.
 
Last edited:
interesting, thank you for that.

as for why, I'm sure there's probably several reasons why. i just don't know what they are
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back