Skip to content
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

add delay level seed reveal #160

Open
loothero opened this issue Aug 20, 2024 · 0 comments
Open

add delay level seed reveal #160

loothero opened this issue Aug 20, 2024 · 0 comments
Assignees

Comments

@loothero
Copy link
Member

To support third party use cases which require players to sacrifice a live game, we need to add an option for players to delay the reveal of the next level seed.

The problem this solves is enabling third party onchain apps to know whether or not a player is in a certain death situation. Say for example you reveal the vrf seed for level 20 and the first obstacle is T1 level 60, resulting in unavoidable death. The player sacrificing that game is much lower value than someone sacrificing a game that has a chance to be a new world record.

Providing a is_certain_death(adventurer_id) on the contract would be significantly challenging and complex. The simpler solution is to allow adventurers to delay the vrf call to generate the level seed for the next level. If we know the adventurer is in this state, we can be sure they are not in a certain death situation since they are about to achieve a level up with the details of the next level still unknown.

Technical details:

  • Need to consider all of the calls that can result in a level up: {explore, attack, flee}. Each of these will need a delay_next_level_reveal: bool parameter. Most clients will default this to false at which point the game will function the way it does today.
  • If this parameter is true, when the contract hits the part of code where it typically calls the VRF, it'll wait. Until when? A separate endpoint will need to be provided reveal_next_level(adventurer_id) that they will need to call.
  • How will we know if player is allowed to call that endpoint? The level seed for their adventurer will be 0 but that's not enough because during normal operation, it will also be zero for a period of time. We need something more explicit. I think under normal circumstances we prevent the level seed from ever being zero so that we reserve this for "requesting VRF state". We could do the same for level seed 1, in which we never allowed the level seed to be set to 1 (if it's 1, we set it to 2) so that we can use that state to detect we are in a delayed reveal mode.
@loothero loothero self-assigned this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant