Closed mike-mcgann closed 11 years ago
What is the best way to update the server and other browsers when new points are awarded? Do we send individual "update" messages with just the latest point(s) each (and have them tacked on the end of the match state)? What happens when the user mashes on the +1 point button repeatedly? Should we throttle messages so they are only sent once every 5 seconds or so? Maybe we should periodically sync the match state with the server?
I think the easiest would to run the engine on the server. In games where you don't have a server, the engine would run in the browser. When the "+ Point" button is hit, that gets sent to the engine/server, it notifies all clients of the event (including the controlling client that sent the "+ Point" request) and they update their displays. This would ensure that everyone is consistent and displays don't update until recognized by the server.
The connection from the controlling device to the server would have to be good or lag would be seen when pressing buttons. I think that is okay. Benefits are that any client could potentially be a controller (remote control, handoffs). Also, when a client joins late, he will need to request what the current state is. Much easier if all that is all on in the server.
I think throttling is easy enough to put in later if needed. Starting out I think we should try direct updates and see how it goes as that would provide the best experience.
Thoughts?
For the most part the connections will be good, and if we are using web sockets there will be little overhead for small point update messages. We'll have to do some testing to see how it performs; if we see issues on mobile, we might want to just immediately update the UI. The last thing you want is a button that doesn't give you feedback within a half second
How about if we go the other way around? Instead of the displays being "dumb" and told what to do, they are "smart". There is a game engine in the master browser, one on the server, and each client has one too. When "+ Point" is pressed on the master browser, that engine is updated and the "+ Point" command goes to the server. It runs that through its own engine, and then broadcasts out the "+ Point" command and each client runs it through their engines. That way the master browser can update its state immediately. Server has a copy of the state for the clients who join late.
I concur.
Latest information on this is on the Pong Engine wiki page.
History of the game match shall be rendered as follows (but don't forget the timestamps, those are relative from the start of the match):