Ruby

From GDWiki

Jump to: navigation, search

Contents

[edit] About Ruby

Ruby is an Object Oriented Scripting language developed in Japan by Yukihiro Matsumoto. It was first released in 1995, but for a long time it was mostly used in Japan, and even today a good part of the active developer community is based there. Recently, interest for the language has picked up internationally, one main reason being undoubtedly the MVC framework Ruby on Rails.

The Ruby syntax is somewhat derived from Perl and Smalltalk, and the semantics of the language are easy to understand and use. Some nice features of the language:

  • Everything is an Object
  • Easy to extend existing library classes, including monkey patching, allowing arbitrary maniuplation even of core libraries at runtime.
  • Good string and file manipulation functionality, although not to the (almost perverse) extent offered by Perl.
  • A lot of extensions are provided as so-called "gems", which is also the name of a package management system tied into RubyForge. The system enables automatic dependency and version management for installed extensions.

[edit] Extensibility and Interoperability

Ruby can also be extended through a C API, and it can be embedded into C programs.

There is also a fully functional implementation in Java, called jruby, which also provides a mapping of Java APIs to Ruby, so it is easy to e.g. use Ruby as a scripting language for Java programs. The interface goes so far as to map properly named getters and setters to Ruby attributes.

For interoperability with .NET, the IronRuby project at Microsoft is aiming to provide another implementation that should be compatible with most parts of Ruby 1.8.

[edit] Game Development Aspects

If you plan to use Ruby for game development you might also want to consider Python. Both languages have up- and downsides, so choose with care. The only obvious downside to Ruby is its execution speed, which in version 1.8.x is still slow compared to competing languages; however, prototypes of Ruby 2, currently being released as version 1.9, show performance improvements in some critical areas.

[edit] Related Links

[edit] Extensions and Libraries

The RAA offers, among other things, two different SDL ports, OpenGL bindings, a Ruby-game module, and some games (but there aren't any really interesting yet).

[edit] Tutorials

[edit] Ruby game programming

  • Rubygame - Pygame for Ruby
  • Ruby/SDL - SDL Binding for Ruby.
  • Rubyscript2Exe - Allows users to run your game without needing Ruby. Creates a single executable for your application (Windows, Linux, Mac). Tests indicate that this works fine with Ruby/SDL.
  • Gosu - Multi-platform game development library for Ruby and C++.
Categories