Skip to main content

Multiplayer Overview

Build Information

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

System Purpose

The Multiplayer category provides specialized systems for managing the multiplayer gameplay experience in Don't Starve Together. These systems handle server content delivery, UI popup management with network synchronization, and client-side preference management to create a seamless multiplayer environment.

Key Responsibilities

  • Deliver and manage server announcements and game content
  • Synchronize UI popups and screen states across clients
  • Manage client-side server preferences and filtering
  • Provide RPC communication for multiplayer interactions
  • Handle content caching and offline functionality

System Scope

This category includes multiplayer-specific functionality for content delivery, UI synchronization, and preference management but excludes core networking protocols (handled by Networking) and basic chat systems (handled by Chat Commands).

Architecture Overview

System Components

Multiplayer systems are designed as client-server synchronized components that manage various aspects of the multiplayer experience from content delivery to UI state management.

Data Flow

Server Content → MOTD Manager → Content Cache → UI Display
Client Interaction → Popup Manager → RPC Communication → Server Sync
User Preferences → Server Preferences → Local Storage → Filter Application

Integration Points

  • Networking: RPC communication and client-server synchronization
  • User Interface: Screen management and popup display
  • Data Management: Content caching and preference persistence
  • System Core: Platform integration and engine services

Recent Changes

BuildDateComponentChange TypeDescription
6760422025-06-21MOTD ManagerstableContent delivery system
6760422025-06-21Popup ManagerstableUI popup synchronization
6760422025-06-21Server PreferencesstableClient preference management

Core Multiplayer Modules

MOTD Manager

Message of the Day system for downloading and displaying game announcements.

ModuleStatusDescriptionKey Features
Content DownloadstableServer content retrievalAutomatic updates, retry logic, caching
Content OrganizationstableCategory-based content sortingPatch notes, skins, news, Twitch integration
Image ManagementstableContent image cachingProgressive loading, slot management
Platform IntegrationstableSteam/Rail platform supportPlatform-specific delivery

System for managing game UI popups with RPC communication.

ModuleStatusDescriptionKey Features
Popup RegistrationstablePopup type managementBuilt-in and mod popup support
RPC CommunicationstableClient-server popup syncMessage validation, state synchronization
Screen ManagementstableUI screen lifecycleOpen/close handling, HUD integration
Validation SystemstableInput parameter validationType checking, security validation

Server Preferences

Client-side management for server display preferences and filtering.

ModuleStatusDescriptionKey Features
Preference StoragestablePersistent client settingsLocal storage, data expiration
Profanity FilteringstableContent filtering systemAutomatic detection, manual overrides
Server FilteringstableServer visibility controlUser-controlled hiding, preference toggle
Data ManagementstablePreference synchronizationLoad/save operations, data validation

Common Multiplayer Patterns

MOTD Content Access

-- Check if MOTD system is available
if TheMotdManager:IsEnabled() then
-- Get current content
local motd_info, sorted_keys = TheMotdManager:GetMotd()

-- Process content by category
for i, key in ipairs(sorted_keys) do
local content = motd_info[key]
if content.data.category == "patchnotes" then
print("Patch notes:", content.data.title)
end
end

-- Check for updates
if TheMotdManager:IsNewUpdateAvailable() then
print("New game version available!")
end
end
-- Register popup with RPC validation
local popup = PopupManagerWidget({
rpcvalidation = function(param1, param2)
return optstring(param1) and optbool(param2)
end
})

-- Open popup with synchronization
POPUPS.COOKBOOK.fn(ThePlayer, true)

-- Send data between client and server
popup:SendMessageToServer(ThePlayer, "recipe_data", true)

Server Preference Management

-- Initialize server preferences
local prefs = ServerPreferences()

-- Load existing preferences
prefs:Load(function(success)
if success then
print("Preferences loaded successfully")
end
end)

-- Check server visibility
local server_data = {name = "Test Server", description = "Description"}
if not prefs:IsNameAndDescriptionHidden(server_data) then
-- Display server in browser
DisplayServerInList(server_data)
end

-- Toggle server visibility
prefs:ToggleNameAndDescriptionFilter(server_data)
prefs:Save()

Multiplayer System Dependencies

Required Systems

Optional Systems

Performance Considerations

Content Delivery Optimization

  • MOTD content uses progressive image loading with slot management (10 max image slots)
  • Automatic retry logic with exponential backoff for failed downloads
  • Content caching reduces redundant network requests
  • Category-based content organization optimizes display performance

Network Efficiency

  • RPC communication uses validated message formats to prevent invalid data
  • Popup state synchronization minimizes bandwidth usage
  • Server preference updates batch changes to reduce network overhead
  • Content compression reduces download sizes

Memory Management

  • Automatic cleanup of expired preference data based on USER_HISTORY_EXPIRY_TIME
  • Image cache management prevents unlimited memory growth
  • Popup lifecycle management prevents memory leaks
  • Efficient JSON parsing and storage for persistent data

Development Guidelines

Best Practices

  • Always validate RPC parameters using appropriate validation functions
  • Implement proper error handling for network operations
  • Use the popup manager for all synchronized UI screens
  • Follow established patterns for content delivery and caching
  • Test multiplayer functionality with various network conditions

Common Pitfalls

  • Not validating RPC parameters can cause network synchronization issues
  • Bypassing popup manager for UI screens breaks client-server synchronization
  • Not handling network failures gracefully can impact user experience
  • Ignoring preference persistence can lose user customizations
  • Not considering platform differences for content delivery

Testing Strategies

  • Test content delivery with various network speeds and interruptions
  • Verify popup synchronization across multiple clients
  • Test preference persistence across game sessions
  • Validate RPC communication with malformed data
  • Check platform-specific functionality on target platforms

Multiplayer Integration Patterns

With User Interface

Multiplayer systems drive UI presentations:

  • MOTD content populates main menu announcement sections
  • Popup manager synchronizes screen states across all clients
  • Server preferences filter server browser display
  • Content categorization drives UI organization and priority

With Networking

Systems integrate with network infrastructure:

  • RPC communication for popup state synchronization
  • Content download using platform-specific network services
  • Preference synchronization using local and remote storage
  • Error handling for network interruptions and failures

With Data Management

Content and preference persistence:

  • MOTD content caching for offline availability
  • Server preference storage using persistent data systems
  • Image cache management with automatic cleanup
  • JSON encoding/decoding for structured data storage

Content Management

MOTD Content Categories

The system organizes content with specific priorities:

CategoryPriorityDescriptionExample Content
patchnotes1Game updates and changesVersion updates, bug fixes
skins2Cosmetic content releasesNew character skins, item skins
twitch3Streaming integrationTwitch drops, stream features
news4General announcementsCommunity events, developer updates
none100Uncategorized contentMiscellaneous announcements

Available popup types with RPC support:

PopupPurposeRPC ValidationKey Features
GIFTITEMInventory managementoptbool(usewardrobe)Item gifting interface
WARDROBECharacter customizationSkin parameter validationClothing/appearance editor
GROOMERBeefalo customizationBeefalo skin validationMount customization
COOKBOOKRecipe viewingBasic validationRecipe browser
SCRAPBOOKCollection trackingBasic validationAchievement/collection viewer

Security and Validation

RPC Security

  • All RPC parameters validated using type-safe validation functions
  • Input sanitization prevents malformed data transmission
  • Parameter count and type verification before processing
  • Error handling for invalid or unexpected data

Content Filtering

  • Server preference system includes profanity filtering
  • User-controlled server visibility settings
  • Automatic content categorization and priority management
  • Safe handling of user-generated server names and descriptions

Data Integrity

  • JSON validation for preference data persistence
  • Hash-based server identification for preference consistency
  • Automatic data expiration prevents stale preference accumulation
  • Error recovery for corrupted preference data

Troubleshooting Multiplayer Issues

Common MOTD Problems

IssueSymptomsSolution
Content not loadingEmpty announcement sectionCheck network connectivity and retry
Images not displayingText without imagesVerify image cache and download status
Outdated contentStale announcementsForce refresh or clear cache
Platform integration failureNo content on specific platformsCheck platform-specific settings

Common Popup Problems

IssueSymptomsSolution
Popup not synchronizingDifferent states on clientsCheck RPC communication and validation
Screen not openingNo response to popup commandsVerify HUD integration and screen availability
Data not transmittingMissing popup parametersValidate RPC parameter formatting
Multiple instancesDuplicate popupsEnsure proper popup lifecycle management

Common Preference Problems

IssueSymptomsSolution
Preferences not savingLost settings between sessionsCheck persistent storage permissions
Filter not workingUnwanted servers still visibleVerify preference loading and application
Data corruptionUnexpected preference behaviorReset preferences and reload
Profanity filter issuesIncorrect content filteringUpdate filter patterns and clear cache

Extension and Customization

Adding Custom Popups

-- Register mod popup with validation
local mod_popup = PopupManagerWidget({
rpcvalidation = function(custom_param)
return optstring(custom_param)
end
})

-- Add to mod popup system
MOD_POPUPS["MY_CUSTOM_POPUP"] = mod_popup

Custom Content Integration

  • MOTD system supports category extension for mod content
  • Popup manager accommodates unlimited custom popup types
  • Server preferences can be extended with additional filtering criteria
  • Platform integration supports custom content delivery endpoints

Preference System Extension

-- Add custom server filtering criteria
local custom_prefs = ServerPreferences()
custom_prefs.custom_filters = {}

-- Implement custom filtering logic
function custom_prefs:IsCustomFiltered(server_data)
return self.custom_filters[server_data.name] == true
end

Future Development Considerations

Scalability Design

  • MOTD system supports unlimited content categories and types
  • Popup manager handles arbitrary popup types with consistent RPC patterns
  • Server preferences scale to large server lists with efficient filtering
  • Content delivery adapts to various platform requirements and constraints

Integration Planning

  • New multiplayer features should leverage existing RPC communication patterns
  • Content delivery should follow established caching and update mechanisms
  • UI synchronization should use popup manager for consistency
  • Preference systems should integrate with established persistence patterns
SystemRelationshipIntegration Points
NetworkingCommunication layerRPC calls, content download, state sync
Chat CommandsCommunication featuresCommand integration, message handling
User InterfaceDisplay layerScreen management, popup rendering
Data ManagementStorage layerContent caching, preference persistence

Contributing Guidelines

Adding Multiplayer Features

  1. Use established RPC patterns for client-server communication
  2. Implement proper validation for all network-transmitted data
  3. Follow popup manager patterns for UI synchronization
  4. Consider offline functionality for content delivery features
  5. Test thoroughly in multiplayer environments with network variations

Content System Modifications

  1. Maintain backward compatibility with existing content formats
  2. Follow established category and priority systems for new content types
  3. Consider platform differences for content delivery mechanisms
  4. Test content caching and offline availability
  5. Document any new content categories or delivery patterns

Quality Standards

  • All RPC communication must include proper validation
  • Content delivery must handle network failures gracefully
  • UI synchronization must maintain consistency across all clients
  • Preference changes must persist correctly across sessions
  • Integration points must be documented and validated