Building Games with Squib: Part 1, Setup

As board games rise in popularity, many new groups focused on creating board games are popping up. Luckily, instead of expensive tools like InDesign, or Windows-centric tools like nanDeck, there are a number of alternatives. One actively developed alternative is Squib, a Ruby DSL, and we’re going to be building a game with that.

To start, we need to have Ruby and Bundler installed. If you don’t have either installed, you can install Ruby by following the directions on the website. After Ruby is installed, run gem install bundler from the command line, and we’re good to go!

Now that we have the prerequisites installed, we need a game to build. We’re going to start simple by building a custom themed triangle deck, sometimes known as a Pairs deck based on the game by James Ernest and Paul Peterson. To understand what types of games work well with this deck, I’d recommend reading The Pairs Companion PDF


Squib has an excellent built in scaffolding tool. To use this, you would first run gem install squib, followed by squib init triangle-deck. This would create a directory with all of the files needed to start. But I find that generators can be confusing when learning a new tool, so we’re going to build up all the files manually.

To start, let’s make a directory for our game. Inside that directory, we’re going to make a number of files.

We’re going to be using Squib to create the files, and Guard to automatically generate them everytime there is a change, so paste the following in a new file named Gemfile:

1 source ''
3 gem 'squib'
4 gem 'guard-rake'

Now that we have the libraries the project will use set up, we need some cards. To represent the data inside the cards, make a file named cards.csv in the same directory.

Triangle Deck cards aren’t very complex, so we only need one field - number, and fifty five rows. However a triangle deck has many duplicates, and we shouldn’t need to type them all out. Luckily Squib includes a Qty feature. Instead of typing out fifty-five rows, we can type just nine if we add a Qty to each row. Copy the following into cards.csv:


To Squib, this represents a deck with one “1” card, two “2” cards, and so on. Exactly what we want.

Now, we need to tell Squib how to interpret this data. To do so, we make a cards.rb file, and paste the following:

1 require 'squib'
3 cards = Squib.csv file: 'cards.csv'
5 cards['number'].size) do
6   text str: cards['number'] 
7   save format: :pdf
8 end

In this file, we:

  • Load the Squib library
  • Import the cards.csv file
  • Create a new Squib deck as big as our cards CSV
  • Display the value of “number” as a text element
  • Output them to a PDF.

It’s worth noting that the csv function is what interprets the Qty attribute of the CSV. So after line 3, the value of cards is:

  number => ["1", "2", "2", "3", "3", "3", ...]

As a result, when we call cards['number'].size in line five, we’re correctly telling Squib to create a deck with 45 cards.

Finally, we need a Rake file. This is the file we’ll use to actually load our cards.rb file. Create a file called Rakefile and paste the following into it:

1 task default: [:cards]
3 task :cards do
4   load 'cards.rb'
5 end

We’re ready to make a deck! Run bundler exec rake, and the folder _output should now exist. In it, we have all 45 of our cards in a PDF titled output.pdf!

We have a very basic deck, but it’s very boring. Now it’s time to add some visuals.

For that, head to Part 2