You could write your next indie game with Crystal

by Alan Willms

Many rock crystals

One of the things that always set me apart from game development was the complexity of most compiled languages. C, C++, C#, they all seem to be the most used programming languages in enterprise game development, but they are too verbose and complex compared to scripting languages I use daily.

There is a lot of visual game development tools like Unity3D, GameMaker, Stencyl, etc., but sometimes you want fine-grain control over how your game behaves.

Since I just intended to play around making games, I started writing them in Ruby, because it’s a pleasure to write Ruby code and it was enough to grasp the basics of game development.

I used a library called LibGosu, which was ported from C++. It is pretty straightforward, has a great community, but… Ruby is slow. It was not meant to make games. When I started taking it serious, I could not afford to use Ruby anymore.

Fortunately, a few months ago I heard about a new programming language (still in alpha stage) called Crystal. Crystal allows us to write fast and compiled applications with a beautiful Ruby-like syntax!

Since Crystal allows writing bindings to C libraries, Oleh Prypin wrote them for a very popular game development C++ library called SFML (Simple and Fast Multimedia Library), and called it CrSFML (Crystal SFML).

Through CrSFML you can write your own games with no engines and no complexity and still have a pretty performant game while having a lot of fun while coding it!

Look how simple it is the source code of this Tetris clone written in Crystal:

[Source code: https://github.com/BlaXpirit/crsfml-examples/blob/master/tetrominos/tetrominos.cr ]

If you wanna learn more about Crystal, check their website. If you already know Ruby, it will be pretty straightforward.

Then you can jump to CrSFML tutorials and check its examples to start writing your next great game!

Have some fun!