question

Constantin Beer avatar image
Constantin Beer asked

Can I persist multiple similar objects with a relative huge amount of custom data?

I'm new to PlayFab and coming from Firebase. I'm working on an idle game like app for mobile devices in which the player can found multiple companies which he can update and manage each one independently.

Right now I want to limit these companies to 10, which the player can unlock over time after reaching certain player levels.

A company should be able to produce four different resources depending on the player's needs and settings for the company - so the company object itself will hold custom data.

Is this something I could accomplish with PlayFab? The economy and player data (title) services seem like not fitting my needs. Is there something else I could use? Can I store such an object as object with key-value-pairs or do I have to store it as JSON?

Thanks in advance for answers/help :)

Player DataTitle DataIn-Game Economy
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.

Constantin Beer avatar image Constantin Beer commented ·

As example how such an company would look like as JSON:

"companyA":	{
	"stars": "3",
	"resources": 	{
		"metal": "2342",
		"plastic": "4325",
		"...": "..."
			}

	"workers": 	{
		"maxAmount": "340",
		"working": "320"
			},
	"maxStorage": "4000000",
	"...": "..."
		}
0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

On PlayFab, you can only store this object as a JSON. You can consider storing it as the Entity Object if you want to keep it a JSON object. The maximum number of Entity objects each Title Player account can own is 5. You can navigate to https://developer.playfab.com/en-US/[YourTitleID]/limits to check the limits of your title. If you use Entity Objects to store the data, you may need to store multiple “companies” in one object. Besides, the maximum size of each object is 1000 bytes. You may need to measure whether it meets your requirements for data size. You can also store it as the value of the Read-Only Player Data K/V pair. If so, the JSON data would be stored as the escaped JSON string.

3 comments
10 |1200

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

Constantin Beer avatar image Constantin Beer commented ·

Hey Sarah,

Thank you for your answer.

In the meanwhile I saw the character feature and thought maybe that would be the solution.

Do you think that would be possible to store each company as character or do you see any mentionable downsides of this approach?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Constantin Beer commented ·

In theory, it is feasible. The possible disadvantage of this solution is that it will cause the waste of resources. Characters also have own Inventory, Statistics, etc. It is designed for the player's subbranches. Its data model should be more complicated than Entity Object.

0 Likes 0 ·
Constantin Beer avatar image Constantin Beer Sarah Zhang commented ·

I will try it with the characters since the company objects are a main part of my game and they will become very huge in the future. The entity object approach would reach it's limits immediately since they only can be as big as 1000 bytes :O.

Thank you Sarah Zhang :)

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.