Sunday, August 27, 2017

Is ruby a suitable language for game development?




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?



Answer



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!


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...