Sid Meier's Civilization VI

Sid Meier's Civilization VI

Not enough ratings
Sync Data API
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod: Gameplay, UI
File Size
Posted
Updated
148.760 KB
5 Oct @ 6:58am
6 Oct @ 5:56am
2 Change Notes ( view )

Subscribe to download
Sync Data API

Description
Note: If your mod overrides StagingRoom.lua, make sure to add the following code at the start of your OnChat function to filter data:

if toPlayer >= 655000 and toPlayer <= 999999 then
return
end


Multiplayer Data Synchronization via Civilization VI Chat System
Implements reliable data synchronization in multiplayer games without causing reloads from frequent data transmissions.



Why use data synchronization?
• When using SetProperty to store data, other players cannot access it in multiplayer.
• When using ChangeGold or AttachModifierByID to modify game data outside global events, other players won’t receive the update.
• When using custom UI or mechanics that require frequent data exchange, PlayerConfigurations:SetValue can cause reloads.



Why use the chat system for synchronization?
• The chat system triggers the MultiplayerChat event whenever a message is sent to all players.
• Using PlayerConfigurations:SetValue multiple times per turn may cause reloads, while the chat system will not.
• Other in-game mechanisms (e.g., DiplomacyMeet events) require manual setup and may interfere with diplomacy.



Will messages typed in chat trigger synchronization?
No.
As long as the message is not sent via port -1 (the “send to all players” chat ID), it will be ignored in the callback.

However, if another mod listens to all MultiplayerChat events, data leakage is inevitable.



Will this cause data desynchronization?
No.
This system has been tested extensively in the “Multiverse Trading System” mod—over 100 turns and hundreds of modifier bindings—without any reloads or crashes.



Additional Function
The mod includes the built-in function:
GameEvents.BroadcastInfo_MTS.Call(iPlayerID, infoString)
Used to send broadcast messages through global chat.

For example:
When playing co-op (PVE) with friends using cheat mods, broadcasting changes via this function prevents hidden cheating.



Thank you for using this mod!
If you have better synchronization ideas, feel free to contact me.
3 Comments
少卿 7 Oct @ 10:49pm 
太有用了这个模组
PhantomJ_M 7 Oct @ 3:08pm 
过于扭曲
zero魂 7 Oct @ 2:50am 
牛逼啊,能够解决很多MOD重载的问题? 牛逼!