Honest opinion needed...

S

Schala Zeal

I've been trying to find a scripting language to integrate into a game
I'm developing in C and my choices are pretty much either Ruby or Lua.

See, game developers tell me Lua is the way to go for performance and
flexibility, but the C embedding API feels so low-level that it's
intimidating.

Ruby, on the other hand, has a much friendlier C embedding API and
doesn't look to need the developer jumping through hoops. However, some
of my friends develop their games on a program called RPGMaker and they
say the newer versions are awful mainly because of Ruby being the new
scripting language and on top of that, Ruby's been criticized for the
processing power.

I looked into Ruby 1.9 to find it adopted a more efficient third-party
interpreter and that code runs 15% faster... or something. Reading about
that restored my hope that I could use Ruby with no reprecussions. On a
hunch, I checked the latest RPGMaker's release date which was Dec 27,
2007.

A lot of concerns plague me about 1.9. I suppose the most important
would be does 1.9 redeem Ruby's processing efficiency? Version 1.9 is
fairly new, so I'm guessing RPGMaker had to be using 1.8 or lower, which
is the old engine.

The bottom line is would there be any negative impact if I were to embed
a Ruby 1.9.1 scripting engine in my game, in contrast to Lua?
 
¼

¼ÖèÉ

Limiting the use of dynamic features of ruby will lead to better
performance since ruby 1.9 uses YARV. But something like
multi-threading or resource-consuming will possibly bother you.

Above all, you should think over that whether a fully-featured
scripting language is really needed. I think building small
domain-specific languages for different aspects in your game will
reduce the complexity of development and will lead to better
performance.
 
S

Seebs

See, game developers tell me Lua is the way to go for performance and
flexibility, but the C embedding API feels so low-level that it's
intimidating.

It is intentionally low-level, but really, it's not bad.
The bottom line is would there be any negative impact if I were to embed
a Ruby 1.9.1 scripting engine in my game, in contrast to Lua?

The obvious thing, I think, would be the size and complexity. Lua's a
really beautiful simple language for the kind of thing it's trying to do.
Lua is very well suited to being the scripting engine for a game; it's a
simple language with a small set of features (the entire LANGUAGE is
probably smaller than some regex implementations!) that are easy to get
used to. Ruby's a lot larger and more powerful... But frankly, a game
scripting engine doesn't NEED to be exceptionally powerful, it just needs
well-chosen primitives.

Background: I have written a couple of WoW addons in Lua, I've also done
various scripting for a couple of other games which used Lua. It really
is a very good fit for the problem space. I love Ruby, but I wouldn't try
to embed it in stuff; I'd write things in it, though.

-s
 
S

Schala Zeal

Well I mean I read chapters 24 to 29 of Programming in Lua 1st Edition
and I was like "oh my god..."
 
T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

I've been trying to find a scripting language to integrate into a game
I'm developing in C and my choices are pretty much either Ruby or Lua.

See, game developers tell me Lua is the way to go for performance and
flexibility, but the C embedding API feels so low-level that it's
intimidating.

Ruby, on the other hand, has a much friendlier C embedding API and
doesn't look to need the developer jumping through hoops.


Ruby has a C embedding API? First I've ever heard of that.

Lua is designed for embedding. Ruby isn't. That doesn't mean you can't
embed Ruby, but YMMV...
 
T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

Lua is designed for embedding. Ruby isn't. That doesn't mean you can't
embed Ruby, but YMMV...

As a follow up: Rubinius, an alternative Ruby virtual machine written in
C++, should be much easier to embed than the standard MRI interpreter.

It's not exactly "prime time" material for advanced Ruby applications but it
should certainly be enough to handle basic Ruby scripting capabilities in
another application.

I don't have specific instructions for doing a C embed of Rubinius but if
you hop onto IRC and hit #rubinius on irc.freenode.net I'm sure they'd be
willing to help you.
 
S

Schala Zeal

I took a look at Rubinus and it doesn't support Windows, my primary
audience.
 
T

Tony Arcieri

[Note: parts of this message were removed to make it a legal post.]

I took a look at Rubinus and it doesn't support Windows, my primary
audience.

Honestly if you're looking for a language which embeds easily into C/C++
programs I think Lua is the way to go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top