3 ms·
We have the "game-winning" scenario on the reflect.net homepage right now: https://reflect.net/ https://reflect.net/. It's a puzzle and when the last piece is p
by aboodman 3y ago
We have the "game-winning" scenario on the reflect.net homepage right now: https://reflect.net/ https://reflect.net/. It's a puzzle and when the last piece is placed, it shows a celebration and the puzzle resets moments later. But we only want that logic to run once. We can't do this client-side because there are many people and we'd end up having to choose a leader or something. This is the same exact situation as wanting to show in the UI who won (who placed the last piece) and only wanting to do that once.
Reflect has first-class support for this kind of situation by allowing mutators to run special code server-side. I talk about this a bit here:
https://rocicorp.dev/blog/ready-player-two#server-authority https://rocicorp.dev/blog/ready-player-two#server-authority
You can use the same mechanism to have a branch in the code that places the piece that only runs server-side and chooses the winner.