joelbelo Per your message I wanted to post a new updated version of my multiplayer platform example that uses functions to perform multiplayer actions instead of synced objects to eliminate lag. I have commented the code as best i can to help better understand it but its still more complicated than syncing objects. The difference is that there is almost no lag when you do persisted function calling and simulated actions.
It supports unlimited players so just open as many browser windows as you want and click connect. Each player scrolls to them selves. Move them around using the arrow keys.
Note: you will need the moveto plugin by rex for the capx to work. I assume most people have that plugin by now
How it works:
When "Player1" presses the left button instead of using the built-in behavior move i disable those on start and instead call a function "MoveLeft" and pass it a parameter of the peerid to move that simulates moving left for that player. At the same time i take the function parameters and the function name and package them into a dictionary. I then send the dictionary AsJSON in a multiplayer message to all peers. They load that JSON string back in to a dictionary on their end and then call the exact same function with all the same parameters that were sent in the dictionary. Both devices call the same function at near the same time.
Based on my experience function calling messages appear to be just as fast as synced variables but don't have any over head performing lag calculations. Its just save AsJSON and load AsJSON. The irony is the side effect of syncing objects looks like it induces lag by using a large amount of CPU performing the calculations to correct for lag. Function calling is just a straight call so you do all the lag correction your self.
To use as little bandwidth as possible I don't send the move left command every tick. I only send it once at the beginning (even though the user is holding down the move left key, the command is only sent once) and its repeated on the other end (persisted) until the player lifts his his finger off the key at which point a stop command is sent. This is accomplished by tagging the dictionary as a persisted action so when the peer receives it they lock it in and keep calling "MoveLeft" (even though they only received it once) until a dictionary message is sent with the same tag name but a different function telling it to stop. So for the full move event i send one dictionary telling it to move left. as soon as the player takes his finger off of the key i send a dictionary with a function to stop moving left and once the object has stopped moving i send the last dictionary with a moveto function call for the specific location to compensate for latency but ensure they are at the same position. 3 commands to move a player all the way across the screen with no lag using simulated functions. Now just to ensure its as accurate as possible while moving every 20-30 ticks or so the player will send a set pos command to account for any latency.
You will notice there is basically no lag and movement is smooth. I know that function calling is bit more complex but once you get used it it makes lag free actions very easy. Give it a try and let me know if it helps