The Bookcase: A Journey of a Lifetime


“The Bookcase” arose out of an experiment in the study of emergence. I had recently come across Conway’s Game of Life and was fascinated by the idea that the interaction of a few elementary rules could result in such complex behaviors. I was already aware of this idea when I started studying Game Design from some exceptional books (Game Design Workshop, Challenges for Game Designers, and Rules of Play) and from MIT’s Game Design course on OCW. I tried a few different ideas and concluded that for an effective emergent system, I would require a set of objects with some unique properties. A robust rule system would be critical to the design of this emergent system. The result was that I had squares which were abstractions for the object. These squares had 4 different colors and were marked with numbers 1 through 3. That meant that I had 12 unique combinations of objects. Next, I needed a method of interaction with the system. I was exploring the use of dice in games that day, and felt that they would add a nice layer of probability. A single dice was not giving me enough combinations, so I decided to use two. After some trial and error, I finalized the following: the game had 20 objects each in 6 rows (for the dice). The second dice would be use to ‘move’ the objects around. The game would be played between two people and only one could win. The players needed to be able to store these objects, so I added 2 more rows (1 for each player) with the capacity of 20 objects each. This 8 by 20 grid formed my game state representation. I decided that any player who collects 15 objects ofbefore the other would win the game.

Coming up with the rules was relatively harder. I experimented with quite a few rules but none of them was robust enough— the rules kept conflicting with each other. Players took turns to play and on every turn they were allowed to throw the two dice. The dice would decide the number and position of the objects that could be moved. A good idea, then, was to come up with rules that impact this ‘movement’. I did not want to have rules that made players skip turns, because something about the skip turn rule feels a little unnatural. The rules I came up with were: If a player has 5 objects of the same number, they can make their opponent keep back 2 objects of either the same shape or the same colour. The player has the choice of selecting which color/ shape that would be. The second rule is that if a player has 10 objects with the same number, they can change the colour thier opponent is collecting to one of their choice. However, this can only be done by a player once per game. 

After I had designed these mechanics, I build a very simple prototype. I used Microsoft Excel to emulate the objects and quickly wrote a script in python to mimic the throw of 2 dice. Then, I put my game to test. Calling in my best friends to play (whom I trust to give me an honest feedback), I was overjoyed to observe them entirely engaged with the game. They were visibly excited and were talking animatedly, so much so that I had to intervene at one point where they got into trash-talking each other! I had read about letting players play while observing them play and I did the same— I made notes of things that they had problems understanding, or points where they argued about the rules. Taking their suggestions and my own inferences of things that were a design problem, I went back to fine-tuning the mechanics. All of this took me around 2-3 weeks. 

Then, I decided to build this game for mobile devices. I had a little experience using Unity before attempting to start The Bookcase: I had previously attempted to recreate an Indian game called “Chiddi Udd”, which is a game intended for children and is mostly a game that tests players’ reaction time. I had built the game system (but with my poor 2D illustration skills, I didn’t do a great job of making the game visually appealing). So, I decided I would make a quick prototype of the game in Unity.

From that point on, I started working on some features I felt would add great value to my game. It was a 2 player game, so I had to add multiplayer functionality. However, I also felt that in order to help players get started, I would need to build for them a single player version of the app. This, in my view, would help them understand the rules of the game and would also make it engaging for players without a reliable internet connection. However, this feature was much more complex than what I had imagined it could be. 

I understood that the program that played against the player would need to be engaging, but in order for it to engage the players, it needed to know how to play the game. This was a non-trivial task. I went through quite a bit of literature and research on how other games did this. The Bookcase is a zero sum game, (which means that if one player wins, the other loses), similar to a chess game. So, that’s where I started. Having a Zero sum game made things easier. With The Bookcase, as with chess, the deeper the strategy, the greater the chances of success. Every ply a player thinks about the various moves their opponent can make for each of their move. In a zero sum game, the best move for the player would be the one which forces their opponent to take the worst move. The more plys the player considers, the better their move turns out. However, with any game which supports emergence, every ply, the number of different states the player needs to explore increases exponentially. This puts a computational bound on how deep the player can go in considering the moves they can make. I used this concept (also known as alpha-beta minimax), and then a little pruning of possible states. (Alpha-beta minimax with pruning). However, in order to know which states to consider, it needed to be able to ascertain a value to the states. For example, when we play a game of chess, a human player understands that the opponent’s queen near their King is probably a bad state to be in. How could I do that for my own game?

This was a really complex task. It involved coming up with a system that could somehow understand the values of the states based on the features of the state. It would be impossible to individually tag each of the states (there are nearly infinite number of states in the game). So I trained a reinforcement learner which learnt how to rate the states after playing many games against itself. The program was told which legal actions it could take, and at the end of the game, whether the program had won or not. Winning gave the program a positive reward, while losing gave it a negative reward.  I never knew making such a program would be this hard. Not knowing that this was such a hard problem was the reason I was able to keep going. It took me a very long time to figure out how to build such a program, but it was worth every moment I spent on it. 

Other than the AI, I also didn’t know how to make interesting graphics and interactive music. I learnt all of this while I was making the game. I learnt a lot about making 3D graphics, about the 12 principles of animation, about design and now I see all of these things around me in new ways. I am glad I was able to work on this project. 

Now it is available for you to play. There are still quite a few bugs. Perhaps I’ll write another piece about the kinds of problems that still persist, but until then you should be able to start playing. So, have fun playing!

Jivitesh DhaliwalComment