Hi! So I'm trying to create a simple multiplayer w...
# server
a
Hi! So I'm trying to create a simple multiplayer web game using Ktor, but am confused about how I should properly update UI on the client side. For example, If Player 1 wins the game, I would like to show, "You have won the game!" to Player 1 and, "Player 1 has won" to Player 2. Should I send the display text to each of the clients from the server, or should the clients just be told which player has won and determine what to display based on that? Or, does it not really matter?
a
You can use the later approach. Since you have some 'state' of the current player on the client, a simple if...else check for if the current player is the winner will decide what to display. Which means the actual display text (or template) would be in the client.
c
Not Kotlin related, but did you see this talk?

https://www.youtube.com/watch?v=nSrucNcwlA8&t=275s

m
I’d recommend sticking any display logic to the client.