Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to move into some game development, but the only language I know really well is Ruby. Most of what I have read seems to point towards lower level languages like C++ for game development, or languages for specific frameworks like C# for using XNA. Does anyone have any experience using a language like ruby for game development? If so, would you advise for or against it?

share|improve this question

closed as not constructive by Sean Middleditch, jhocking, John McDonald, Anko, Josh Petrie May 24 '13 at 14:48

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

I've not touched Ruby myself (it's on the TODO list), but a friend of mine developed a rather nice version of Berzerk using Ruby and Chingu, so it's certainly capable. – Muttley Sep 5 '10 at 11:07
up vote 43 down vote accepted

I have no preference towards Ruby (or Python), I'm a Java person myself. But UnknownDevice's answer about how Ruby is somehow "not really for games" and Python is, frustrated me. I do hope he will clarify.

I know Pygame exists and has been around, and I recognize that Python has a larger userbase than Ruby. But to be honest, neither of them seems like a language "for games". Neither does Java, and that's my game programming language of choice. (and when I say "of choice", I do mean by choice, not because it's what's taught in school or because it's something I "know"). And really, what is a language "for games"? Well, speed is a factor, and obviously it must have libraries for graphics and other game systems (audio, input, etc).

As far as speed goes, it seems to be a tossup between Ruby and Python. Do some searches and you'll quickly find benchmarks and arguments for both sides of the spectrum, and various configurations which put one or the other ahead. Python with something called "Psycho" seems a popular speed demon compared to Ruby, yet regular Python seems to be a bit slower than Ruby. In the end, if you're choosing such a high-level language you're obviously not concerned with native speeds anyway; go with the language you know best. And obviously you know Ruby best, so I encourage it!

The other factor is whether the technology is there to create games; whether it can support drawing to the screen and collecting input and playing audio. Ruby can do all of these. In fact there are a good number of options in this respect. There's a ruby-opengl package at RubyForge which will give OpenGL support to Ruby (or it might be included by default?). Alternatively, Chingu provides "lightning fast OpenGL accelerated 2D graphics!" according to its homepage; it builds extra features on top of Gosu, which you could choose to use if Chingu is too much for you. Or for 3D graphics, if you don't want to use ruby-opengl, try G3DRuby, "a very clean set of wrapper classes for many of the more advanced OpenGL features". There's even Rubygame, which I can't find much information on but it claims to be "a cross-platform multimedia library" and given the name, must have emphasis on game development. If you are familiar with the popular SDL library for C++, there's Ruby/SDL or RUDL, both of which are Ruby wrappers of SDL. Or if you prefer the newer, more object-oriented SFML, it is also available for Ruby!

There is no reason that Ruby should be less of a game programming language than Python; if there is one, I'd really like to hear it so I can argue against it. If you feel most comfortable programming in Ruby, and you are aware of the pros and cons compared to other popular languages, then by all means you can certainly develop games in Ruby!

share|improve this answer
+1 but you should add something about the limitations of usage on some languages on proprietary platforms like consoles... (hardware and constructor-policy limitations) If the home-made games are done for training for getting a job in the industry, then using Ruby for the game itself will not really help on this side. For desktop games however, "why not???" – Klaim Sep 11 '10 at 21:00
@Klaim I would argue that it is becoming less relevant, and I will be interested to know the language used for consoles of the next generation or perhaps the one after that. It's possible that they will continue to be developed with C++, but I personally believe it highly likely that they will progress towards higher-level languages. Android development, for example, is in Java; not that Android is a game console at all. But perhaps a hybrid language like Go will rise to be the new popular language in a console generation or two. – Ricket Sep 11 '10 at 22:09
I agree on the principle, and maybe Go or D an achieve somthing on this side. But I think only system language can be "standard" in this industry. However, I'm talking about the industry, not the indie side of the video-game domain. I think if you go your own way (not a salary of a big established company) then you have the chance to use whatever you want. But you still need to use the tools asked by constructors when you want to do something on anything other than console. Phones use Java but a lot of C++ is used on more performance-needed applications, on those same phones. – Klaim Sep 14 '10 at 11:21
In fact I think that as the video-game industry is slow to adopt even the current standard C++, theres good chances that you'll have to wait a lot of years before having anywthing other than C++ on consoles. A shift in way constructors and developers work might happen but it's not really easy to imagine from today. – Klaim Sep 14 '10 at 11:23
I'd just add that there are many types of games where maximum performance is not an issue. Of course, while making new Crysis you will want to squeeze every single frame from it, but there's plenty of games where you don't have to. And working on such games, you might need few other languages as well (shader languages for example, games like Civilization 4 & 5 rely on scripting languages too). – sm4 May 24 '13 at 0:30

The URL is probably a bit of a spoiler.

tl;dr: the naive garbage collector is a real problem.

share|improve this answer
Very informative! Can a Ruby expert comment on whether this is still applicable today? The article is dated January 2009 and I wouldn't be surprised if a lot has happened since then. edit Okay, I just found an article dated September 3 2010 which hints that indeed this is still the case today, saying "the Ruby garbage collector was not meant to be run" - interesting! – Ricket Sep 6 '10 at 3:24
Ruby's garbage collector is mark-and-sweep, but in the case of cycles, so are Python and Lua (in fact on a Python game I worked on we had to delay GC for exactly that reason). I have not done benchmarks, but perhaps Ruby's is just incidentally slow rather than fundamentally slow. I don't see that as a hugely compelling reason to avoid Ruby, especially if you are talking about building games entirely in Ruby as the questioner is. Just disable GC until some appropriate time. – user744 Sep 6 '10 at 10:03
It has been a while since this was posted, but check out this interesting article.… It's about the Garbage Collector in Ruby 2.0. Here is a keynote by the GC builder This video, by the time Ruby 2.0 comes out, will probably be 1.5 - 2 years old, so it's possible that many more performance and GC improvements have been made. This might make Ruby more viable to use for more object heavy games. I certainly hope so! I believe Ruby 2.0 comes out in 2013. – Michael van Rooijen Sep 27 '12 at 16:31
There's also VMs other than MRI that support different garbage collection systems, including the new mruby from Matz himself that includes an incremental garbage collection system. So far, mruby is shaping up to be a great choice for games. It even works on iOS and Android! – Stephen Belanger Oct 30 '12 at 20:05

There's no reason why you can't. As long as there's multimedia support for a language, then it's gamedev material. Heck, a large proportion of one of the Rollercoaster Tycoon games was done by hand in ASM.

share|improve this answer
You're kind of contradicting yourself. "handcoding the game in asm" is the exact opposite of "coding the game in ruby" or some other really high level language. – bobobobo Nov 14 '12 at 4:22

While I'm not familiar with a lot of the deep spec work surrounding Ruby, Enterbrain created the game making programs RPG Maker VX and RPG Maker XP that use game scripts based off Ruby:

This was actually my first dive into the language. As most people said, you probably won't get the high performance of other languages, but if you're looking to start a 2D RPG (or other 2D game, really), it's probably one of the most sophisticated game editors out there to help.

share|improve this answer

It depends what type of game you are interested in writing. I've used ruby to write AI clients for several games, including Diplomacy, poker, and Lost Cities. I find it's a very friendly language for quickly experimenting with different concepts. On the other hand, I wouldn't want to use it to write my real-time shooter - it just won't have the performance I need.

share|improve this answer

Your question is too general. Do you want just to write some computer game as a hobby project or do you want to get into indie/professional game development? Will it have graphics? On which platforms is it supposed to run?

In general, Ruby is suitable for hobby projects (BTW my favourite Ruby game is Ruby Warrior) and for the development of web-based games like Farmville. There's even certain demand for such programmers, try to google something like: "ruby programmer social game".

On the other hand, if you want to develop desktop- or mobile-based games with graphics, Ruby is not the best option. Consider:

  • Javascript library supporting Coffeescript (its syntax is very similar to Ruby)
  • Python - very similar to Ruby, better game libraries
share|improve this answer

Don't expect to write highly-performant, professional, commercial, 3D games with Ruby, but Ruby is a great language to use when learning game development concepts.

Gosu is the most popular (and actively maintained) library for writing 2D games in Ruby. It has an underlying C++ library that it uses to improve performance and interact with the underlying display rendering libraries like OpenGL.

As far as performance goes, the "default" Ruby implementation (MRI) will work fine (I suggest the latest Ruby 2.0 for best performance) but there are alternative implementations that have native threads and alternative garbage collection algorithms such as Rubinius, JRuby, etc. If you're making use of threads, you may want to try Rubinius, otherwise MRI Ruby will work just fine.

share|improve this answer

Ruby is a nice language, but it's not really for games to be honest. If you don't want to use C++ but want something like Ruby check out Python. For a good Python framework you should check out something like

share|improve this answer
... or – Ian Schreiber Sep 5 '10 at 17:39
This is nonsense. Ruby is no less of a language "for games" than Python. – Ricket Sep 5 '10 at 19:44
... nonsense. You might as well say that Lua is not for games. – Kornel Kisielewicz Sep 5 '10 at 23:07
Is there a ruby equivalent to pygame? I wouldn't say one language is more suited than the other. But it might be reasonable to say that python has better game libraries and gamedev community. – deft_code Sep 5 '10 at 23:50
I have a feeling that there's an SFML port to ruby. – The Communist Duck Sep 7 '10 at 18:54

I said Python because it has a bigger userbase and more choices when it comes to frameworks/libraries for games development. Its pretty obvious that this person has no experience in games development so it doesn't make sense to me to recommend that they use something like Ruby just because it's possible.

When I work on games I use C++ with Lua, I don't go off and write my game in Visual Basic just because it has media support. I'm sure everyone here has heard someone say certain tools for certain jobs. I'm sure you can hammer a nail with a shoe, but why would you do that when you can use a hammer.

share|improve this answer
C++ is a nice language, but it's not really for games to be honest. If you don't want to use assembly but want something like C++ check out C. For a good C framework you should check out something like (okay it doesn't quite work because C++ is backwards compatible but you get the point) – Ricket Sep 6 '10 at 3:20
Lol no I don't get your point. Honestly I don't really care what you're saying so don't bother replying to me. I'm just trying to help someone out, not argue about the legitimacy of a programming language. – UnknownDevice Sep 6 '10 at 4:21
His point is that your original answer had absolutely no substance with regard to the question asked. You assert that Ruby is "not really for games," but that's ALL you say. There's little value in that. As for why OP would want to use Ruby, it's quite clear: it's "the only language he knows really well." That's not at all the same as "just because it's possible." – Neverender Sep 6 '10 at 4:45
@Neverender, that's not entirely true. He did make the argument that Python simply has a bigger userbase and more libraries already completed for game development. I believe these are legitimate observations to make when giving advice to somebody who has no experience in game development. – Zach Conn Oct 20 '12 at 21:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.