If you read that value, and decide to make a model edit as a result of its return value, it will desync. And that’s the end of my explanation of that function. It would print wh_main_emp_empire on my computer, and whatever_hexoatl's_key_is on my buddy’s. If I’m playing MP with my buddy, and I’m playing as Reikland, and they’re playing as Hexoatl, and we both run a script that has the following: By local player, I mean the player on that instance of the game – the player on that computer. So, cm:get_local_faction() is a pretty simple function – literally all it does is read what the “local” player’s faction key is.
I’m gonna cover each now and explain how to handle both! Thankfully, there are two really common – and really simple to fix – situations where this might happen: making model edits based on cm:get_local_faction(true)‘s result, and making model edits based on “ComponentX” or “XSelected” events. txt file, or making UI edits will not cause a desync. Doing something like outputting text to a. Note: A “model” edit is something that makes an edit to the game itself, ie., spawning an army, applying an effect bundle.
If conditions are different between the two computers, and one performs a model edit and the other doesn’t – kaput, no more synchronization. This stuff is usually handled pretty well by the C++ base-code – but, bad Lua coding can cause a desync!Ī desync will happen if you cause an edit to the model on one computer without doing the same edit on the other computer. In Total War, both PC’s are playing, technically, different instances of the game, and the game is sending messages back and forth between the two clients to make sure everything is the same on both PC’s. At that point, the game will just kinda stop.Ī desync is what happens when the two players’ PC’s decide that different things are happening at the same time – they are no long in sync (not since 2002!). Throughout the course of a multiplayer campaign, there will be an annoying popup box that says “Desync Detected – BEGINNING EXTERMINATION” (paraphrasing). If you’re one of the aforementioned six multiplayer campaign players who uses mods, you’re probably incredibly familiar with the concept of desyncs.
Before we get into how to resolve the desyncs and keep our code from ever being volatile, we should talk about what a desync is, and how they happen.