← appaday

Rummy, without the rule check

A digital rummy, the tile kind, made for a game design course in July 2022. The folder calls it "USC program". The plan was a game to play inside iMessage, and the design document was titled "Rummikub on iMessage". What got built is the step before that: a browser version, written in plain JavaScript between 2 and 12 July, twenty commits. Eleven of them landed on 5 July.

A white play area with beige 3D tiles scattered on it in small groups: a run of black 11, 12, 13 on the left, a red 12, 13, 1 in the middle, a yellow 6, 7, 8 on the right, and loose single tiles. Along the bottom two rows of the player's own tiles in red, yellow, cyan and black, with a blue plus button at each lower corner
11 July 2022: the tiles rendered from a Blender model, on the play area. The bottom two rows are a board. Each plus button draws a tile.

Make your own rules

The design document starts as a plan for a faithful copy and talks itself out of it line by line:

Actually, just make my own rules since “rummikub” is a registered trademark but essentially also just copied from Mexican rummy.

So: no minimum value for the first move, 1 may follow 13, four jokers instead of two. A few lines further down:

Actually let’s NOT look up the rule because that’ll make it more likely I come up with slightly different rules

And then the rule check itself goes, the feature the document had spent a paragraph on (inconsistent groups framed red when you end your turn):

Actually the consistency check can be skipped, since the real-world rummy doesn’t check the rules either and lets you and your co-player figure it out yourselves. Just provide the play surface and tokens. Also allows for that nice chaotic look of the play area.

Moving a tile follows the same thinking. The document wanted tap twice rather than drag, "because everyone would rather tap twice than drag their smudgy finger over the whole screen". In the game you tap a tile to pick it up and tap an empty cell to put it down.

The first version

The play area is a grid of 180 cells, each player's board 36 more. The deck is 104 tiles, every face twice, shuffled by swapping two random tiles a thousand times. Until there was art, the tiles were playing cards: four suits, 2 to ace.

A grey grid of empty cells filling the top of the screen, with four red card faces placed in it: a 5 of clubs, an ace of diamonds, a 9 of spades and a 4 of diamonds. Below, two boards side by side, each three rows of cells, most of them holding red playing-card faces with crowns for the court cards. A big blue plus button at each lower corner
"firstVertical", 4 July 2022: card faces as placeholder tiles and both players' boards on one screen.

The two players play from two browsers. A URL parameter says which board is yours, and "End Turn" sends the whole table, every tile in every area, to a small JSON store online. The other player's page reads it back when it loads.

Every time a tile lands, one of 21 short clips plays, picked at random. They are one recording of tiles being put down, cut into pieces. The design document had planned it: "A sound effect of the tile hitting the board or desk would be nice and I can easily record it myself."

A backlog with times

The project kept a backlog: each feature as a story with a priority and a time estimate. Two of the done ones got a note in the next column.

A spreadsheet grouped into Player, Environment, UI, Art and Sound. Each row is a story such as player can draw a tile from the stack by clicking a button, with a priority and an estimate from 5 minutes to 24 hours. Finished rows are green. Next to the 4-hour grid story: went much quicker than I thought, maybe because I was going through it mentally for weeks. Next to the 1h30m sound story: I don't know why this took so long. Transfer the file, audio tag, ... ?
The backlog, 5 July 2022. Green is done.

went much quicker than I thought, maybe because I was going through it mentally for weeks

That is the grid you move tiles around on, estimated at four hours. The tile sound, an hour and a half, got the opposite note: "I don't know why this took so long."

An asset list went with it, from the logo and app store screenshots (all greyed out under "iOS FROZEN") down to the draw button and "tokens hitting the desk - being mixed".

A spreadsheet of assets grouped as not active in the game, game environment, game parts, UI and feedback, and audio. Many rows are greyed out, among them every iOS app store item, the token 3D asset and animation, background music and victory and lose melodies. Small images of a green plus button and a blue check mark button sit to the right
The asset inventory, 21 June 2022. Grey rows were frozen.

The refactoring assignment

On 5 July the course turned to refactoring. The commit "some TODO ideas from reading USC material" put a list of questions at the top of the code, and the rest of that day's commits are renames, rearranged blocks and merged loops. The last line of the list is not a TODO:

Code comments in blue italics in an editor: TODO comment, TODO maybe break into files, TODO make a function do one thing, TODO where could I use interfaces in the future, TODO where could I use composition or even ECS, TODO make it really really human readable like startGame getTiles stackTiles dealTiles determineWhoStarts, and a last grey line: since when do I know how to write without looking at the keyboard? When did I learn this?
The refactoring list, 5 July 2022.

since when do I know how to write without looking at the keyboard? When did I learn this?

Another comment in the same file sits under the line that sets up the boards: "TODO I don't like something about this. Idk what".

The tiles came last. A tile model in Blender and Maya, rendered once per number and colour, replaced the card faces on 11 July. The final commit, on 12 July, is "small design adjustments".

built
2 to 12 July 2022, 20 commits, 11 of them on 5 July
code
plain JavaScript and Bootstrap, about 500 lines: four scripts and one page
table
180-cell play area, a 36-cell board per player, two players
deck
104 tiles, every face twice
sound
one recording cut into 21 clips, one picked at random per move
art
card faces first, then tiles rendered from a Blender model

Still rough

It is a table, not yet a game. Nothing checks a group, by decision, but nothing checks a turn either: either player can end a turn at any time, and a board is chosen by editing the URL. The jokers are still a TODO, and so are dragging, grouping tiles that move as one, and the "you win" screen. The last entry under "USER FEEDBACK" in the code asks for the rule enforcement the design had dropped.

The iMessage version, the point of the whole plan, was never started.