All Projects → andymeneely → Squib

andymeneely / Squib

Licence: mit
A Ruby DSL for prototyping card games.

Programming Languages

ruby
36898 projects - #4 most used programming language
dsl
153 projects

Projects that are alternatives of or similar to Squib

Marmoset
Marmoset is a single-player implementation of the card game SET.
Stars: ✭ 32 (-96.24%)
Mutual labels:  game, card
Shots
🥃 A party drinking game that lets you learn more about your friends: Provider + Hive + swipeable_card
Stars: ✭ 89 (-89.53%)
Mutual labels:  game, card
Svg World Map
🗺 A JavaScript library to easily integrate one or more SVG world maps with all nations (countries) and second-level political subdivisions (countries, provinces, states).
Stars: ✭ 38 (-95.53%)
Mutual labels:  game, svg
Mage
Magic Another Game Engine
Stars: ✭ 1,180 (+38.82%)
Mutual labels:  game, card
Deck Of Cards
Deck of Cards (old version)
Stars: ✭ 2,684 (+215.76%)
Mutual labels:  game, card
Gh Card
GitHub Repository Card for Any Web Site
Stars: ✭ 1,154 (+35.76%)
Mutual labels:  svg, card
Card Game Simulator
Create, Share, and Play
Stars: ✭ 87 (-89.76%)
Mutual labels:  game, card
Svg Snippets
🔰 A set of custom SVG snippets for Sublime Text 2/3
Stars: ✭ 50 (-94.12%)
Mutual labels:  svg, sublime-text
Searchstone
🃏 Hearthstone's cards search engine built with algolia instantsearch.
Stars: ✭ 117 (-86.24%)
Mutual labels:  game, card
Battle City
🎮 Battle city remake built with react.
Stars: ✭ 1,543 (+81.53%)
Mutual labels:  game, svg
Foda
You are at FODA source code. Play now for free
Stars: ✭ 92 (-89.18%)
Mutual labels:  game, card
Hearthstone Deck Tracker
A deck tracker and deck manager for Hearthstone on Windows
Stars: ✭ 4,496 (+428.94%)
Mutual labels:  game, card
Magarena
Magarena is a single-player fantasy card game played against a computer opponent.
Stars: ✭ 311 (-63.41%)
Mutual labels:  game, card
Vue Content Loading
Vue component to easily build (or use presets) SVG loading cards Facebook like.
Stars: ✭ 729 (-14.24%)
Mutual labels:  svg, card
Graphicsjs
A lightweight JavaScript graphics library with the intuitive API, based on SVG/VML technology.
Stars: ✭ 937 (+10.24%)
Mutual labels:  svg
Librg
🚀 Making multi-player gamedev simpler since 2017
Stars: ✭ 813 (-4.35%)
Mutual labels:  game
Shortstories
Interactive stories told through App Shortcuts and Notifications
Stars: ✭ 26 (-96.94%)
Mutual labels:  game
Js13k 2017
🖼️ Vernissage !
Stars: ✭ 26 (-96.94%)
Mutual labels:  game
Rott94
Rise of the Triad source port to SDL2, Android and WinRT
Stars: ✭ 8 (-99.06%)
Mutual labels:  game
Hcwiid
Haskell binding for CWiid (wiimote)
Stars: ✭ 7 (-99.18%)
Mutual labels:  game

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 2.5 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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].