Before You Begin
The Player Data Storage Sample uses Epic Account Services to authenticate the local user for demonstration purposes. This requires that the Client Credentials used to initialize the Epic Online Services (EOS) SDK have been assigned to an Application used for Epic Account Services.
The SDK functionality demonstrated in this sample works with any of the supported identity providers for user authentication.
Exploring the Sample
The Player Data Storage Sample is a simple file explorer for the cloud storage associated with your user account. You can log in or out with your account. While logged in, you can browse through the files associated with your account, and upload, download, duplicate, or delete those files.
The Player Data Panel
To get started with the Player Data Storage Sample, locate the Player Data panel on the right side of the user interface and log in by entering your Host Address and User Credentials (from the Developer Authentication Tool) and pressing the Log In button.
After logging in, the Player Data panel will display the list of files associated with your user account, if any exist. The Log In button will change to Log Out, and the buttons at the top of the panel will become active. The following features are available:
- Save: Uploads the contents of the file you are currently editing to the cloud. If you close the program with unsaved changes, they will be lost.
- Download: Downloads the selected file to the local cache and opens it in the text editor. This operation will discard any unsaved changes.
- Duplicate: Copies the selected file. The copy will appear in the file list under the same name as the original file, with "_Copy" added to the end.
- Delete: Deletes the selected file from the cloud.
- Refresh: Refreshes the file list, but does not download any files.
The Console Panel
Log output from the program's operation, including the results of console commands, will appear in the text area at the top of the Console panel, which appears on the lower-left side of the user interface. In addition to clicking the buttons in the Player Data panel, you can type in console commands at the bottom of the Console panel.
The following commands are supported:
|Creates and uploads an empty file with the name |
|Downloads the specified file from the cloud|
|Makes a copy of |
|(none)||Prints help information about all the above commands to the console output.|
You can add your own console commands in the
Game::CreateConsoleCommands function in
The File Panel
The File panel displays the contents of the currently-selected file (in the Player Data panel). You can edit file contents in this window before saving and uploading the file in the Player Data panel or the Console panel.
The Progress Bar Window
The file transfer operations that the Player Data Storage Sample performs are asynchronous. While performing these operations, the sample shows a the Progress Bar window, a popup with a progress bar, and a Cancel button. Users can interrupt the transfer by clicking Cancel. The sample only runs one file transfer operation at a time, although the Player Data Storage Interface can suport multiple transfer operations at once.
Exploring the Source Code
Most of the code that interacts with data files is in
Samples/PlayerDataStorage/Source/PlayerDataStorage.cpp. The following functions interact with the Player Data Storage Interface directly:
|Refreshes the list of player data entries.|
|Retrieves the contents of a specific file.|
|Transmits the contents of a specific file to the cloud.|
|Uploads a new file, or overwrites an existing one.|
|Makes a copy of a file.|
|Deletes a file and clears out local cache data related to it.|
|Cancels the current file transfer (if any).|
These functions do not use the Player Data Storage Interface directly, but do interact with related data on the local system. They can be helpful as basic guides when building your own systems to manage locally-cached information about files:
|Returns the local file list.|
|Sets the local file list.|
|Returns locally cached data for the file specified. The |
|Sets local data for the specified file.|
|Erases local data for the specified file (if it exists).|