-
-
Notifications
You must be signed in to change notification settings - Fork 162
JS error handling [improvements needed] #30
Comments
I propose splitting the /predict HTTP command into two operations: one to play the human move, and a second to generate the bot move Then the client flow could be:
(Optimistic update with error handling might be nice for a production-quality client, but for the demo client I think blocking is fine) |
While splitting the request may be a good idea, I don't think that it would help solve the problem. If the bot has an error, we will still have a problem. Also, the additional level of complexity is not worth it. I'd rather have a separate request for getting a copy of the game from the server. If we did go the route of splitting the request, it might make more sense to use web-sockets. Upon starting:The client can either choose to join an in-progress game or to start a new one.
During a game session:
The benefit of this route is that the server could be programmed to mirror the current game across all open web clients. In this scheme, step 1 is optional! All the other steps (2 - 6) can happen concurrently on a (hypothetically) infinite amount of clients with one or all of them able to pick the next move. |
I think the best route to go is to draw the stone but not run |
It's worth noting that moves are getting sent to the server, even if they are invalid. If the server doesn't reject it (i.e. a suicide or immediate ko retake), it will return another move. However, the client will not draw the move because it is invalid. This is one of the contributing issues to #27. This should be easy to fix. |
Yes this is a good plan. Just to clarify what I was saying about splitting the
Using web sockets to sync state across multiple browser tabs seems like overkill to me, but if that's what interests you, by all means go for it :) Supporting full sync of game state from the server is a good idea in any case. |
I am going to go ahead and close this issue due to the improvements of pull request #38 which address the actual issue of poor client side handling. The rest of this thread, which is about sync mechanisms, should be given its own issue for discussion as it is off topic. If anyone else notices new problems with the javascript error handling, they should feel free to re-open this thread. |
I have noticed that if the server responds with any type of error, the client
demobot.html
freaks out. When this happens, no move is processed for white and the client switches to playing white for one (1) move. At this point, the player can only play in areas that white is allowed to play in, and locally, their moves count for white. However, the moves are still recorded and sent to the server as moves made by black.There is currently no way to update the board with the server and there is no way (that I know of) to undo the last move (easily). The only way to avoid this issue (at this point) is to hold off actually making the move until the server resolves the move (successfully). Another option is that every time a move is made, a "snapshot" could be recorded before it is processed (and restored if it causes an error).
This lack of error handling is the partial cause for the symptoms described in #29, #26, and #27.
The text was updated successfully, but these errors were encountered: