• Stars
    star
    912
  • Rank 50,097 (Top 1.0 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 10 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Ruby DSL for prototyping card games.

Squib Gem Version Build Status Build status Coverage Status ReadTheDocs BoardGameGeek

Squib is a Ruby DSL for prototyping card and board games. Write a little bit of Ruby, define your deck's stats, then compile your game into a series of images ready for print-and-play or even print-on-demand. Squib is very data-driven and built on the principle of Don't Repeat Yourself. Think of it like nanDeck done "the Ruby way". Squib supports:

  • A concise set of rules for laying out your cards
  • Loading PNGs and SVGs
  • Complex text rendering using Pango
  • Reading xlsx and csv files
  • Rendering to PNGs, PDFs, and SVGs (sheets or individual files)
  • Flexible, data-driven layouts in Yaml
  • Basic shape drawing, blending operators, gradients, etc.
  • Unit conversion
  • The full power of Ruby!

Squib is based on the Cairo graphics rendering engine, the library of choice for WebKit, Gecko, Inkscape and many, many others.

Check this out.

require 'squib'

Squib::Deck.new(cards: 2) do
  text str: %w(Hello World!)
  save_png
end

We just created a 2-card deck with "Hello" on the first card, and "World" on the second, and saved them out to PNGs.

Wanna see more? Check out the website: http://andymeneely.github.io/squib/

Installation

Squib requires Ruby 3.0 or later.

Install it yourself with:

$ gem install squib

If you're using Bundler, add this line to your application's Gemfile:

gem 'squib'

And then execute:

$ bundle

More info: http://squib.readthedocs.org/en/latest/install.html

Getting Started

After installing Squib, you can create a project and run your first build like this:

$ squib new my-cool-game
$ cd my-cool-game
$ ruby deck.rb

The squib new command will generate files and folders like this:

β”œβ”€β”€ .gitignore
β”œβ”€β”€ ABOUT.md
β”œβ”€β”€ Gemfile
β”œβ”€β”€ IDEAS.md
β”œβ”€β”€ PLAYTESTING.md
β”œβ”€β”€ PNP NOTES.md
β”œβ”€β”€ RULES.md
β”œβ”€β”€ Rakefile
β”œβ”€β”€ _output
β”‚Β Β  └── gitkeep.txt
β”œβ”€β”€ config.yml
β”œβ”€β”€ deck.rb
└── layout.yml

12 files

Learning Squib

Go read the docs!

Also:

  • The samples directory in the source repository has lots of examples.
  • Masters of the Heist is my own creation, and it was made with Squib. Go through the repository and watch how it evolved!
  • Junk Land is my own creation that's uses Squib for full-color rendering, and makes use of Ruby in a lot of interesting ways. The port is still in process.
  • Project Spider Monkey is another of my own creations. This one was started from scratch with Squib, but it's still in its early stages.

Staying DRY

Squib tries to keep you DRY (Don't Repeat Yourself) with the following features:

  • Custom layouts allow you to specify various arguments in a separate file. This is great for x-y coordinates and alignment properties that would otherwise clutter up perfectly readable code. Squib goes even further and has a special "extends" that works especially well for grouped-together styles.
  • Flexible ranges and array handling: the range parameter in Squib is very flexible, meaning that one text command can specify different text in different fonts, styles, colors, etc. for each card. If you find yourself doing multiple text command for the same field across different ranges of cards, there's probably a better way to condense.
  • Custom colors keep you from hardcoding magic color strings everywhere. Custom colors go into config.yml file.
  • Plus, you know, Ruby.

Docker

Want to run in a controlled environment? We've got a Docker image on DockerHub

Here's one way to run it. On the command line, go to the root of your repository. With these commands, we'll map the current directory to the /usr/src/app directory in the Docker image. When squib-in-docker read & writes files from there, it'll write it back out to your current directory.

Assuming you have a script called hello.rb:

On Windows:

docker run --rm -v "%cd%":/usr/src/app andymeneely/squib ruby hello.rb

On Macs:

docker run --rm -v "$PWD":/usr/src/app andymeneely/squib ruby hello.rb

This will create a folder called _output in your current directory and write the output of the script there.

We're still working on ways to customize your own Docker build (e.g. document building, custom fonts, etc.) with your own Dockerfile. Pull requests and ideas welcome!

Get Help and Give Help

See this page

What's up the with the name?

Truthfully, I just thought it was a cool, simple word that was not used much in the Ruby community nor the board game community. But, now that I've committed to the name, I've realized that:

  • Squibs are small explosive devices, much like Squib "explodes" your rules into a playable game
  • Squibs are often used in heist movies, leading to a sudden plot twist that often resembles the twists of good tabletop game
  • Squibs are also part of the Harry Potter world - they are people who are non-magical but wizard-born. Squib is aware of wizarding magic and comes from that heritage, but it's not magical itself.

More Repositories

1

attack-surface-metrics

Scripts for collecting metrics of the attack surface
Python
14
star
2

chromium-history

Scripts and data related Chromium's history
Ruby
11
star
3

project-timber-wolf

Masters of the Heist. A cooperative game for the tabletop.
HTML
10
star
4

game_icons

A Ruby Gem for accessing and manipulating artwork from http://game-icons.net
Ruby
9
star
5

git-churn

(ALPHA) A fast tool for collecting code churn metrics from git repositories.
Go
8
star
6

exam.typst

A Typst package for making exams
Typst
7
star
7

scripts-settings

My own Linux scripts and settings files, for public use
Vim Script
7
star
8

vulnerability-of-the-day

A pedagogically-curated collection of vulnerability demonstrations for undergraduate software engineering students
HTML
7
star
9

homestream

A simple Roku channel for streaming stuff from my home machine.
PHP
5
star
10

project-bolt-rats

Escape from Scrapland. A roguelike microgame for the tabletop. A Squib living example. Under development!
Ruby
4
star
11

dev-fortress-server

JavaScript
4
star
12

dev-fortress-client

JavaScript
3
star
13

Gimp-Scripts

Personal scripts for Gimp
3
star
14

swen331fuzzerCI

The CI configuration for the SWEN 331 fuzzer assignment.
HTML
3
star
15

Tomcat-History

An empirical case study of Apache Tomcat
Java
3
star
16

project-spider-monkey

An open source card game demonstrating Squib.
Ruby
3
star
17

httpd-history

An historical analysis of HTTPD and its vulnerabilities
Java
3
star
18

interactive_churn

Various socio-technical code churn metrics for Git
Ruby
2
star
19

vulnerabilityhistory.org

Every vulnerability has a story.
2
star
20

XohImNooB

Twitter bot of base64(sha256(awesomeness)
Ruby
2
star
21

tronxy-x1-notes

My notes for operating the TronXY X1
2
star
22

native-bindings

This is a collection of simple examples of Native bindings, collected for the RIT SE course Software Performance Engineering.
Makefile
2
star
23

developer-activity-metrics

Useful APIs for research in developer activity metrics
Java
2
star
24

linux-kernel-isolated-security-patches

Historical security patches for the linux kernel, isolated by CVE. For my graduate research.
2
star
25

cyclomancy

A cooperative tabletop game prototype
Ruby
1
star
26

andy-maven

Andy's Maven repository, when the central repository just isn't good enough.
1
star
27

sublime-squib

SublimeText snippets for Squibbing.
1
star
28

iconoclast

A collection game.
Ruby
1
star
29

gofirstdice

Simulation for "Go First" dice
Java
1
star
30

php-history

Scripts for the vulnerability history of the PHP Language
Java
1
star
31

sira-nlp

Code for the Natural Language Processing project in RIT's SIRA.
Python
1
star
32

card-shuffling

Card Shuffling research project
Java
1
star
33

developer-survey

Developer survey for perception corroboration study
Java
1
star
34

dnd-squibber

Some Squib scripts for building DnD encounters
Ruby
1
star
35

heist-legacy

The legacy version of Your Last Heist.
Ruby
1
star
36

attacker-behavior

Scripts to analyze penetration testing timelines to understand attacker behavior
1
star
37

collabcloud-public

A visualization of software development collaboration.
Java
1
star