Side scrolling game in Ruby - 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 )

Related

Desktop Environment in Ruby

I want to create a very simple window manager for Ubuntu using Ruby. Where should I start?
I am somewhat familiar with Qt (from when I used to use C++), but I don't mind using other frameworks.
There's this great presentation, presenting several toolkit alternatives. It's in Portuguese, but it should not be hard to understand the toolkit names and screnshots :)
http://www.slideshare.net/guest2a3a90/ruby-no-desktop-marcelo-castellani

Ruby for cross-platform desktop applications?

Please share you experience building desktop applications with Ruby programming language. What GUI toolkits have you used? How have you packed everything into one installer? What troubles have you spotted?
I saw few articles about using Ruby for desktop, but in teory everything is always great. I would like to know about real-world applications build with ruby.
you can check this out
Non-trivial desktop apps that use Ruby?
i used redcar & its available as a Gem

Can Ruby be used to develop simple Windows applications?

I've been developing Windows based applications for a long time and most of my present clients still desire a desktop or client/server Windows application. Is it possible to use Ruby for such applications as opposed to its primary purpose of being a Web-programming language?
Ruby is not primarily a web programming language even though Ruby on Rails is certainly suited for web development. Ruby is a general purpose scripting language.
The FXRuby and WxRuby frameworks are the most fully featured GUI frameworks for Ruby. You can write the apps in Ruby and then generate a Windows executable. The frameworks are cross-platform, so you could also run the apps written in these on other platforms, like Linux or Mac OS X.
There are also a few other less popular approaches like QtRuby and Shoes, and you can even use IronRuby (a CLR Ruby implementation) to write a .Net application.
Ruby is a general purpose object oriented scripting language. Ruby on Rails is a web application framework. Ruby predates Rails by about ten years. Don't confuse the two.
Yes, you can. Ruby is a full scripting language. You might want to start with the Ruby language homepage to see the capabilities and libraries that are available.
However, just because you can doesn't mean that you should. Before jumping in and using Ruby for a project, see if Ruby can give you things that other languages can't or if there are any disadvantages to using Ruby.
I know this thread is old, but for future reference to anyone who's looking into options for using Ruby for a GUI app, don't use QtRuby. I had developed a project for school in about a week, fully functional and pretty, only to find out that I could not release it. There was simply no way to package and distribute the application without having your users simulate your exact environment (install all the gem dependencies, build Qt development libraries etc). I tried using:
Crate: supposedly cross-platform, but I found only 1 usage example that's written in 2008 out of ~2 hours of googling, and the example basically covers a very specific subset of applications (some ssl/https authentication gem or w/e...)
Ocra: this looks like a candidate, but it's windows-only and didn't meet my requirements, as I had to target the three primary platforms
tar2rubyscript + rubyscript2exe: I had spent most of my time trying to get this to work because I've come across many who claimed that this is the way to go for distributing GUI apps built in ruby (albeit using other toolkits, Tk/GTK/wxRuby) but it didn't work either; I was endlessly faced with a cryptic error that basically breaks Qt::UiLoader functionality, in other words, you can't load .ui sheets you create with QtDesigner so...
Yes I'm angry and frustrated honestly, because I don't see the point of creating software that you just can't release for anyone to use. Now I'm left with a deadline coming up in a week, and I just hope I make it in time porting the app to C++.
So my answer is, don't use QtRuby. At least for now.
On a mac, you can use the Ruby Cocoa lib to create (what appear to be) native applications. If you want something more cross platform then you might consider a wrapper like shoes or qt.
The Qt toolkit seems the most popular way to do it. The website is http://www.darshancomputing.com/qt4-qtruby-tutorial/
I'm currently writing a little app in a wrapper called Shoes. This seems to make it as simple as pie to create windowed apps in ruby. http://shoes.heroku.com/ is the website.
At the moment Shoes looks suitable only for small personal apps. I say this because it's author recently went AWOL and it's not clear whether it will be developed further. I'm using it to write a game log parser to generate statistics from a flight sim. It's ticking along nicely.
Ruby can be used for developing GUI applications, whether Windows specific or cross-platform.
For Windows targetted you should look at the work going on with IronRuby since they have good integration with the .NET framework overall and with Silverlight, in the event you want to do apps that can bridge web and desktop. At this point IronRuby can be used to develop for Windows Presentation Foundation (WPF) or WinForms.
For cross-platform you have Ruby bindings for QT, FOX and others.
You should look at IronRuby - WPF and windows forms are both supported:

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.

Is Ruby any good for GUI development? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am considering creating a GUI-based tool that I want to be cross-platform. I've dismissed Java, as I personally do not like Swing. I'm currently considering C# and using Mono to make it cross-platform. However I'm wondering whether new-fangled cross-platform languages like Ruby can offer me a decent GUI development environment.
The short answer: no (because you said cross-platform).
The long answer: cross-platform GUIs are an age-old problem. Qt, GTK, wxWindows, Java AWT, Java Swing, XUL -- they all suffer from the same problem: the resulting GUI doesn't look native on every platform. Worse still, every platform has a slightly different look and feel, so even if you were somehow able to get a toolkit that looked native on every platform, you'd have to somehow code your app to feel native on each platform.
It comes down to a decision: do you want to minimise development effort and have a GUI that doesn't look and feel quite right on each platform, or do you want to maximise the user experience? If you choose the second option, you'll need to develop a common backend and a custom UI for each platform.
ruby is not a bad choice for your common backend.
You'll have Ruby/GTK, which allows you to use the GTK toolkit under linux. I think that should be working under Windows and Mac Os (as for Gimp, Gaim and so on).
A french magazine post a good beginner article about Ruby/GTK.
Edit : According to main page on the SourceForge project, Ruby-Gnome2 (aka Ruby/GTK) is cross-platform (Windows, Linux, Mac Os).
Ruby has Shoes, but that might be a little lightweight.
With Ruby you can use Tk, which is a mature, cross platform UI toolkit. It is the defacto GUI toolkit for Python and Tcl, and is also available for use with Perl. The most recent versions of Tk make use of native widgets which addresses the primary concern that Tk looks dated.
A language-neutral website devoted to Tk is http://www.tkdocs.com/ which includes examples coded in both Ruby and Tcl.
There's also FXRuby which has the benefit of a Pragmatic Programmer book, as well as wxRuby which is based on the wxWidgets C++ GUI framework.
being a wxperl programmer, i know that wxruby is there as well. Wx is pretty fast and has true crossplatform look and feel.
Take a look at Ruby GUI 2008 Survey Results and the discussion here. You will love to know.
Not sure about Ruby, but you mentioned Mono/C# -- I've used Mono and GTK# quite a bit lately and am very impressed. Seems to be pretty stable and cross-platform portability is nice.
Ruby/GNOME2 works pretty well. You can use Glade to drag and drop window elemtns and load it the UI from your Ruby app.
Have you looked at SWT on Java? It uses native widgets and is much easier to get a nice interface with it than Swing.
If you ever venture over to the mac, check out RubyCocoa. It is obviously only for OSX, but I've seen a lot of folks scratch their head when looking to do GUI development on the mac and if you love ruby RubyCocoa is a lot of fun.
I strongly back Qt for cross platform GUI development. It's awesome and APIs are very intuitive. GUI look and feel almost native with Qt because it uses GUI controls provided by underlying OS.
Though the basic interface with C++ other language bindings are available. For Ruby RubyQt is available. Unfortunately it's very immature.
I would suggest looking at visualruby. Its an IDE to create GUIs using ruby. It uses GTK as its graphics toolkit, and the apps look great to me on any platform. You can see screenshots on Win7, WinXP, Ubuntu, and Mac on the screenshots page:
http://visualruby.net/site/Screen%20Shots.html
You can easily try it on every platform by installing visualruby on various platforms, and running the example programs.
The checked answer was written before visualruby was released.

Resources