Ruby: What game library is best/simplest for 2D arcades/platformers? - ruby

I want to create simple arcade on Ruby. I used GOSU some time, and then I find many game libraries for ruby: RubyGame, Chingu ....
What library is best for game development, and why?

Gosu is the most popular (and actively maintained) library for writing 2D games in Ruby. It has an underlying C++ library that it uses to improve performance and interact with the underlying display rendering libraries like OpenGL.
I'm also working on a gem that will make it easier to write real arcade games in Ruby. In the mean time, you may be interested in using a MAME compatible arcade controller. I wrote a gem that provides the common MAME keyboard input mappings for Gosu.
There is also a gem called GameBox which uses Gosu behind the scenes. GameBox attempts to abstract many of the common game boilerplate so that you are left with writing the "business logic" of your game.

It is for you to decide based on what exactly you will implement https://www.ruby-toolbox.com/categories/game_libraries

Related

Programming Unity Games with Ruby

So I see that unity has the support for c#, JS and Boo.
I could learn one of these but I would like to make a 'compiler' or something similar that would let me write ruby code and either output JS code or make a layer that could be read by the Unity compiler.
Is this even a possibility. Im willing to invest many hours in this and have a fair bit of experience.
If your question is actually "how do I compile Ruby to JavaScript" then that's easier to answer:
Opal: Ruby to JavaScript compiler
However, you're going to be mucher better off learning one of the supported languages. It's very hard to debug "your" code when what's running is a paraphrasing of the code in another language.
I'm not that familiar with C# but if it's anything like C, it's quite possible you could create bindings from Ruby to Unity and just use it directly. Likely you could even get some kind of community going. This would be much preferable to trying to auto-refactor languages.
I recommend the "play my code" site.
It is possible to "conpiles Ruby to JavaScript", to operate the Ruby Game in a browser, just as JS.
http://www.playmycode.com/build/edit/6172
Unity 3d doesn't use Javascript, i think unity corporation call it as javascript just for marketing purposes, Unity uses UnityScript which is Boo based implementation, you can see the source here https://github.com/bamboo/unityscript
So, even if you got some compilers ruby to javascript such as Opal, you'll still compile it to JavaScript and not UnityScript, there's a big diferences between them:
Javascript is a prototype based language, and UnityScript is an class based.
UnityScript is more JScript.NET than Javascript.
See more at http://wiki.unity3d.com/index.php?title=UnityScript_versus_JavaScript
I think the easily way to integrate ruby language rather to write a full compiler is integrate IronRuby, which is a Ruby implementation written in C#, which will generate bytecodes for CLR that Unity can read.
I did a similar project with python, which uses IronPython (https://github.com/cesardeazevedo/Unity3D-Python-Editor), it's still very limited, such you still have to call python code from C#, but it works and there's a interpreter that can help you in your development, if you want to create thousands of game objects with simple python commands.

Side scrolling game in Ruby

Does anyone have advice on creating a side-scrolling action game in Ruby?
I am particularly looking for libraries, tools, or guides. I've built a terminal text-based game however now I'd like to involve graphics and possibly run the game outside of terminal.
It's important to me that it be in Ruby.
How about libgosu?
http://www.libgosu.org/
"Gosu is a 2D game development library for the Ruby and C++ programming languages, available for Mac OS X, Windows and Linux. It has been in development since 2001."
"Ruby/Gosu integrates well:
gem install gosu
complete with examples, precompiled for Windows & OS X"
A very nice toolkit for making 2D graphics is SDL there are ruby bindings available at
http://www.kmc.gr.jp/~ohai/rubysdl.en.html
oreilly net has a very nice article about writing games with ruby here
https://web.archive.org/web/20170813235228/http://archive.oreilly.com/pub/a/ruby/2007/12/04/creating-games-in-ruby.html
If jruby is ok for you, you can use various java libries for the gfx part like java2D or
processing ( http://www.rubyinside.com/using-the-processing-graphics-system-from-ruby-780.html )

Ruby as a standalone language [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been messing around with ruby on rails. But my questions is really simple. Is ruby used language used for desktop applications? I mean without Rails? Can it be combined with GUI packages and Graphics Libraries to create a game for example? I have read that ruby is based on C. So it will be fast right?
Is ruby used language used for desktop applications?
Yes it is.
I mean without Rails?
Yes.
Can it be combined with GUI packages and Graphics Libraries to create a game for example?
Yes it can be.
I have read that ruby is based on C. So it will be fast right?
No, it won't be "fast" in the same way C is fast, because that isn't the point of Ruby. Ruby isn't "based on" C in any sense. The interpreter which runs Ruby code may be written in C (there are many interpreters and not all of them are), but that has nothing to do with the language itself. C and Ruby are not really comparable and occupy completely different niches.
I've no experience in programs where speed is critical; however, from my experience, Ruby is fast enough for user applications with GUI, and differences are almost unnoticeable from other similar dynamical languages (Ruby 1.9 is even faster, sometimes).
There is a reason I don't name the "similar languages": I think languages benchmarks aren't useful at all. While the fact that Ruby is fast enough for general purpose programming will probably make you happy, I think it's more important that if you already know and like Ruby you will be more productive using it.
There are some limit cases Ruby will be even faster than C: your implementations in C for functions that are offered as methods in the Ruby core lang and std lib could be slower than the ones in Ruby VM. This is just to say, speed isn't usually a concern, unless you're actually well aware of a particular reason you should be concerned with speed.
Some nice GUI libraries are FXRuby and Shoes, a very easy library used in the Hackety Hack project to teach children to program.
I usually use Tk when programming with Ruby and Python because it's included in the standard library and there is no need to install anything else.
For Gaming, you can try Gosu and Chingu; Gosu is probably the most actively developed Ruby Gaming Library, and Chingu is a nice collection of classes based on the foundations offered by Gosu. They've not got the nice community of other gaming libraries (e.g. Pygame) but you can easily start making little games with them.
Check out the Shoes GUI, it has different implementations, each one has a colorname, the most popular ared Red and Green Shoes, they are often used to make the kind of games you see also in Flash or regular javascript. They are fast enough for that kind of games. Some implementations even work with JRuby.
Red Shoes
Green Shows
Ruby is a language whose common implementation (e.g. ruby-1.9.3-pl94) is an interpreter coded in C. File main.c contains the main function in C which set up the Ruby VM implemented in C in file vm.c.
You could have several implementations of Ruby. I heard that some people wanted to re-implement Ruby above the Parrot VM (itself implemented in C); but that effort is perhaps still in progress. JRuby is a Ruby above the JVM.
Indeed interpreter vs compiler is not a sharp difference. Many interpreters contain a virtual machine with a translator (which you could view as a compiler) to that VM. Some VM implementations have a Just In Time dynamic translator to machine code. The JIT part produces machine code dynamically.
You could code a graphical application using e.g. Ruby-Gnome, a glue to Gnome and Gtk. You could also use Ruby Qt, a glue to KDE and Qt

Ruby library/gem for game graphics?

I am creating a simple Blackjack game in Ruby, and I have finished all the game logic stuff (finally!) and currently have it running through the command line. It is all working, so now I need a library or gem that will make the whole graphics side of things easier.
Any ideas?
Thanks.
As well as Gosu, mentioned elsewhere, there's Rubygame which also appears to be regularly updated.
No opinion on either, suggested as an alternative for comparison.
UPDATE: New(-ish?) kid on the block: Ray. Fairly graphically-oriented, it would appear.
Maybe you could try to use Gosu which is a 2D game development library for the Ruby and C++ programming languages, available for Mac OS X, Windows and Linux.
Available as a gem. More information here
You can also watch a fun presentation I saw in Barcelona during Euruko (ruby conference).
Available Here
Shoes would be a good candidate, it's very lightweight, cross platform & fun to use.
It has a nice ruby API which you can use to draw shapes and use native GUI widgets.

Ruby to Actionscript3 Bytecode

Hi I was looking into Ruby to actionscript 3 bytecode compilers and found a mention of a project called Red Sun but can find very little information on it.
So my Question is ... what tools are available to convert Ruby source into AS3 bytecode
I am the lead developer on the Red Sun project. There is very little information because it is really not ready to be used yet. I worked on the original prototype and presented it to a handful of people at 360|Flex San Jose. This generated further interest and encouraged me to propose it for RubyConf, for which an introductory talk on Red Sun was accepted.
Since then, I have had the time to flesh out the framework and really see what was possible. I'll be outlining all of this publicly soon, but I decided to diverge from the idea of generating ActionScript 3 bytecode becuase of the limitations of it. Ruby and ActionScript are somewhat similar, but Ruby has some significant differences in its method dispatch semantics that require any implementation in ActionScript to use a custom method lookup solution. It could perhaps be done in JavaScript, however ActionScript 3 does not allow re-assigning the prototype field to point at a different object, and Ruby relies on modifying the inheritance hierarchy at runtime.
The presentation at RubyConf will be on Saturday, Nov 8th. You can track Red Sun's development on http://github.com here http://github.com/jonathanbranam/redsun and I will be posting information on my website at http://jonathanbranam.net. I am planning to launch a site just for information about Red Sun, but that is not completed yet to share a link.
Red Sun does not include a Ruby parser or compiler, so it relies on Ruby 1.9 bytecode being generated by a true Ruby 1.9 implementation. It is currently based on 1.9.0-4 and may need changes if there is deviation from this version. As far as capabilities, as of right now (10/27/2008) it supports basic method dispatch, classes and modules. That's really about it. The standard library has not been ported and I hope to depend on Rubinius for a good portion of this.
I don't know of any Ruby->AS3 converters but in the future, Iron Monkey may make it possible to run Ruby on Tamarin (AS3 virtual machine).
As an aside, I'm pretty sure there are things you can do in Ruby that you can't do in AS3, so any converter would probably only be able to convert a subset of Ruby code.

Resources