Lua or Ruby for RPG

Pages: 12
closed account (N36fSL3A)
I want to know which I should use in a RPG - Lua or Ruby.

I don't want to make this into a language debate or anything, but I just want opinions. (The best way to avoid this is to refrain from replying to a previous reply).

I know Ruby fairly well, I've been using it since I was ten with RPG Maker.

Lua on the other hand, I like a lot, equally to Ruby. I don't know very much of it though.

Whichever the one I pick, I'd like a way of knowing how to "compile" it to an unreadable source file to avoid cheaters from breaking the game.
closed account (N36fSL3A)
I still need a way how to 'compile' the source files but I personally decided to use Lua as on Google people bash Ruby for it's slowness with games.
Last edited on by Fredbill30
For games it is usually recommended you use Lua or Python for scripting. As for compiling, lua should come with a compiler...luac I think it is, but like I said it is part of the entire Lua package.
closed account (3qX21hU5)
Any language will work, just use whatever language you feel most comfortable with.

As for speed issues, they are usually moot. Unless you are making professional level games you won't need to worry about the speed of a language. For most indie level games speed is not really a critical concern and basically any language whether it be Ruby or Lua will work for you.
closed account (N36fSL3A)
BHX what I mean is like how AAA games compile their graphics, I want to compile the source.

Zereo, I know this but this guy said he had this game running at a 60 fps cap and he said every second the game ran it would loose some FPS.

My game runs at only 20 fps but I don't know if it will be the same.

I really would prefer Ruby over Lua but people bash it for making them lose FPS each frame so I'm starting to doubt it.
Had to double check the commands and everything. To compile Lua it is basically the same as the GNU Gcc/Gpp compilers:
Simple Lua Script
1
2
3
print("hello")
who = "Lua user"
print("hello" .. who)

Commands and output for compiling and running ($ is just the prompt):

$ ls
test.lua
$ luac -o luatest test.lua
$ ls
luatest  test.lua
$ lua luatest
hello
helloLua user

closed account (N36fSL3A)
That's not what I mean. I have no problem with compiling, but I'm intergrating it with C++ and I don't want users to edit my source files, which will be read from the C++ .exe
closed account (3qX21hU5)
Zereo, I know this but this guy said he had this game running at a 60 fps cap and he said every second the game ran it would loose some FPS.

My game runs at only 20 fps but I don't know if it will be the same.

I really would prefer Ruby over Lua but people bash it for making them lose FPS each frame so I'm starting to doubt it.


As before use Ruby if you are more comfortable with it. As long as you are doing it right you should have no performance problems. He most likely didn't code the game right.

You have to realize people will always play favorites with they favorite languages. There will always be people that say Ruby sucks for this or Lua sucks for that. Ignore them and use what you feel like.

That's not what I mean. I have no problem with compiling, but I'm intergrating it with C++ and I don't want users to edit my source files, which will be read from the C++ .exe


http://stackoverflow.com/questions/239315/how-to-embed-ruby-in-c


http://www.codeproject.com/Articles/11508/Integrating-Lua-into-C
Last edited on
closed account (N36fSL3A)
The thing is I don't want people to EDIT nor be able to OPEN the source.

I want the source to be kind of "encrypted"

BTW thanks, this makes me want to go back to Ruby :)

Obfuscating Ruby code is what I want to do.
Last edited on by Fredbill30
You can embed lua files as c strings inside C/C++ code. Or you can compile lua to byte code before distributing.
closed account (N36fSL3A)
I'm using Ruby now.

The 2nd main reason I'm using Ruby is so I don't have to re-compile every time I make a small change to the code.

EDIT - Thanks for the link but I can't find a decent way to embed Ruby in my game. (That tut is outdated)

Now what I need to do is figure out how to get Ruby working. (Stayed up all night just to figure this out :P)
Last edited on by Fredbill30
closed account (30X1hbRD)
I know this topic's solved, but I thought I'd mention that a sort of game engine called rpg maker xp, and rpg maker vx use ruby as a scripting language, and it's possible the engine was coded with it. Good luck learning it btw
closed account (N36fSL3A)
This topic isn't really solved, more of "half solved".

I know of those to RPG makers, along with VX Ace.

That's actually where I learned Ruby.
closed account (Dy7SLyTq)
@lachlan: http://sourceforge.net/projects/swig/
so you can do it with ruby too
closed account (N36fSL3A)
So how can I encrypt my Ruby source code?
closed account (Dy7SLyTq)
ummm... i dont actually program in ruby so im not the best person to ask
Why do you want to "encrypt" it? Do you mean compile it? Do you want to distribute obfuscated source files?
closed account (N36fSL3A)
Well can someone tell me how to set up ruby?

http://prntscr.com/1dqeij

is what I get when it installs and I want to know if I should set it up like SDL.

Also, how do I get my C++ program to be able to USE Ruby?
Last edited on by Fredbill30
Using any code, if you compile the code like I showed with Lua, your end user can't read it unless they now how to reverse engineer it. For example, opening lautest from my previous example in an editor gives this:

LuaR


Just compile the scripts and your C++ code can run the compiled scripts no problem.
closed account (N36fSL3A)
When I'm programming wouldn't it interpret the script in runtime?

Yes chris.

You know what, to hell with Ruby. It's too goddamned hard to get into an app. I'm going with Lua (Once again)
Last edited on by Fredbill30
Pages: 12