s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationNetworkingCustom Snapshot Data
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Networking
Networking

Custom Snapshot Data

In some circumstances you may want to add additional data to the network snapshot that gets sent to clients when they join a server. One example of this might be serializing and deserializing voxel world data.

Components in the Scene can write and read their own data during the snapshot sending and receiving process by implementing Component.INetworkSnapshot.

To write snapshot data for a Component you can simply implement the WriteSnapshot method on a component.

  	private byte[] MyVoxelData { get; set; }
    
	void INetworkSnapshot.WriteSnapshot( ref ByteStream writer )
	{
		writer.WriteArray( MyVoxelData );
	}

Reading snapshot data can be done by implementing ReadSnapshot on a component. If you have expensive loading work to do with this data, override OnLoad and return a Task so the loading screen waits for it to finish before continuing.

	void INetworkSnapshot.ReadSnapshot( ref ByteStream reader )
	{
        MyVoxelData = reader.ReadArray<byte>();
	}
 
    protected override async Task OnLoad()
    {
        await LoadVoxelWorld( MyVoxelData );
    }

	private Task LoadVoxelWorld( byte[] data )
	{
		// ...
		return Task.CompletedTask;
	}

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2025-01-30. Read it rendered on the official docs.

More in Networking

Connection Permissions
Dedicated Servers
Http Requests
Network Events
Network Helper
Network Visibility
Networked Objects
Networking & Multiplayer
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.