matchymatchy
the goal is to reproduce the top right pattern on the 9 center squares with as few moves as possible.
still in development
fun fact: this app was entirely developed on emacs!
architecture
this app implements didier boelens’ approach to bloc.
the idea is to show data through widgets that react to a bloc’s stream.
in order to simplify state management, i’ve also implemented eventstates:
blocs that emit a new widget’s state based on an event.
multiplayer
multiplayer is handled by firebase. a firestore database stores all matches, queue and users
information and all endpoints are firebase functions written in typescript
(project under directory functions).
- queue
when a player looks for a new match, he’s put in a fifo queue and joins a match as soon as an opponent
is found. a common target is chosen for them and whoever reaches the goal with the fewest amount of
moves wins.
- reconnection
players can leave a match at any time and reconnect later. active matches are stored on the device
thanks to sqflite.
- forfeit
players can forfeit a match. this immediately triggers a win condition for the opponent.
- move/win/challenge notification
notifications are handled by firebase cloud messaging. every time a player is challenged, or an opponent plays a move, both players are notified.
if you want to use the online component, you can create a new firebase project,
create your own google-services.json and put it under android/app.
singleplayer
the app comes with a sqflite db of 500 combinations of target fields + game fields. a random
combination is chosen.
Comments are closed.