The Half-Life Unified SDK includes a network data system that allows the server to transfer large amounts of immutable, generated data to connecting clients. Rather than hard-coding data on both sides, game systems can register themselves as block handlers and serialize their state into a shared JSON file. Clients download and deserialize that file when they connect, keeping both sides in sync without requiring separate distribution of static data files. The network data system uses the logger namedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/twhl-community/halflife-unified-sdk/llms.txt
Use this file to discover all available pages before exploring further.
net_data.
How It Works
When a map loads, each registered game system serializes its data into a file callednetworkdata/data.json. This file is then precached so that clients automatically download it when they connect to the server. Once downloaded, the client loads the file and uses it to initialize the corresponding client-side systems.
Before downloading a new copy, the client deletes its local version of the file to ensure it always receives the authoritative file from the server rather than using a stale cached copy.
Project information is embedded in the file and checked on the client side to verify that the client and server are running compatible builds. If they are not, the client automatically disconnects to prevent further problems.
Alpha builds disable the compatibility check to simplify development workflows.
NetworkDataProtocolVersion should be incremented whenever the structure of the data in the file changes. This allows the system to detect compatibility mismatches early.
File Size
The engine can transfer files up to the size specified by thesv_filetransfermaxsize cvar, which defaults to 10 MiB (10,485,760 bytes). For an unmodified Unified SDK installation, the average data.json file is approximately 100 KiB, with most of that space taken up by the sentences list.
Required CVars
To ensure correct operation the following cvars are forcibly enabled by the system:sv_allowdownloadsv_send_resourcessv_allow_dlfilecl_allowdownload
Known Limitations
Error Handling
- If an error occurs while generating the data on the server, the network data system shuts down and the error is printed to the console.
- If the client encounters an error while deserializing the downloaded file, the player is returned to the main menu and the error is printed to the console.
Using FastDL Servers
When using a FastDL (HTTP) file server, there is one additional consideration. Because the Unified SDK generatesnetworkdata/data.json fresh on every map load, the FastDL server cannot host the real file — it changes every time.
To prevent an error message from appearing in the client console, place a dummy file on your FastDL server at the same path (networkdata/data.json) containing only an empty JSON object:
Implementing a Block Handler
Game systems that need to transfer data across the network implement theINetworkDataBlockHandler interface and register themselves with the network data manager.
Registering a Handler
RegisterHandler becomes the key for this system’s data block inside data.json.
Serializing and Deserializing
The sameHandleNetworkDataBlock function is called on both the server (to serialize) and the client (to deserialize), distinguished by block.Mode:
block.ErrorMessage to a non-empty string aborts the serialization or deserialization process and triggers the system’s error handling behaviour.