question

dominiquecanzeri avatar image
dominiquecanzeri asked

entity objects/files: ExpectedProfileVersion is not granular

hello,

as suggested, i've played with the entity files/objects API to store data. it is nice because it provides a ExpectedProfileVersion field for setting data.

However, this field is for the whole player data, and not per-Object/FileName. This makes the feature unusable.

for example (in pseudo code):

int data01Version = SetData("data01", "{}", expectedProfileVersion=null);//returns 2

int data02Version = SetData("data02", "{}", expectedProfileVersion=null); //returns 3

data01Version = SetData("data01", "{}", expectedProfileVersion=data01Version); //error, expected 3, but 2 is provided.

in this case, setting data02 should not change the expectedProfileVersion for data01.

such collision would happen if multiple cloudscripts, gameservers, devices access the data01 at the same time.

Is there a way to get a per-Object/FileName profileVersion?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

SetObjects API is used to set objects in one entity’s profile. ExpectedProfileVersion is used to specify the previously returned value of ProfileVersion from GetProfile API to ensure that the object set will only be performed if the profile has not been updated by any other clients since the version you last loaded. ExpectedProfileVersion is targeted for the entity profile, not objects. So, current this API’s behaviors are by design. Profile and objects are different concepts, so game developers can’t get the “per-Object/FileName profileVersion”. If you use SetObjects API, a good practice is to manage all objects in one entity profile as a whole.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dominiquecanzeri avatar image dominiquecanzeri commented ·

hello,

""good practice is to manage all objects in one entity profile as a whole"" is not practical for us.

we want to manage objects/files independently of each other.

the entity files API has a checksum, which allows us to atomically update a file.

it's a shame that the entity object API doesnt support something similar.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.