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:
yesyesnononoyesyes
Suggest an update

Comments

Don't mean to rant, but if RUDL (rudl.sourceforge.net) already exists - another "pygame inspired Ruby library" - why create another one? Or is there something that sets this library apart?
Re: rubygame posted by anonymous on Jan 3 2006 2:48 PM
Yes RUDL already exists and so does RubySDL, which is at least in use by one game. The author of Rubygame was not happy with the API or code for the preexisting Ruby SDL bindings so he made another one with (for him and for me) better API and better code. That's FOSS for you.
Re: rubygame posted by ayqazi on Jan 4 2006 1:13 PM
As I asked - what is the difference? I'm a Ruby/SDL developer using RUDL, and if this new API offers something different, something better, I'd like to know.
Re: rubygame posted by anonymous on Jan 4 2006 3:29 PM
You have a sprite class and group class to group and manage sets of sprites, update all sprites in a group at once for particular evens and so on. Just read the documentation on Sprite, Sprite::Group, the methods kill and alive? then go to Pygame and read the Line by Line Chimp tutorial (under documentation, not the tutorial category, bad reorganization) you'll get the idea quick.
Why rubygame. posted by jacius on Jan 4 2006 7:25 PM

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. ;)

Re: Why rubygame. posted by ayqazi on Jan 5 2006 2:04 AM
Rubygame seems to incorporate ideas from Kyra (http://www.grinninglizard.com/kyra/) in terms of sprite management - have you had a look at it?

What about a GUI toolkit - that's something missing from RUDL.
Re: Why rubygame. posted by ayqazi on Jan 5 2006 2:07 AM
What I meant to say was, Rubygame seems to have features similar to Kyra (it'd be great if you could edit your own posts - bobz, you listenin'?)
Re: Why rubygame. posted by jacius on Jan 5 2006 8:38 AM

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.

Re: Why rubygame. posted by anonymous on Apr 14 2006 12:55 PM

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).

Re: Why rubygame. posted by anonymous on Apr 24 2007 10:58 AM
Why "reinvent"? Its using SDL. SDL is the most used game library.

Name some Tk games ;)

Any further questions?

Re: Why rubygame. posted by anonymous on Apr 24 2007 5:19 PM
right here: wiki.tcl.tk/898 there's a bunch more on other pages of that site (and other places too)

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)

Re: Why rubygame. posted by anonymous on Nov 21 2007 11:47 PM
"Personally, I recommend Tk (see Ruby/Tk) because it's natively implemented on every platform"

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)

Re: rubygame posted by anonymous on Mar 3 2008 3:33 PM
"pygame inspired Ruby library"

So uh, "Pirl"? :P

Hi Do I have to lnow a lot about programming in order to be able to use Rubygame?

Thanks

Re: How much do I have to know? posted by jacius on Jan 5 2006 10:32 PM

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.

Are there any example of programs that have been written using rubygame? This would help understand what it can do, and (if they're open source) help with the intended programming model.
Re: Any example games? posted by anonymous on Nov 21 2007 11:45 PM
Currently, not really as far as i know, at least no bigger games (there were a few small ones some time ago... one asteroid shooter one, then another one where you flew through some 2D map and had to avoid the border or your ship is destroyed...). Personally I would like to propose a wrapper with "common" or "syntactic sugars" to make it easier for people to create games, but I think jacius is often busy so community would need to step in for this first (second) step.

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)

Nobody has rated this even thought it is a pretty nice library.
So how seamless is the OpenGL integration? Do I have to use OpenGL models, or can I make a 2D game using their 2D game classes and then flip a switch to say "now use OGL to handle the 2D sprites"?

Log in or register to rate this game or post a comment.