Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TVOS spritekit game data archive location

I've been trying to save the data of a stage as an archive of a SKScene for my TVOS game. I got it working on a simulator. However, the TVOS apparently doesn't have local storage to put the archive in.

The only other places I can figure to put the archive in are in the bundle itself (which is frowned upon for some reason) and the cloud (which seems silly needing to connect to the cloud to read game data that really should just come with the game).

I'm not really sure what the right way to proceed is, now.

like image 699
Zek Avatar asked Jan 02 '17 19:01

Zek


2 Answers

I've been trying to save the data of a stage as an archive of a SKScene for my TVOS game. I got it working on a simulator. However, the TVOS apparently doesn't have local storage to put the archive in.

You have a small amount of local storage...

The only other places I can figure to put the archive in are in the bundle itself (which is frowned upon for some reason)

You have UserDefaults 500kb locally and iCloud KVS 1mb (up to 1024 keys) for other small storage.

and the cloud (which seems silly needing to connect to the cloud to read game data that really should just come with the game).

When you use Apple libraries, you get used to doing silly things, eventually :{

I'm not really sure what the right way to proceed is, now.

Use UserDefaults or CloudKit depending on how big your graphs are, and then write Apple an angry email (as we all should).

like image 63
Fluidity Avatar answered Nov 16 '22 00:11

Fluidity


tvOS does have local storage. However, it is limited to 4 GB.

As of January 12, 2017 - Apple is now accepting tvOS app bundles that are up to 4GB in size. See the announcement here: Now Accepting Larger tvOS Binaries

The size limit of a tvOS app bundle has increased from 200 MB to 4 GB, so you can include more media in your submission and provide a complete, rich user experience upon installation. Also, tvOS apps can use On-Demand Resources to host up to 20 GB of additional content on the App Store.


Prior to January 12, 2017 - It was limited to 200 MB. Apple's documentation has since been updated to reflect this change.

From the documentation:

Local Storage for Your App Is Limited

The maximum size for a tvOS app bundle 200 MB 4 GB. Moreover, your app can only access 500 KB of persistent storage that is local to the device (using the NSUserDefaults class). Outside of this limited local storage, all other data must be purgeable by the operating system when space is low. You have a few options for managing these resources:

  • Your app can store and retrieve user data in iCloud.

  • Your app can download the data it needs into its cache directory. Downloaded data is not deleted while the app is running. However, when space is low and your app is not running, this data may be deleted. Do not use the entire cache space as this can cause unpredictable results.

  • Your app can package read-only assets using on-demand resources. Then, at runtime, your app requests the resources it needs, and the operating system automatically downloads and manages those resources. Knowing how and when to load new assets while keeping your users engaged is critical to creating a successful app. For information on on-demand resources, see On-Demand Resources Guide.

This means that every app developed for the new Apple TV must be able to store data in iCloud and retrieve it in a way that provides a great customer experience.

If your bundle exceeds the 200 MB 4 GB limit, you will have to employ one of the options Apple describes above. The right way to proceed will depend on the architecture of your game and more specifically how this architecture can handle on-demand assets.

like image 1
Ryan H. Avatar answered Nov 16 '22 00:11

Ryan H.