Tuesday, May 23, 2023

Dev Journal for Deco Deck

Deco Deck is my fourth indie game. It’s available today on iOS, Android, and Steam.

About the game

Deco Deck is a new kind of logic puzzle. If you like KenKen or Two Not Touch, you might like Deco Deck.

Here’s what a mini puzzle looks like:

A screenshot of the game Deco Deck: mini, unfilled

Every card has one of five suits, and a number from 1-9.

The goal is to link up the cards in connected groups of five, such that each group forms a valid “hand”. The hands are: straight, flush, full house, five-of-a-kind, and rainbow. A rainbow is one card of each suit.

Each puzzle has only one solution.

To solve, just link up the cards:

An animation Deco Deck: a trivial mini, being solved

Of course, they’re not all that easy. That puzzle is easier than any puzzle in the game itself. It is the trivial puzzle that I use in the tutorial. I chose it so that there’s no way to go down a wrong path. And it’s got the flush of blue hexagons, which the tutorial is able to describe as “blue” (for people with normal vision), or “hexagons” (for colorblind people). The other shapes don’t have short, unambiguous names.

Here’s a harder puzzle:

A screenshot of the game Deco Deck: mini, partially filled

Both of the above hands, marked in gold, are valid hands — but one of them isn’t part of the actual solution.

A screenshot of the game Deco Deck: large, unfilled

Puzzles come in four sizes. The above is a “large”, which is 90 cards. You already saw mini (30); there are also medium (60) and huge (120) puzzles. Of course, it would be possible to make puzzles of nearly any size, but it wouldn’t be reasonable to put them on a phone screen. Even the huge is pushing the limits of finger dexterity on smaller phones.

Design

As I mentioned at the end of my post about Mosaic River, a dilemma in the design of the tile placement subgame put me in mind of logic puzzles. So I built a puzzle generator. The first version just spat out the puzzle in tab-separated value format:

A3 A4 A5 B6 C9
D2 D5 E1 C5 C7
B4 A2 A1 C4 C7
C7 A2 A2 A9 D9
B2 E3 E2 B1 A9
C8 A8 D5 B9 A9

Then I popped it into a spreadsheet and used the coloring functions there to mark the hands. (I guess I could have printed it and used a pencil, but I don’t keep my printer connected). This proved that puzzles were (a) solvable by humans and (b) fun to solve. I immediately sent the uncolored spreadsheet to some friends, with instructions. But then I realized that building a front-end in Godot would be really easy.

A screenshot of an early prototype the game Deco Deck: programmer art

OK, not the most beautiful, but it only took me a few hours to bang together. Godot spat out a HTML5 version, and I told my friends to disregard the spreadsheet and try the interactive version. The feedback was positive. One friend noticed that the difficulty range wasn’t very large — later, I’ll explain how I solved that.

I decided to put in some more work to make it prettier:

A screenshot of a different early prototype the game Deco Deck: programmer art

I recognize that this is not in fact much prettier. I wasn’t really sure what it should look like. Then a friend introduced me to his friend, who happened to be a graphic designer. I hired him to do the visual design. We considered all sorts of themes: Japanese flowers, butterflies, amoebas, and 90s cyberpunk. But I decided that I liked Art Deco best. It’s very much a programmer’s sort of art — produced by the intersections of simple shapes at common angles. Designed to be built by craftspeople rather than artists.

Without Benjamin, Deco Deck would not have looked nearly this good. I tried to make some Deco-style cards, but they ended up visually busy, and not really very Deco (that is, not vertically symmetric). It’s actually a little tricky in 2023 to do Art Deco, because our eyes have been trained by modern styles. So, we expect bezier curves instead of circular arcs, since that’s what’s easy to do in vector editors.

Some ugly almost Art Deco cards

Later, I tried to design the card backs (a visual flourish seen only for an instant during loading), and instead of Art Deco, I ended up with Fart Deco.

An Art Deco abstract pattern that looks a bit like a person's rear end with a spray coming out of it

So I’m very glad that I had a good designer to work with.

Rainbows

When I first designed the game, I didn’t think of rainbows, because they’re not a standard poker hand. If they were a poker hand, they wouldn’t be a strong one: with this deck of cards, they would lose to a straight. But I got to thinking about how suits were only used for flushes, and what a shame that was, and then I remembered that I had five suits. Once I added rainbows, I found myself hooked. The rainbow’s weakness as a poker hand is its strength as a puzzle component: it increases the number of hands that each card can be part of, making the puzzle harder. This fixed the difficulty range problem that my friend had identified.

Puzzle generation

Building a puzzle generator was straightforward: I started by building a little library that would generate a random pentomino tiling of given dimensions. The simplest representation of such a board during the generation process is a bitmask (which fits in a register for even huge boards, so long as you’re willing to use SSE registers).

Then I implemented the constraint propagation algorithm from Norvig’s Sudoku solver, with the additional wrinkle that it would report if multiple solutions were possible. Instead of marking squares with a list of possible numbers, I marked cards with a list of possible “situated pentominos” that it could be part of. A situated pentomino is a pentomino, possibly rotated and reflected, with a given top-left coordinate. Or, if you prefer, a list of five coordinates, which are orthogonally connected. Propagation consists of two different inferences: (1) if a card is part of only one pentomino, then no different pentominos may contain that card. (2) if all pentominos for two cards share some third card, then the third card can only include pentominos from the set of shared cards. The second of these isn’t strictly necessary, but it does make solving much faster.

So generating a puzzle works like this:

  1. Tile the board with random pentominos
  2. Generate a random hand for each pentomino
  3. Check how many solutions the puzzle has.
    1. If zero: there’s a bug.
    2. If more than one: pick a random card which could belong to multiple polyominos; re-randomize the polyomino that it’s supposed to belong to.
    3. If one: ship it!

Of course, there was a bug in my first version of this — the annoying kind of bug which causes correct results, but too slowly. So I thought, “oh well, I’ll have to reimplement it in C++”. Half way through the reimplementation, I went to sleep, and when I woke up I realized what the bug was. So I threw away the C++.

As I generate puzzles, I also track the maximum depth that the search has to go down to. The theory is that deeper searches correlate with harder puzzles. So does a wider set of initial possibilities — that is, more possible pentomino per card. In theory, I could have tracked the size of the entire search tree, but in my testing, it didn’t seem to make much difference (and the size of the tree depends on the search order, since a lucky search choice can propagate out to eliminate zillions of possibilities). This is one of the two axes on which I rate puzzles.

The other axis is quality. A puzzle that has all of its complexity in one corner is boring. A puzzle that’s mostly one color is ugly (and the solve gets easy once you know the trick). A puzzle that has flushes on the top and straights on the bottom is less good than one that has them intermixed. I have eight quality metrics. A weighted sum of these metrics is the puzzle’s quality. I generated millions of puzzles, and the final game contains only the top few percent of them. (Of course, it would have been possible to change the puzzle generator to incorporate the quality metrics, but by the decide I knew what the quality metrics should look like, I had already generated zillions of puzzles).

Money

I decided to try a third revenue model. I was inspired here by [Knotwords](https://ift.tt/guPW21t daily free puzzles, and a subscription for addicts. Like the New York Times Crossword, and like Knotwords, Deco Deck puzzles are easy on Monday and get harder as the week goes on. Unlike Knotwords, Deco Deck puzzles don’t get bigger as the week goes on. The mini is always free, and each day, one of the other three sizes is free; I loop through them. So, on day 1 there’s a free medium, on day 2 there’s a free large, on day 3 a huge, and on day 4 back to a large. So free users get to experience all of the sizes at all of the difficulty levels over the course of three weeks.

The Steam version is just a straight up one-time payment. I didn’t feel like dealing with a whole other in-app purchasing system.

I do all of the puzzles very day (although I do sometimes use a hint on the large or huge Saturday or Sunday puzzles). I’m totally hooked, and I hope you’ll get hooked too.

Development

This one took much longer than expected. When I started this project, I told my wife that I would aim for four or five games in my first year. I’m barely hitting three. One reason is that my kid’s preschool unexpectedly shut down for a month, leaving me with extra childcare duties.

Also, getting the visual design right took a long time. One minor example: on the Monthly puzzles screen, it needs to be clear that you can scroll within each difficulty level. So the layout needs to be tweaked so that, regardless of screen size, a puzzle is half-exposed on the right.

Deco Deck's monthly puzzle screen

There are also two exciting new developments in my practice: First, I discovered Post Horn PR, a group that does PR for indie games. So as this blog post goes out, a press release will also hit hundreds of game journalists’ inboxes. I’m grateful to them for their help.

Second, I was playing Deco Deck on the train while taking my kid somewhere, and she wanted to try it out. She is four, so she doesn’t fully get what’s going on. But she can enjoy the sensation of linking and unlinking the numbers, and watching them turn colors. And as I suggest connections, she is learning: now she knows what a flush is. I think she especially loves Deco Deck because it’s something her dad made.

Most of the other tablet games that we’ve found for her are, frankly, crappy. There’s the awful critter one which really wants you to spend money on one or more of their in-game currencies. There’s the one that’s supposed to teach math, where getting the question wrong offers a more fun animation than getting itt right. Also, one of its subgames is supposed to teach something about even numbers or division, but actually just teaches trial-and-error. Oh, and it had a gratuitous Christmas thing. I’m an evangelical atheist. I don’t need my kid being proselytized to. Can’t we have math without religion? (I wouldn’t object to the existence of an explicitly Christian math game, but I also wouldn’t get it for my kid).

Oh, and then there’s the one that’s supposed to teach reading, where after every lesson, no matter how badly you do, you get a sticker which you then have to place in your sticker book. Sticker book? Who needs a fucking sticker book? Reading is the key that opens the world of books! You don’t need a sticker: your reward is that you accomplished the task. You learned that C makes the sound at the front of “cat” (it’s always “cat”. Always.) Also, it doesn’t do voice recognition, so it can’t possibly teach reading, and also also some of its early tasks are timed, which makes no sense at all for a tiny kid first learning a skill.

And there’s another that has a bunch of different subgames, but one is so much more fun than the others that they have to gate it: you have to play a bunch of the less-fun games before they let you have one go at the fun one. Their actual reason is probably that the fun one is this: you draw on an egg, and then the egg hatches into a critter with your drawing mapped onto its skin. Then they have to store that critter and display in your menagerie, and they don’t want to use up all of your storage space. But that’s not the right solution: the right solution would be to have a hard limit on the number of critters. Then either allow re-coloring an existing critter, or allow you to send excess critters to a farm upstate.

So I am going to make a game that I want my kid to play. It’ll be between ten and twenty small games or other activities. They will mostly not be explicitly educational — no arithmetic worksheets or anything like that. But they will require cognitive skills. They will have intrinsic rewards: yes, there’s a fanfare sound when you solve one, but the real reward is that you did the thing. You accomplished something hard. So far, I’ve got prototypes of four of the games: a working memory game (the game gives you a sequence, you repeat it), an inductive logic game, a game where you move a chess knight, and a graph isomorphism game. What’s a graph isomorphism game?

Eleven hexagons, each with a bee at its center. Some bees are connected to others by lines.

I’m glad you asked. My original idea was that you would have two graphs, and you would have to prove that they were isomorphic by rearranging the nodes in one to match the other. (I had this idea because I was thinking about how the aspect ratio on modern phones is roughly 2:1 and I wondered what I could do with two squares). But when I showed the original concept to a friend, he didn’t really get it. And then I realized that I could just do direct manipulation, and that the concept was simple enough for a four year old.

One nice thing about building a game for my kid is that I have a tester right there, and she is very excited to try things out. So I get immediate feedback on what’s working. And also unsolicited advice: everything in the game has to be bugs, because once she saw the bees, she got excited.

Intrinsic (working title) is coming probably in late 2023 or early 2024. Tablets and desktop only.



from Hacker News https://ift.tt/RU6YfwE

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.