Closed stevenhao closed 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/downforacross/downforacross.com/83EixLdNd9LMNy2q3VjVaiJSc13Z
✅ Preview: https://downforacrosscom-git-fencing-downforacross1.vercel.app
Some implementation notes
Fencing
as entrypoint. Takes in gid
. These gid
s will be incompatible with regular games.subscribeToGameEvents
(new function!) to stay in sync w/ the server via websocket connection on what game events exist for the game.gameState = useGameState(events)
to transform a list of game events into the current game state. (this pattern is known as event sourcing -- the source of truth for the state rendered on the screen is actually a list of structured "updates". kind of like git & other vcs)transformGameStateToPlayerProps(gameState)
to prepare to render a child <Player/>
component -- props are derived from game state appropriately.Fencing
component returns <Player {...playerProps}/>
.Need to support:
initial set of unlocked squares generated via algo (see Game Mechanics section)
FWIW, the original behavior is: The corner square itself must be white. Then, count white squares in the two available directions until hitting a black square. The product of the two counts must be between 10 and 30 for the grid to be allowed; furthermore, all clues that intersect that L-shaped region are unlocked initially. The goal is to provide a natural subsection of the grid as a reasonably sized "starting base".
color the background of correct (green) squares by the team that got it
This is one of the places where I ran into UX trouble. Most crossword interfaces shade the square the cursor is on, but I had reserved shading to indicate which team owned the square. I ended up trying to pop out the square slightly plus hatching on the rest of the light, so it would be independent of the color. (And the cell also has to indicate its cooldown somehow.)
The corner square itself must be white. Then, count white squares in the two available directions until hitting a black square. The product of the two counts must be between 10 and 30 for the grid to be allowed; furthermore, all clues that intersect that L-shaped region are unlocked initially.
This is really helpful! I was unsure about how to choose constants, so it helps a lot to have some reference parameters (10-30 starting corner area) that already have been tested in live gameplay.
Most crossword interfaces shade the square the cursor is on, but I had reserved shading to indicate which team owned the square.
Yeah, this is going to be tricky. I'll experiment with various styles that play nicely with the background-color-cursor... (maybe underline with color? outline?). Will also look closely at how you did it with pop-out/hatching... your UI felt very natural to me when I first used it.
Part 1: https://github.com/downforacross/downforacross.com/pull/146 (merged)
Part 2 (This PR):
Todos
Game mechanics
take the 9 white cells closest to the starting location, and unlock all the entries that contain one of these cells
- starting locations for 2-team games will be corners, but could be easily extended to support multiple teams as well)Acknowledgements
Credits to @cesium12 for building the original matchmaking and game server for the competitive crossword game that this PR is based on.