question

Hans Weber avatar image
Hans Weber asked

Solutions for saving Data on Items, regarding the storage-limit

Hello,

I have more of a theoretical question:

I am working on the backend for a game similar to clash of clans, where players can build their own bases and interact with the buildings they've build.
Buildings should utilize timers for upgrading and resource generation, aswell as save their level and resources ready for collection and the affiliated timestamps "on" their individual item custom data.

My problem is not actually implementing any of this, but how to store all for this data on the individual items(Buildings) instead.

[System.Serializable]
public class BuildingData              	// contains general information regarding a building
{
   // Stats:
   public BuildingType type;     	// buildingType
   public int BuildingLevel;      	// buildingLevel
   public int Bs;      			// buildingSlot
   public ResourceType Tg;    		// ResourceTypeGenerated
   public DateTime lH;     		// last harvested
   public int Op;          		// OutputPerHour
   public int sC;          		// storageCapacity
   public bool cC;     			// currently under construction
   public DateTime fT; 			//projectedConstructionFinishTime
   public int SI;      			// cost for upgrade silver
   public int FU;      			// cost for upgrade fuel
   public int ST;      			// cost for upgrade steel
    
   // default constructor for json-serialization:
   public BuildingData()
   {
            
   }
}


So far I've ran into the problem of having to comply with 100-byte storage limit for item custom data, which is simply not enough, since a single TimeStamp already takes um 24 bytes when converting it into a json, which is why I had shorted the names of these variables (of course this doesn't solve the underlying problem).

Is there a workaround for that? Does the 100 byte limit only aply to a singe key-value-pair?

Thank you for your help.

Hans

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

·
Xiao Zha avatar image
Xiao Zha answered

The 100-bytes limit for inventory item data is for the value per key, and although PlayFab does not limit the number of keys (KVP), but as you can see in the limits page, you can only update 5 KVPs in one API request. If you have a lot of KVPs , we recommend storing your JSON data in Player Data, which is more convenient to use.

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.

Hans Weber avatar image Hans Weber commented ·

Thank you very much :)

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.