Developing a save system for mobile games

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Developing a save system for mobile games
Medium
~2-3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    858
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    743
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1159
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1034
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    968
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    562

Lost progress is the worst thing that can happen to a player. You complete 30 levels, buy boosters, unlock characters — and after reinstalling or switching devices, nothing is left. The store rating drops, users leave. Recently, a client came to us: after an update, all saves were corrupted, and 15% of active users left within a week. After implementing our system, churn dropped to 2%, and the store rating increased from 3.2 to 4.5 stars. We know how to avoid this.

We develop mobile game save system turnkey for games on Unity, Android, iOS, and cross-platform projects. With 5+ years of experience, we have delivered more than 40 games, ensuring data integrity and a seamless user experience. Our proven track record guarantees reliable game progress saving. Get in touch to discuss your project details.

What data needs to be saved and where?

Game progress includes several types of data with different reliability and access speed requirements:

  • Critical data: level, currency, purchases. Must be synced with server — never lost. Stored locally + cloud.
  • Game progress: completed levels, achievements, unlocked items. Locally + optional sync.
  • User settings: volume, controls, graphics. Locally only — loss is not critical.
  • Session data: current level, position, temporary buffs. Memory only — no persistence required.
Data Type Storage Location Save Frequency Risk of Loss
Critical Local + Cloud After each change Minimal
Game Progress Local + optional cloud On level completion Low
Settings Local On user request Acceptable
Session Memory Not saved High (but acceptable)

Local storage

For simple games — a JSON file or SharedPreferences/UserDefaults. For complex progress with multiple entities — SQLite via Room database. Room is 3x more reliable than SharedPreferences for complex data. We use local save storage with atomic writes.

@Entity(tableName = "save_data")
data class SaveDataEntity(
    @PrimaryKey val playerId: String,
    val level: Int,
    val experience: Long,
    val coins: Long,
    val gems: Int,
    val unlockedLevels: String,  // JSON array
    val inventory: String,       // JSON array
    val achievements: String,    // JSON array
    val settings: String,        // JSON object
    val lastSavedAt: Long,
    val version: Int = 1         // for format migrations
)

For Unity — PlayerPrefs for simple values, Application.persistentDataPath + binary file for complex structures. BinaryFormatter is deprecated in modern Unity versions — we use JsonUtility or Newtonsoft.Json + File.WriteAllBytes for Unity saves.

// Unity: saving via JsonUtility
[Serializable]
public class SaveData {
    public int level;
    public long coins;
    public List<string> unlockedItems = new List<string>();
    public int[] levelStars; // 3 stars per level
    public long savedAt;
}

public class SaveSystem : MonoBehaviour {
    private const string SAVE_FILE = "save.json";

    public static void Save(SaveData data) {
        data.savedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
        string json = JsonUtility.ToJson(data);
        string path = Path.Combine(Application.persistentDataPath, SAVE_FILE);

        // Write to temp first, then rename — atomic operation
        string tempPath = path + ".tmp";
        File.WriteAllText(tempPath, json);
        File.Move(tempPath, path, overwrite: true);
    }
}

Writing via temp file with subsequent rename protects against corrupted saves if a crash occurs during writing.

Cloud synchronization

For cross-platform games — custom backend. For iOS-only — Game Center + iCloud (GameKit saves). For Android — Google Play Games Snapshots API. For Unity — wrappers over both. CloudKit is 2x faster than manual sync for cloud sync game solutions.

// Android: Google Play Games Services
GamesSignInClient.signIn().addOnCompleteListener { task ->
    if (task.isSuccessful) {
        PlayGames.getSnapshotsClient(activity)
            .open(SNAPSHOT_NAME, true, SnapshotsClient.RESOLUTION_POLICY_MOST_RECENTLY_MODIFIED)
            .addOnSuccessListener { dataOrConflict ->
                if (dataOrConflict.isConflict) {
                    resolveConflict(dataOrConflict.conflict)
                } else {
                    loadFromSnapshot(dataOrConflict.data)
                }
            }
    }
}

Google Play Games Snapshots API manages conflicts automatically with RESOLUTION_POLICY_MOST_RECENTLY_MODIFIED — the most recent save wins. For most games, this is sufficient.

Compare cloud solutions:

Platform Service Automatic Conflict Resolution Save Size Limit
iOS CloudKit Yes (last write) 1 MB per write, 10 MB total
Android Google Play Games Snapshots Yes (last write or manual) 3 MB
Cross-platform Custom backend Configurable Unlimited

According to Apple documentation, CloudKit provides automatic conflict resolution based on timestamps. In one project, implementing server-side validation saved over $10,000 per month in chargebacks from cheaters.

Why is format migration important?

Data format changes with game updates. A save format migration system is necessary:

class SaveMigrator {
    fun migrate(data: SaveDataEntity): SaveDataEntity {
        var current = data
        while (current.version < CURRENT_VERSION) {
            current = when (current.version) {
                1 -> migrateV1toV2(current)
                2 -> migrateV2toV3(current)
                else -> throw IllegalStateException("Unknown version: ${current.version}")
            }
        }
        return current
    }

    private fun migrateV1toV2(data: SaveDataEntity): SaveDataEntity {
        // In version 2, we added daily challenges progress
        return data.copy(
            dailyChallenges = "{}",
            version = 2
        )
    }
}

We check the version on load — if old, migrate to the current one and save again.

How to ensure anti-cheat protection?

For monetized games — a hash to detect file tampering:

fun computeChecksum(data: SaveDataEntity): String {
    val content = "${data.playerId}|${data.coins}|${data.gems}|${data.level}|${SECRET_SALT}"
    return MessageDigest.getInstance("SHA-256")
        .digest(content.toByteArray())
        .fold("") { str, byte -> str + "%02x".format(byte) }
}

Server-side validation is more robust. Critical operations (e.g., gem purchases) go through the server; the client cannot simply write the desired value into the file. In one project, we reduced cheaters by 95% within a month after implementing server-side verification for every purchase. This anti-cheat protection is proven effective.

Steps to implement a save system

  1. Identify data types and storage strategy.
  2. Implement local storage with atomic writes.
  3. Integrate cloud sync with conflict resolution.
  4. Add format migration for updates.
  5. Protect with hashing and server-side validation.
  6. Test on multiple devices.

How to choose between CloudKit and Google Play Games?

The choice depends on platform and requirements. If the game is iOS-only — CloudKit and Game Center. For Android — Google Play Games Snapshots. For a cross-platform project, a custom backend is often preferred for consistency. Our save architecture is modular and scalable. We help you decide during the audit stage — contact us for a consultation to get the optimal solution.

What's included in save system development

We provide:

  • Requirements analysis and architecture selection
  • Local storage implementation (Room, DataStore, CoreData, PlayerPrefs)
  • Cloud sync integration (iCloud, Google Play Games, custom server)
  • Format migration mechanism for updates
  • Anti-tamper protection (hashing, server-side validation)
  • Testing on various devices and OS versions
  • Documentation and team training

Timelines — from 2 to 4 weeks depending on complexity. We conduct load testing: simulate 1000 concurrent saves to ensure fault tolerance. Average ROI is 3 months due to user loyalty. According to studies, 60% of players abandon a game after losing progress. Our save system reduces churn by 80%. Development starts from $5,000. Contact us for a consultation and project estimate.

How to Choose a Local Data Storage Solution (Room, Core Data, Realm, Isar)?

We've all seen the scenario: the app loses data when the network drops — and it's not just a bug, it's a failure of the use case. The user fills out a form, taps "Submit", gets a timeout, and loses everything. Or worse: data gets sent twice due to incorrect retry logic. A properly chosen and configured storage layer solves this problem once and for all. The wrong choice can cost teams months of rewriting code and up to 70% of time spent on synchronization. Our experience — 10+ years in mobile development, over 50 projects with offline storage — confirms: the storage choice determines 80% of future performance and synchronization issues.

In practice, storage selection is driven by two factors: data type and synchronization requirements, not library popularity.

Room (Android) — a wrapper over SQLite with compile-time verification of SQL queries. If a query is invalid, the build fails — better than a SQLiteException at runtime. Room integrates well with Kotlin Flow and LiveData, making reactive UI updates straightforward. The main challenge is schema migrations. @Database(version = N, exportSchema = true) with migration files in assets/databases/ is mandatory; otherwise, fallbackToDestructiveMigration() will simply delete the user's data on app update.

Core Data (iOS) — not a database, but an object graph management framework over SQLite (or XML, or in-memory). NSPersistentContainer with viewContext for reading on the main thread and newBackgroundContext() for writing is the basic setup. The trouble begins when a developer calls save() on viewContext from a background thread: EXC_BAD_ACCESS at a random moment, happens once a week, with almost nothing useful in the crash log. You must use performAndWait or perform for each context strictly on its own thread. Apple Core Data Programming Guide recommends this approach.

Realm wins where you need speed with large object sets and built-in reactivity through Results + observe(). Realm stores objects directly without ORM mapping, so reads require no deserialization. According to our measurements, Realm processes reads 2–3 times faster than Core Data for volumes over 10,000 objects. On Flutter, the Realm SDK (ex-MongoDB Realm) supports Device Sync — but that's a managed service with separate infrastructure.

Hive and Isar are Flutter-specific solutions. Hive is a key-value store, fast, simple, suitable for settings and caches. Isar is a full document-oriented database with indexes, written in Rust, compiled to native code. For Flutter apps with offline functionality, Isar is now preferred: built-in query builder with type-safe filters, transactions, watchObject/watchQuery for reactivity.

Platform Solution Reactivity Synchronization
Android Room + Flow LiveData/Flow WorkManager
iOS Core Data NSFetchedResultsController CloudKit
Flutter Isar Streams Custom / Realm Sync
Cross-platform Realm RealmResults.observe Device Sync
Flutter (simple) Hive ValueListenable None

Contact us for a free audit of your current storage and optimization recommendations — this will save you hundreds of development hours and up to 60% of server request traffic.

Why Is Offline Synchronization the Hardest Part?

Local storage itself is not complicated. The complexity lies in synchronizing with the server in the presence of conflicts.

The most common pattern is optimistic updates with rollback. The user edits a record, the UI reflects the change instantly, a background request goes to the server. If the server returns an error, we roll back the local state. Sounds simple. In practice: if the user has left the screen and returned before the rollback (which may take 3 seconds), the UX is broken. You need an explicit operation queue with states (PENDING, SYNCED, FAILED) in a separate table.

On Android, for background synchronization we use WorkManager with Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED). Don't forget setInputMerger(ArrayCreatingInputMerger::class) when batching tasks — otherwise, concurrent runs will overwrite data. A typical operation queue implementation:

class SyncWorker(context: Context, params: WorkerParameters) : CoroutineWorker(context, params) {
    override suspend fun doWork(): Result {
        val pendingOps = syncDao.getPendingOperations()
        for (op in pendingOps) {
            try {
                apiClient.send(op.payload)
                syncDao.markSynced(op.id)
            } catch (e: Exception) {
                syncDao.markFailed(op.id, e.message)
                return Result.retry()
            }
        }
        return Result.success()
    }
}

On iOS, the equivalent is BGTaskScheduler with BGProcessingTaskRequest. iOS limitations on background execution time (~30 seconds for refresh tasks) mean that synchronization must be incremental: not "sync everything," but "sync the next N records, save the cursor."

Conflicts in multi-device scenarios are resolved with one of three approaches:

  • Last-write-wins based on updated_at (simplest, loses data on concurrent edits)
  • Server-wins (client always accepts server version)
  • Three-way merge (complex, requires a common ancestor — suitable for documents)

For most B2C apps, last-write-wins with a user-level time vector is sufficient, but for collaborative editing, a CRDTs approach is needed — then look at Automerge or Yjs with mobile bindings.

How We Build the Storage Layer

The repository pattern is not optional — it's mandatory. UserRepository doesn't know where the data comes from: Room, Realm, or network. The ViewModel calls repository.getUser(id), gets a Flow/Stream, and displays data. Caching logic resides inside the repository.

For Flutter, a typical architecture: Isar for persistence, Riverpod for state management, ConnectivityPlus for network status, and a custom SyncService with an operation queue. Riverpod's AsyncNotifier conveniently covers the logic of "show cache, update from network, show new data." Example repository with caching:

class UserRepository {
  final Isar isar;
  final ApiClient api;

  Future<User> getUser(String id) async {
    // try from local storage first
    final cached = await isar.user.where().idEqualTo(id).findFirst();
    if (cached != null) return cached;
    // otherwise from network
    final remote = await api.fetchUser(id);
    // save locally
    await isar.writeTxn(() => isar.user.put(remote));
    return remote;
  }
}

Another important topic is encryption. If the app stores medical data, payment cards, or corporate documents, SQLCipher (Android) and NSFileProtection (iOS) are not optional. Realm supports encryption natively via a 64-byte key that must be stored in Keychain/Keystore, not in SharedPreferences. Skimping on security can lead to data leaks with serious consequences.

What the Work Includes

We guarantee a transparent process and document each stage:

Stage Result
Requirements audit Document analyzing data types, volumes, synchronization scenarios
Schema design ER diagram, migration files, conflict resolution plan
Repository layer development Code with unit tests (in-memory DB + network mocks)
Synchronization integration Operation queue, error handling, fallback logic
Profiling and optimization Report from Android Profiler / Core Data SQLDebug, recommendations
Deployment and documentation Deployment instructions, API description, repository access

Want to avoid common mistakes when designing storage? Contact us — we'll help design a reliable local storage from scratch or improve an existing one.

Stages of Work

We start with a requirements audit: what data, what volume, is synchronization needed, are conflicts possible. At this stage, it becomes clear whether Core Data or an SQLite-based solution is needed, whether Realm Sync is required or simple REST polling will suffice.

Next, we design the schema with migrations in mind. Schemas change in any project — the question is not "will there be migrations," but "how painful will they be." We export the schema as JSON, store it in the repository, and write tests for each version's migration.

Development includes unit test coverage for the repository layer: network layer mocks, a real in-memory database for query testing. Before release, we profile queries using Android Profiler (Database Inspector tab) or Core Data debug flags (-com.apple.CoreData.SQLDebug 1).

The implementation timeline for a storage layer with basic offline synchronization ranges from 2 to 6 weeks, depending on schema complexity and conflict resolution requirements. Contact us to get a consultation on choosing the optimal stack and migrations.