Flexible game development library for Ruby
Rubygame is a cross-platform game and multimedia library for the Ruby programming language. It provides flexible high-level Ruby classes on top of SDL to make game programming fast and enjoyable.
Some of the features of Rubygame are:
- Works on many platforms and operating systems.
- Image loading in many formats.
- Scaling, rotating, and flipping images.
- TrueType Font and SFont (bitmap font) support.
- Keyboard, mouse, and joystick input.
- Sound and music playback.
- Flexible sprite library for game objects.
- OpenGL integration for 3D hardware-accelerated graphics.
License: free
Requirements:
- Ruby 1.8 or JRuby 1.3
- SDL 1.2.7
- SDL_gfx 2.0.13 (optional)
- SDL_image 1.2.3 (optional)
- SDL_mixer 1.2.7 (optional)
- SDL_ttf 2.0.6 (optional)
| Sound: | Play in X: | Play in Console: | Multiplayer: | Network Play: | 3D Acceleration: | Source Available: |
|---|---|---|---|---|---|---|
| yes | yes | no | no | no | yes | yes |
Submitted by jacius on 2006-01-01.

Hi, rubygame author here.
I've added a page to the website to explain precisely why I created rubygame when RUDL and Ruby/SDL already exist: http://rubygame.seul.org/faq.html. And because I created rubygame so I would have a library that I wanted to use, my reasons for creating rubygame are also reasons why a developer would want to use rubygame.
If, like me, you consider thorough documentation and a clean and simple API to be features of a library, then rubygame certainly has an advantage over RUDL in that regard. What's more, the base is now in place for new features to be written rapidly and integrated cleanly; unlike RUDL, I write as little C as I can get away with, so it's much easier to extend and improve the current code. (This also applies to game developers using rubygame—a lot of the classes in rubygame can be extended and tweaked easily).
The biggest "real" feature of rubygame at the moment is undoubtedly its Sprite and Group classes. Not only are they useful out of the box, but it is very easy to modify them to fit your game. (Perhaps "fit your game" is not the right phrase—a better one is "become your game.") They are currently equivalent (or perhaps even better than) pygame's Sprite and Group classes, but still have a lot of untapped potential over pygame's versions; and of course, neither RUDL nor Ruby/SDL has a Sprite class at all, so the advantage here is obvious as well.
So, to summarize, rubygame already offers a lot that neither RUDL nor Ruby/SDL have, and rubygame will only get better as time goes on. It would be great if you could give it a try. Well, I guess that's it for my sales pitch. ;)
What about a GUI toolkit - that's something missing from RUDL.
I hadn't looked at Kyra before now; but, rubygame's sprite management is based on pygame's sprite management, so it may be that pygame and Kyra have some sort of influential relationship. From browsing the web site, Kyra looks very interesting, so you may see some Kyra-like features inside rubygame in the future. :-D
I'll consider a GUI toolkit, but there are several issues to balance there: 1) it has to be easy to do the "normal" stuff (button, checkbox, etc.), but at the same time 2) it has to be abstract/flexible enough to create unusual/custom types of GUI elements to fit individual games. Because (2) is somewhat difficult, I'm tempted by laziness to say "Make your own GUI elements, and make them how you want them." But at the same time, I want it to be possible for non-hardcore programmers to use Rubygame to create simple games (think Pong) in as little as 10 minutes!
So, what I mean to say is, I'll weigh it out and find a solution that fits with the design principles of rubygame. GUI widgets could be done using Sprites (even with rubygame 1.0), so any GUI widget class I put in rubygame will just be to save game developers the time they would have spent making a similar class themselves.
If you want to discuss this much further, I'd like to recommend the rubygame-users or rubygame-dev mailing lists ( http://rubygame.seul.org/contact.html ), which exist for this purpose but are sadly underused at the moment.
Why reinvent a whole GUI framework? Save yourself some work and make use of existing ones.
Personally, I recommend Tk (see Ruby/Tk) because it's natively implemented on every platform known to man and there is lots of great documentation (see Perl/Tk and others).
Name some Tk games ;)
Any further questions?
nothing wrong with good old Tk, unless maybe your game is graphics/sound intensive (but then you might need to consider C/C++ anyway, for at least parts of it)
This is SDL, not TK.
Please keep your suggestions off when you do not understand this simple difference. (And besides that, Tk is in decline compared to Qt and Gtk)
So uh, "Pirl"? :P
Thanks
It's difficult to answer that question, because "a lot" is a very vague phrase; what is "a lot" for me will probably be different than for you. However, I'll try to give you an idea of what you should know to use rubygame. This is what I would consider a bare minimum -- the more you do know about programming, the better results you can get from rubygame, of course.
You should understand some concepts such as images (two-dimensional grids of colored pixels), keyboard and mouse input (e.g. when you press a button, a signal is sent to the computer telling which button was pressed), and animation (the illusion of motion created by showing images one after another very quickly, like a flipbook or a film).
Also, note that rubygame is a library, not a development tool ala Game Maker. This means that you will have to write some code in the ruby language. You should have at least a basic understanding of the language: variables; methods (aka functions); classes and instances; control structures (if, while, etc.); and other concepts. Learning these concepts may take as little as an afternoon of reading a tutorial and playing with irb (interactive ruby), and no more than a week of doing the above each afternoon. (I also think it's a good thing to know anyway, but I'm biased.)
You may be able to grasp the basics of writing a game with rubygame by studying the samples. In particular, I recommend studying the chimp sample along with this tutorial from pygame. This sample demonstrates a lot of the concepts of making games (including some more advanced concepts like sprites and object-based game logic), so if you can understand it, you are ready to make your own games. (The rubygame sample is a pretty straight port of the pygame version, so a lot of the explanation for the pygame version also applies to the rubygame version; any important differences are noted in the comments of the rubygame version.)
In the documentation for rubygame (which you can find on the website) I have tried to describe, wherever possible, what part each class performs in the whole of a game. However, it is not a comprehensive tutorial on the structure of games. You may need to read some introductions to game creation. In particular, you should understand the concept of a "game loop" (e.g. 1. read user input, 2. update game state, 3. refresh display) which is repeated many times per second.
To summarize, making a game with rubygame is easier than lifting a mountain, but harder than scratching your nose. I hope that helps.
Especially simple tasks which are often reused (collision, key events, moving objects, playing sound) could be put right into tutorial parts. I personally find to reuse those small components (in other widget sets for instance)