Player Saves API

Store and sync player progress data across all devices with automatic conflict resolution

Overview

Player Save System Features

Store any JSON data for players with automatic synchronization across all devices

📦 Core Features

  • • Store any JSON data structure (game progress, settings, achievements)
  • • Automatic versioning with optimistic concurrency control
  • • Cross-platform device synchronization
  • • Offline support with automatic sync when online
  • • Built-in conflict resolution for concurrent saves

� Technical Limits

  • • Maximum 1MB per save file
  • • One save file per player
  • • JSON data only (no binary files)
  • • UTF-8 text encoding required
  • • Automatically compressed for transfer

Load Player Save Data

GET /v1/player/save

Retrieve the current player save data with version information

GET

HTTP Request Example

Response Format

Save Player Data

PUT /v1/player/save

Update player save data with automatic conflict resolution

PUT

HTTP Request Example

Successful Response

Conflict Resolution

Handling Concurrent Saves

What happens when multiple devices try to save simultaneously

Conflict Response (HTTP 409)

🔄 Automatic SDK Resolution

The StatPotion SDK automatically handles most conflicts by:

  • • Fetching the latest server version
  • • Merging non-conflicting changes
  • • Retrying the save operation
  • • Notifying your game of any issues

🎮 Manual Resolution Strategy

For complex data conflicts, implement custom logic:

  • • Show player a merge interface
  • • Prioritize local vs server data
  • • Implement last-write-wins policy
  • • Create conflict resolution UI

SDK Integration Examples

Save & Load with StatPotion SDKs

Simple integration examples for Unity, Godot, and JavaScript

Complete Save & Load Examples

Troubleshooting Common Issues

Problem: Save data not syncing between devices

Solution: Ensure players are using the same authentication method (device ID or account) on both devices.

// Verify same player ID on both devices
console.log("Player ID:", await StatPotion.getPlayerId());

Problem: "Data too large" error when saving

Solution: Save data exceeds 1MB limit. Optimize your data structure or split into multiple saves.

// Check save data size before saving
const dataSize = JSON.stringify(saveData).length;
if (dataSize > 1000000) console.warn("Save data too large:", dataSize);

Problem: Frequent conflict errors

Solution: Player is saving from multiple devices simultaneously. Implement proper conflict resolution or save less frequently.