barbanera wrote:Thanks Seth.
However, that only scratches the surface of the process, I think. What about when several traits are executed in succession? Each sends a "snapshot" of the results of what it did, one by one till the sequence finishes or just a snapshot at the end of it all? And is it/are they a complete snapshot of the game or just of the affected pieces, global properties etc?
I apologize for the confusion. I thought you were originally asking about how the 'Synchronize' command works - that works by asking each of the Game Components to build an appropriate restore command to be able to reproduce the game state on the remote computer, and it has nothing to do with keystrokes.
Trait execution is different. When a keystroke is issued, traits are evaluated from the bottom to the top, and as they are evaluated they have the option of responding to that keystroke. If they make a state change as a result of the keystroke, they are also then responsible for building a Command to inform the remote computer how to replicate that state change. Commands are encoded into a string which is uploaded to the game server and then broadcast to all the other connected clients; they are then decoded by the clients and executed to make the appropriate changes.
I mentioned elsewhere that Trigger Action and Report Action are fired after all other traits, and from the top down. This is because, when either of these is evaluated in response to a keystroke, it delays and insists that all of the traits above it finish before it will evaluate itself. Triggers and Reports are polite, like that.
As far as sequences of traits, as the individual traits are evaluated they append their own Commands to a list of Commands which is then encoded and sent, as a unit, to the game server. They are decoded, separated into individual traits again, and executed in the same sequence in which they were built.
It's possible that there are bugs with the interactions between all of these processes - execution, sequencing, encoding, decoding, and remote execution - and in fact (I believe) bugs 4278 and 4300 are examples of such bugs. However, it's very hard to know what to look for without a clear description of the problems you're experiencing.