Page 1 of 1
How to post game-only information from PHP to JS?
Posted: 29 April 2022, 08:28
by Hutilointia
The documentation for notifyAllPlayers says not to use it for private information, as cheaters can see the data passed. How to pass private information to the game, then? I need to inform the JS about a game state change; it's information no player should have. It goes easily in the game data update with a reload, but how to make it dynamically available to the JS without using notifyAllPlayers? Or should I just ignore the possibility of cheaters and use notifyAllPlayers?
Re: How to post game-only information from PHP to JS?
Posted: 29 April 2022, 08:35
by Hutilointia
Ah, as usual, asking the question helped to solve the problem. The solution was to add an extra state where the information is passed to JS just as it becomes public for players to see.
Re: How to post game-only information from PHP to JS?
Posted: 29 April 2022, 13:35
by Tisaac
Hutilointia wrote: ↑29 April 2022, 08:28
The documentation for notifyAllPlayers says not to use it for private information, as cheaters can see the data passed. How to pass private information to the game, then? I need to inform the JS about a game state change; it's information no player should have. It goes easily in the game data update with a reload, but how to make it dynamically available to the JS without using notifyAllPlayers? Or should I just ignore the possibility of cheaters and use notifyAllPlayers?
I'm sorry but I have no idea what you are trying to do. Why would you need to send "an information no player should have" to JS ??
Re: How to post game-only information from PHP to JS?
Posted: 29 April 2022, 15:18
by RicardoRix
Use notifyPlayer() for information only that 1 player is allowed to see.
On a state change you could also use the 'args' feature, and load the data only if it's the correct player.
Why would they also be able to see the data on a reload? This also needs to be player specific when necessary.
Re: How to post game-only information from PHP to JS?
Posted: 17 May 2022, 08:14
by Hutilointia
There's information that no player should see – yet. But it needs to be passed to the JS, so that it can be displayed when necessary (it's contents of a small deck of cards, which becomes public at one point).
Anyway, as I said, the solution was simple: I just added a new state so that the data can be passed at the exact moment it becomes visible to all players.
Re: How to post game-only information from PHP to JS?
Posted: 17 May 2022, 15:15
by Tisaac
Hutilointia wrote: ↑17 May 2022, 08:14
There's information that no player should see – yet. But it needs to be passed to the JS, so that it can be displayed when necessary (it's contents of a small deck of cards, which becomes public at one point).
Anyway, as I said, the solution was simple: I just added a new state so that the data can be passed at the exact moment it becomes visible to all players.
Exactly. Dont sent anything until you reveal it