A simple turn based game of getting 5 in a row on a board of 9 x 9 (81) boxes. Each player play on her own device. One person start of the game by inviting, the other then join. Then it’s on the way.
Basic Tech
The board is a Repeating Group fixed with 9 by 9 cells of thing Box. A box holds only an ID (to get sorted correctly) and which player is owning the box. Each Box thing is pre-created and only changed in the game.
The hidden group Game holds the thing Game with all game settings (it also shows some data used to debug).
Both player’s clients share the same Boxes and Game things.
There is (deliberately) no logging in. Still I use the User to store user data during the game.
Since the players are on different clients there is a small special handling when the game is over (won, not canceled).
The Fun Tech
There are two slightly more interesting concepts in the game:
Highlighting the boxes the user is allowed to choose. See workflow folder Highlight. Data is stored in states in element Board. First the x and y position of the box is calculated. Then each of the 8 boxes surrounding the selected box is checked if it should be highlighted for next selection (by the other player). If the box is empty then it’s Owner is changed to 0 indicating getting highlighted.
Checking if the current selected box gave the current player 5 in a row (winning). See workflow folder InRow. The workflow structure is based on setting delta values to work from the selected box’s x and y position. This makes the workflows reusable as they are parameterised. They are numbered; 0 = master workflow, 1-4 = one for each direction to check in, 9 = commonly used by the in 1-4. The real fun happens in 9.InRowDoCheck and 9.InRowGetNextID.
Thoughts of extensions
Many games to be live at the same time. Select opponent by random or a friend list. Save scores (shortest time, fewest markers placed…)
Its the forum turning the ampersands & into & in the link.
One way around it is to use the hyperlink button, but then I think you miss out on the preview.
There is a challenge I have not solved. When a player clicks Invite there is some time before the second player’s client gets the updated data that will hide the Invite button and show the Join button. So, there is a chance that both players click Invite and therefore are locked in waiting for the other player to join.
Impressive!
Gratulerar! philledille! Jag gillade allt! färgerna, typsnittet, stilrent. Du gjorde ett riktigt bra jobb.
Jag bor i Göteborg, var bor du någonstans, ifall vi kunde bedriva någon sorts samarbete inom andra områden (men bubblebaserat iofs)
Gino
Tack @gino! Såg att mina sista inlägg i din “svensk-tråd” försvann. Bubble hade lite teknikproblem med forumet. Såg du mitt tips om Lounge Hackers? Jag tänkte gå på det någon gång - kan vara ett bra ställe att hooka upp.