Skip to content
Fernando Guillen edited this page Jul 25, 2024 · 3 revisions

Welcome to the fantasy wiki!

This is a comprehensive tour guide for the awesome library for building games in Ruby fantasy.

The history

Back in 2020, I was very active in introducing young children to programming. I started with a friend's 12-year-old son. I soon realized I enjoyed it and saw other children in my network who had a genuine interest in getting into programming. At some point, I had programming lessons on my calendar several times per week.

What better motivates my students than teaching them to build their own video games? Looking around, I found a fantastic book with nice projects and a very well-structured, "Computer Coding Python Games for Kids" by Carol Vorderman. I fell in love with it. And I used it for my first classes. Sadly I was not able to fall in love with python.

I tried; I know it is a great language, used and loved by millions of great developers. It doesn't click to me. And I felt it was affecting my attitude as a mentor.

Why not use my very loved Ruby to inspire my students with its incomparable and sweet mode of expressing code? And I moved. I did some research about what libraries and toolkits were popular and community-active, and, of course, I bumped into the popular Gosu. Gosu is a robust toolkit library for building "windows with graphics and sounds" in Ruby.

I tried. And again it didn't click. I did some projects. I used it in my classes. It didn't work. It didn't work because it is not a game toolkit. It has the basic like window, sprites, keyboard events, sounds, ... but there are many things missing: Timers, Collision Detection, UI Elements, Scene Management, Camera, Tweens, Animations, Gravity, Tileset, ....

These are indispensable elements to build the most basic game. When I was in my classes and we need the character to collide with a wall we found ourselves going through very complex (and boring) logic for a young person with a very short attention span. Implementing collisions, or a "Play" button, or changing to "Game Over" scene, or "Scroll" is not something that could capture the attention of my students. They wanted to shoot bullets, to see the character jump in a platform, to see the screen shaking on impact. To use images and sounds without having to go through boring documentation pages. They wouldn't say it this way, but what the wanted was a cool DSL.

A collection of utilities that encapsulate general videgame features. With a friendly and intuitive API. With an easy and accesible documentation. And great examples to use from simple to deep and ellaborate.

There are a few alternatives to Gosu. The most prominent is Ruby 2D. And it goes a step farther, it offers a much cleaner and intuitive API and a beautiful and easy to follow documentation. It also offers some extra components like Tileset. And it is great but still you are in your own if you have to implement basic game features.

My students needed something on top of this. They needed to write a simple game in a day. And grow from there, day by day, focusing in the game mechanics and not in recursivity, algorithms and performance. They would have time for this latter, when they get frustrated because high level abstraction layer don't do what they want. But for the moment the frustration resiliant level is too low. I offer thanks from here to the BASIC language to support me in my firsts steps. If I would have to start with "C" I don't know if I would have pursued in my interest for programing.

The idea of building a DSL-like wrapper on top of one of these 2D Ruby libraries was born, it was a need if I wanted to not lose my students enthusiasm, maybe for ever.

'Ruby in Fantasy' (aka 'fantasy') is build on top of Gosu. It is a big dependency, and the hard work is done by this library. 'fantasy' just offer the sweet and the lemon so we have a nice sirope.

:)

Clone this wiki locally