Skip to main content

Data Management Overview

Build Information

Current documentation based on build version: 676042 Last updated: 2025-06-21

System Purpose

The Data Management category provides foundational infrastructure for all data operations in Don't Starve Together. This system handles the critical low-level services that enable secure asset distribution, reliable data persistence, efficient file operations, and cross-platform compatibility throughout the game's lifecycle.

Key Responsibilities

  • Asset loading and management with encryption support for secure content distribution
  • Save game persistence and migration across different game versions with cluster coordination
  • Data serialization and file operations with cross-platform compatibility
  • Utility services for platform adaptation and task scheduling
  • Legacy system support and migration pathways for backward compatibility

System Scope

This infrastructure category includes all data persistence, file operations, asset management, and utility services but excludes high-level game logic and user-facing data interfaces.

Architecture Overview

System Components

Data Management infrastructure is organized around three core pillars: secure asset distribution through encrypted loading systems, reliable persistence through versioned save management, and robust utility services for cross-platform operations.

Data Flow

External Assets → Secure Loading → Memory Management → Game Systems
↓ ↓ ↓ ↓
Encryption → Asset Processing → Runtime Caching → System Integration
↓ ↓ ↓ ↓
Game State → Save Operations → Data Serialization → Persistent Storage
↓ ↓ ↓ ↓
Utilities → Platform Adaptation → Task Scheduling → Infrastructure Services

Integration Points

  • System Core: Engine-level file I/O and memory management integration
  • Game Mechanics: Asset and save data consumption for gameplay features
  • User Interface: Asset loading for UI elements and save slot management
  • Networking: Multi-shard coordination and secure content distribution

Recent Changes

BuildDateComponentChange TypeDescription
6760422025-06-21AssetsstableCurrent asset management system
6760422025-06-21SavesstableCurrent save persistence infrastructure
6760422025-06-21UtilitiesstableCurrent utility services framework

Core Infrastructure Modules

Assets Management

Secure asset loading and distribution infrastructure for game content.

ModuleStatusDescriptionKey Features
JSON ProcessingstableData serialization systemGame encoding, compliant encoding, parsing
Encrypted ContentstableSecure file loading systemFestival content, cipher management
Klump RegistrystableAsset manifest systemAuto-generated file lists
Audio ManagementstableAudio configuration systemMix states, priority handling
Sound PreloadingstableAudio optimization systemBatch loading, DLC support

Technical Capabilities:

  • AES-encrypted asset protection with dynamic content loading
  • JSON serialization with game-specific and standards-compliant modes
  • Comprehensive audio management with FMOD integration
  • Automated asset registry generation during build process

Save Data Management

Comprehensive save data persistence and migration infrastructure.

ModuleStatusDescriptionKey Features
Save IndexstableLegacy save slot managementSession tracking, mod configuration
Shard Save IndexstableMulti-shard coordinationCluster management, cache optimization
Save File UpgradesstableVersion migration systemSequential upgrades, retrofitting
Scrapbook PartitionsstableDiscovery tracking systemProgress monitoring, backend sync

Technical Capabilities:

  • Version-aware data migration with sequential upgrade application
  • Multi-shard cluster coordination with Master/Caves support
  • Efficient discovery tracking with bit-field encoding
  • Backward compatibility preservation across game updates

Utility Services

Infrastructure utilities for platform adaptation and task management.

ModuleStatusDescriptionKey Features
Platform Post LoadstablePlatform configuration systemWIN32_RAIL support, command localization
SchedulerstableTask scheduling frameworkCoroutine management, delayed execution
Legacy RedirectionsstableMigration guidance systemHistorical references, system evolution

Technical Capabilities:

  • Cross-platform adaptation with regional compliance support
  • Coroutine-based task scheduling with thread management
  • Legacy system redirection for smooth migration paths
  • Performance-optimized utility functions for frequent operations

Common Infrastructure Patterns

Secure Asset Loading

-- Encrypted content management
local cipher = Profile:GetKlumpCipher("images/festival_asset.tex")
if cipher then
LoadKlumpFile("images/festival_asset.tex", cipher, false)
end

-- Audio preloading with DLC support
if IsDLCInstalled(REIGN_OF_GIANTS) then
PreloadSoundList(DLCSounds)
end
PreloadSoundList(MainSounds)

Data Persistence Operations

-- Save slot management with cluster support
local shardIndex = ShardSaveIndex()
shardIndex:Load(function(success)
if success then
local masterShard = shardIndex:GetShardIndex(1, "Master")
local cavesShard = shardIndex:GetShardIndex(1, "Caves", true)

-- Apply save file upgrades automatically
local currentVersion = savedata.version or 1
if currentVersion < savefileupgrades.VERSION then
-- Sequential upgrades applied during load
end
end
end)

Platform Adaptation

-- Platform-specific configuration
if PLATFORM == "WIN32_RAIL" then
-- Enhanced vote protection for Chinese market
local kick_command = UserCommands.GetCommandFromName("kick")
kick_command.voteresultfn = YesNoTwoThirdsVote

-- Localized command injection
RailUserCommandInject("help", "帮助", {"指令"})
RailUserCommandInject("kick", "踢出", {"用户"})
end

Task Scheduling

-- Asynchronous task management
local task = StartThread(function()
-- Background processing
Sleep(5)
ProcessDataUpdate()
end, "data_processor")

-- Scheduled operations
scheduler:ExecuteInTime(60.0, function()
CleanupTemporaryData()
end, "cleanup_task")

Infrastructure Dependencies

Required Systems

  • System Core: Engine integration for file I/O and memory management
  • Fundamentals: Core class system and basic utilities

Optional Systems

Performance Considerations

System Performance

  • Asset loading uses encrypted file caching with cipher key optimization for reduced overhead
  • Save operations employ asynchronous I/O with callback-based completion to maintain responsiveness
  • Data serialization optimizes string building and memory allocation patterns for large structures
  • Platform utilities apply configurations once during initialization with minimal runtime impact

Resource Usage

  • Memory management through lazy loading strategies and efficient caching mechanisms
  • File operations batch related operations to minimize I/O overhead and system calls
  • Audio systems preload strategically based on DLC availability and world configuration
  • Task scheduling uses coroutine yields to prevent main thread blocking

Scaling Characteristics

  • Asset system scales with content volume through hash-based partitioning and build-time optimization
  • Save infrastructure supports unlimited slots with efficient multi-shard coordination algorithms
  • Utility services adapt automatically to platform capabilities without performance degradation
  • Data migration handles arbitrarily complex upgrade sequences with minimal resource consumption

Development Guidelines

Best Practices

  • Always use asynchronous operations for file I/O to maintain game performance and responsiveness
  • Implement comprehensive error handling for all data operations including corruption recovery
  • Follow encryption protocols for secure content distribution and cipher key management
  • Use platform detection for conditional feature application and regional compliance
  • Leverage task scheduling for all time-based operations to prevent blocking behaviors

Common Pitfalls

  • Performing synchronous file operations that block the main thread during gameplay
  • Bypassing encryption validation for development convenience compromising security
  • Not implementing proper save data migration causing compatibility issues across versions
  • Ignoring platform-specific requirements leading to regional compliance failures
  • Creating memory leaks in scheduled tasks without proper cleanup procedures

Testing Strategies

  • Test asset loading with valid and invalid encryption keys across all content types
  • Verify save/load cycles with various world configurations and mod combinations
  • Validate platform adaptations on all target platforms with regional feature requirements
  • Test migration system with saves from multiple previous game versions and edge cases
  • Validate task scheduling under high load conditions and concurrent operation scenarios
SystemRelationshipIntegration Points
System CoreEngine FoundationLow-level file I/O, memory management, platform services
Game MechanicsData ConsumerAchievement data, recipe information, progression tracking
User InterfacePresentation LayerSave slot selection, asset loading for UI elements
Networking CommunicationCluster SupportMulti-shard communication, session coordination
Character SystemsData ProviderCharacter customization, progression data persistence

Troubleshooting

Common Infrastructure Issues

IssueSymptomsSolution
Encrypted assets not loadingMissing festival content, cipher errorsVerify cipher availability and event activation status
Save corruptionLoad failures, missing progress dataCheck file permissions, validate data integrity, apply migration
Platform features not workingMissing localization, incorrect behaviorVerify PLATFORM constant and configuration application
Task scheduling failuresOperations not executing, timing issuesCheck scheduler initialization and coroutine syntax
Memory leaks in utilitiesPerformance degradation over timeAudit scheduled task cleanup and cache management

Debugging Infrastructure

  • Enable asset loading debug output to trace encryption and file access operations
  • Monitor save system operations with debug commands to inspect slot states and session data
  • Check platform detection and configuration application using global constants
  • Validate task scheduler state and execution with built-in inspection tools
  • Use memory profiling tools to identify leaks in data management operations

Security and Integrity

Data Protection

  • Encrypted asset system uses AES encryption with server-distributed cipher keys for content protection
  • Save data integrity checking with corruption detection and recovery mechanisms
  • Platform-specific security enhancements including vote protection and access control
  • Secure file system access limited to designated game directories with permission validation

Backup and Recovery

  • Automatic backup creation before major migration operations with rollback capabilities
  • Multi-level save redundancy through cluster coordination and shard synchronization
  • Discovery data backup and restore for user profile protection against data loss
  • Error recovery procedures for corrupted files with data reconstruction algorithms

Performance Monitoring

Key Metrics

  • Asset loading time including encryption/decryption overhead and cache hit ratios
  • Save operation completion time under various data sizes and cluster configurations
  • Platform configuration application time and feature activation success rates
  • Task scheduler throughput and queue management efficiency under concurrent load

Optimization Strategies

  • Implement incremental save operations for large world states to reduce I/O overhead
  • Use streaming asset loading for large files when memory constraints require optimization
  • Batch related data operations to minimize file system access and improve throughput
  • Optimize platform detection logic to avoid repeated checks during runtime operations

Future Development

Extensibility Design

  • Asset system supports additional encryption methods and content distribution mechanisms
  • Save infrastructure accommodates new data types and migration patterns for system evolution
  • Platform utilities framework enables easy addition of new platform configurations
  • Task scheduling architecture adapts to new execution patterns and resource management needs

Integration Planning

  • New data types should leverage existing encryption and persistence infrastructure for consistency
  • Content distribution systems should integrate with established security and loading frameworks
  • Platform support should follow established configuration and adaptation patterns
  • Performance optimizations should maintain backward compatibility with existing data formats

Technical Architecture

Data Flow Architecture

User Request → System Detection → Operation Routing → Infrastructure Services
↓ ↓ ↓ ↓
Platform Config → Asset Loading → Data Processing → Result Delivery
↓ ↓ ↓ ↓
Task Scheduling → Save Operations → Migration Checks → Persistence Layer
↓ ↓ ↓ ↓
Error Handling → Cleanup Operations → Status Updates → System Response

Component Interaction

  • Asset Layer: Handles content loading with encryption and audio management
  • Persistence Layer: Manages save operations with versioning and cluster support
  • Utility Layer: Provides platform adaptation and task scheduling services
  • Integration Layer: Coordinates between data management and other core systems

This infrastructure forms the foundation for all data operations in Don't Starve Together, ensuring reliable, secure, and efficient data management across all game systems and platforms.