The syncing is taking a long time because of the TriggerSyncReady spam. If we did a timer poll instead, it should probably go faster. I'd have to test it. Someone else tried it with orders and got speeds that were way faster, but I think gamecache is actually viable if we get away from TriggerSyncReady. Instead, we'd just kind of wait for data to arrive on like a .03125 timer or something.
As you saw before, the synchronization can vary in how long it takes wildly. Even when you did a 3 second sleep, it didn't synchronize. There's just a lot of testing that needs to be done. Everyone knew about the low synchronization speeds with more players and stuff >.>. The TriggerSyncReady stuff doesn't help at all either.
Sadly, I don't have time to do this since I'm spending all of my free time on a compiler. Once the compiler is done, I need to work on collections and other things before I can actually get back to Network, so it'll be awhile. If I had more people helping me, or if someone else wanted to learn about synchronization and try to improve Network, it'd be a different story.
For those who are interested, this is how the Packet synchronization works. Every single player sends data, even if they aren't sending anything. You start at player 11 and stop. When you receive data from player 11, or player 11 isn't a human, you move down to player 10 and stop again. You keep waiting for data at each player until you have received data from player 0. Once this happens, you use Thread to synchronize with everyone, or rather to let everyone know that you are synchronized. Thread does a SelectUnit. When this runs, an event will occur for all players. An integer is used as a bit array, and the player that fired the selection event is set to true for the bit array. When all valid players have fired the event, then everyone knows that everyone else is ready to go and you move on.
The wait method waits until the bit array is all true.
The sync method from Thread fires the SelectUnit for yourself to fire the event for everyone.
So yea, that's exactly how Packet works. Inside of every loop is a TriggerSyncReady. This thing runs on every iteration. TriggerSyncReady isn't as reliable as Thread, especially with very large operations. It has a timeout or something. Anyways, TriggerSyncReady gets spammed to no end absolutely everywhere, which likely completely kills the synchronization speed. It's essentially just used as a wait. TriggerSleepAction does the same thing as TriggerSyncReady, but has a longer delay. We need something asynchronous, like a timer. I think if we move it all to timers, it'll work. The problem is how to get everyone back into the code... if we know that everyone is ready to go, that is everyone has received data (we use Thread just to run the synchronization and we have the array), then what we can do is for the first player that sees that everyone is good to go (last player to run the timer, everyone else will be out of it), they can do a SelectUnit, which will have everyone reenter the code at the same time. From here, they can pause and destroy the timer. We'll have to make it so that the SelectUnit event only runs once too. I think destroying it immediately will not cause a desync and extra events from other players that might have seen the synchronization ready thing and sent out the flag will just be ignored.
Uhm, so yea... in order to speed it up, I have lots of ideas, but no time to implement : P.
Also keep in mind that there is some sort of buffer for sending data off. This is why if you have a save/load code or something and you want to synchronize it, you can't send it all at once. If you make the buffer angry, it's ganna go really, really slow. If you stay within bounds, it'll be happy. For orders, someone else ran into an order limit where they got throttled there. There are lots of things you have to consider.
Stream ran faster because it had less TriggerSyncReady between the data and stayed within the buffer. I think that the TriggerSyncReady spam is also making the buffer mad, or rather hits the buffer limit when ou have 6 players in the map all spamming it together. We definitely need to get rid of the spam. The Network library and Thread library have like everything you need. They just need to be ... modified a bit ^_-.