How to post game-only information from PHP to JS?

Game development with Board Game Arena Studio
Post Reply
User avatar
Hutilointia
Posts: 8
Joined: 27 January 2021, 18:18

How to post game-only information from PHP to JS?

Post 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?
User avatar
Hutilointia
Posts: 8
Joined: 27 January 2021, 18:18

Re: How to post game-only information from PHP to JS?

Post 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.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to post game-only information from PHP to JS?

Post 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 ??
User avatar
RicardoRix
Posts: 2540
Joined: 29 April 2012, 23:43

Re: How to post game-only information from PHP to JS?

Post 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.
User avatar
Hutilointia
Posts: 8
Joined: 27 January 2021, 18:18

Re: How to post game-only information from PHP to JS?

Post 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.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to post game-only information from PHP to JS?

Post 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
Post Reply

Return to “Developers”