SyncLib

v1.1.0·Updated 2026-05-23

REPO online synchronization of universal libraries. Encapsulates RPC, RaiseEvent, room attributes, snapshot reissue and dynamic configuration synchronization, providing an out-of-the-box network layer for module development.

About this mod Machine translation

SyncLib - Online synchronization library

Provides out-of-the-box network synchronization capabilities for REPO module development. Encapsulates Photon RPC, RaiseEvent, room attribute synchronization, snapshot reissue and dynamic configuration synchronization.

Version: 1.1.0

⚠️ Disclaimer

This library is a personal project aid and is provided "AS IS" without warranty of any kind, either express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement. The author does not guarantee that the code will be defect-free, uninterrupted, or error-free. The author is not responsible for any direct, indirect or incidental damages arising from the use of this library. Functions may be changed at any time according to the author's own needs.

This library is a personal development utility provided "AS IS" without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. The author makes no guarantee that the code is defect-free, uninterrupted, or error-free. The author shall not be liable for any direct, indirect, or consequential damages arising from the use of this library. Features may change at any time based on the author's needs.

✨ Features

| Classification | Function | Description |

|------|------|------|

| RPC | Broadcast / Buffered Broadcast / Point-to-Point / Request Host | Encapsulates four common RPC modes and automatically checks permissions |

| RaiseEvent | Event broadcast/request-response | Lightweight communication without PhotonView |

| Room properties | Set/Read | Key-value pair storage, suitable for global configuration |

| Snapshot reissue | Automatic capture / active request | Automatically reissue the current status when new players join |

| Dynamic configuration | Registration / Host synchronization / Snapshot serialization | Configuration changes are automatically pushed to all guest machines |

Install

  • Depends on BepInExPack
  • Place SyncLib.dll into BepInEx/plugins/SyncLib/
  • Reference SyncLib.dll in your mod project
  • Add dependency: "cn_xc-SyncLib-1.1.0" to the module's manifest.json

⚙️ Quick start

using cn_xc.SyncLib;

// 1. Initialization (automatically mounted to PunManager, not destroyed across scenarios)

var relay = SyncRelay.Instance;

// 2. RPC broadcast

SyncRelay.RegisterRpc("OnSomethingChanged");

relay.Broadcast("OnSomethingChanged", arg1, arg2);

// 3. Room properties

SyncRelay.SetRoomProperty("MyModSetting", 5);

int val = SyncRelay.GetRoomProperty("MyModSetting", 1);

// 4. Dynamic configuration (changed by the landlord, automatically synchronized)

SyncRelay.RegisterSyncedConfig("TokenMultiplier", "10", (key, val) => {

MyMod.UpdateMultiplier(int.Parse(val));

});

SyncRelay.SetSyncedConfig("TokenMultiplier", "20");

// 5. Snapshot reissue (new players join the automatic reissue state)

SyncRelay.EnableSnapshotSync(

snapshotProvider: () => {

return JsonUtility.ToJson(myState);

},

snapshotApplier: (snapshot) => {

myState = JsonUtility.FromJson(snapshot);

}

);

// 6. New player joins callback

SyncRelay.RegisterOnPlayerJoinedCallback(player => {

// Customized reissue logic

});

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

Dependencies

Install these first, or the mod will not work:

BepInEx-BepInExPack

File & checksum

Filename
SyncLib-1.1.0.zip
File size
94.8 KiB