Opinions on using Ruby as a scripting language.

Started by
10 comments, last by -Datriot- 15 years, 8 months ago
I was thinking of implenting a scripting language for my project and I thought why not use Ruby? I have a lot of experience in Ruby so I wouldn't be required to learn a new language. But is it difficult to implement into an application? Is it slow? I thought I'd ask these questions to more experienced people to help make my decision.
Advertisement
I don't think there are many people here experienced with Ruby. I heard that it's quite hard to embed, which makes it much less attractive than Lua, Python, or gaming-specific languages.
I have just started looking into Ruby myself and am also planning on embedding it in a project if it meets my requirements.

I didn't find the VM to be particularly hard to embed ontop of a procedural interface. I've had a lot more problems with other scripting languages. I don't know how well you can embed it with C++ applications though.

I haven't had the chance to test the speed of the VM but it's not really known to be fast, so I wouldn't hope for any advantages in speed compared to other languages.
The only known success story was Enterbrain and the RGSS thing they did with Ruby. Both XP and VX in the RPG Maker series really did a good job with having a scripting language to make custom games with.

In short, because Ruby isn't a language that is able to make games, you can scratch THAT idea off the list if you aren't able to convert the language correctly.
Most likely the n00biest programmer out there. I need a website soon so that I can share my projects with you (when done with my projects).
You could make games for ruby... there are OpenGL bindings and the like.

As much as I like Ruby, I think you are fighting an uphill battle when you have so many python scripting resources out there.
Quote:Original post by thechocobohunter
In short, because Ruby isn't a language that is able to make games, you can scratch THAT idea off the list if you aren't able to convert the language correctly.


What the hell are you talking about? Your statement makes no sense.
Ruby sounds like a very heavy scripting language, unlike Lua and Python. Not very suited to be embedded into a game. If you just need to make cutscenes, triggers, or enemy AI, you probably don't need the ability to create classes and singletons.

In RPG Maker XP it was a good idea to embed Ruby because it is basically just an engine and the entire game is built on top of it in Ruby. If your project is similar (ie: just a base engine with drawing and audio functions), I'd say go ahead and use Ruby, otherwise, as much as I like Ruby, I'd consider something else.
Ruby is every bit as light weight perhaps even more so as python with its stronger support of functional programming. Its support of reflection + metaprogramming is what make it so powerful.

Doing a search on embedding ruby shows that it is not very difficult to embed ruby in C++. On .NET with IronRuby is trivial.

I think Ruby would make a great scripting language for games. It's not quite as heavyweight as some others have said, it's all based on how it's used.

The reason I say Ruby would be great, is because it's such a flexible language, you can bend it into acting as if it was *made* for your game. The syntax is also pretty flexible, so using some Ruby magic you can greatly simplify the interface and scripting syntax for designers (or other general non-programmers) to use.

I highly recommend SWIG (Simplified Wrapper Interface Generator) if your project is in C/C++. It makes integration a breeze, and even supports semi-transparent extension of C++ classes with Ruby classes, and vice versa (I say semi-transparent because this uses a pattern called Directors, which require a little bit of setup).

Here's a short tutorial for embedding C/C++ with Ruby (which should extend into other languages easy)

http://metaeditor.sourceforge.net/embed/
Quote:Original post by Bearhugger
Ruby sounds like a very heavy scripting language, unlike Lua and Python. Not very suited to be embedded into a game.

Have you compared the Python runtime with the Ruby runtime? Ruby was bigger the last time I checked, but not by an order of magnitude. It would be difficult to make the argument for a given situation that the Ruby runtime was too big but the Python runtime wasn't. Of course, both runtimes can be easily stripped down as needed.
Quote:If you just need to make cutscenes, triggers, or enemy AI, you probably don't need the ability to create classes and singletons.
Sooo.... no Lua or Python, then?

This topic is closed to new replies.

Advertisement