Getting Revealed Knowledge
Using the getRevealed
Function
getRevealed
FunctionIn games with hidden information, the game handler may reveal certain elements of the game state to players at specific points in the game. This is typically done by sharing secret keys that allow players to decrypt the hidden information.
The RACE JS SDK provides the getRevealed
function in both the AppClient and SubClient classes to access this revealed knowledge. The function takes the randomness ID as an argument. This ID is associated with the randomness generation process used to create the hidden information. The function then returns a map containing the decrypted values associated with that randomness.
Code Examples for Utilizing Revealed Information
Here's an example of using the getRevealed
function to access and display revealed information in the game UI:
This code snippet demonstrates how the getRevealed
function can be used to retrieve decrypted information and update the game UI to reflect the revealed knowledge. The specific way you utilize the revealed information will depend on the nature of your game and its mechanics.
By using the getRevealed
function, developers can ensure that players have access to the complete game state when necessary and can make informed decisions based on the revealed information.
Last updated