-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spectator Mode #19
Comments
He is how I would approach this. You can start by adding a
Next, you would need a to change the game protocol. For that you have to modify
Then change the client and the user interface to send the Once you have the logic to join a match as a spectator you will need to update message handlers in the client and make them check if the user is a spectator. If that is the case the client should ignore requests for rolling the dice or piece movement and should only update the board. I personally don't have spare time at the moment for this feature request, but hopefully this can get you started. |
Thank you for the fast response... Before I opened this thread I made below changes... To
To
My idea was to remove the block in The changes I made actually works, a 3rd player can login as a spectator to game with challenge link and they have spectator flag, they actually can see the current state of the game, but for some reason it is just stuck there. What I mean is that the spectators doesn't get new rolled dice status or new piece movement data... I thought there might be some javascript errors or something but there is nothing in console... I even thought about making a js interval to update board for spectators every second but that didnt work too... Is my approach wrong? Should i start again? Or is there something I am missing in |
It's not wrong, it's a possible approach. In that case I would expect that changes in You will also have to stop Try to instrument with |
Actually no, when i roll the dice spectator console is empty... That is what i am stuck at, no errors or any responses... It is like the spectator client is not listening anything... You can see it in https://kuponuna-rulet.herokuapp.com/ |
The client's main message handler ( So it's either the server not sending messages to the spectator or the client gets disconnected immediately after the match starts. The server is instrumented to log Excerpt from
|
Well this is starting to get more wierder for me :) As for the server logs show 3rd player logs in gets an id and socket but after that it is just gone, no replies or anything... Shouldnt it write disconnected if it is dropped? Also for some reason on an empty server that no one knows there are 7 players listed in server logs? 2 of them are test players i am using, 3rd player is no where to be found but there are extra 5 players... Here are the server logs...
|
When the server receives the join command, it adds the client to the players array. It does so by using either the Both of these make sure there are only two players in the array. For example in
You will either need to change that or create a new method, eg. As for ghost players, player objects remain the array in case the client has temporary disconnected and wants to reconnect, so these are probably left over from previous test games. This should not be related to the problem. |
these comments helped me and I developed Spectator Mode successfully. |
Great to hear! I myself don't have time to work on this project so it is great there are forks adding new features. Wish you luck! |
Is it possible to add a spectator mode? I have been trying to accomplish that and have been able to get a 3rd player to the game screen but data doesnt get refreshed...
Can you please tell me what to do?
The text was updated successfully, but these errors were encountered: