I am wanting to do a game in Ruby, but I came across a problem. I am intermediate level in Ruby. I only know of running Ruby through the command line but to make the game I am thinking of similar to Dwarf Fortress would require something more.
I need to be able to use arrow keys and enter to select things. I also need 2 frames displaying, one for the map and one for in-game information.
How do I go about doing this? Would I need to use a GUI or something to that effect. If it can't be a desktop app, that's fine. I have a vague idea of how I could do it in the browser.
Check out the gosu gem which gives you a 2d game engine from www.libgosu.org
gem install gosu
# complete with examples, precompiled for Windows & OS X
gem install texplay
# pixel-based drawing on Gosu images, by banister
gem install chingu
# a library that adds more game logic, by ippa
gem install ruby-opengl
# the standard Ruby OpenGL gem works fine with Gosu to add 3D effects
# (See the included example, or this fine bundle of tutorials by tjbladez. Also note this thread if you have problems installing on Windows)
gem install chipmunk
# a popular physics library with an integration example in the wiki
gem install rmagick
# can be used as a more powerful but harder-to-distribute alternative to TexPlay, example included in Gosu
How about ruby-gl
http://ruby-opengl.rubyforge.org/
Related
What is the least headache technique to package a gtk2/gtk3 app built with ruby for distribution as an executable, for windows, linux, macos?
I could not find any guides or helpers to resolve this for ruby gtk. Nor the ruby-gnome gem comes with a packager.
It is my understanding that gtk is cross-platform, so it should not be trivial to do this. Problem is I am unable to find anythin reliable to follow as an example and learn the steps.
I've come across the same problem as you and I've put the question directly to the GTK3 developers.
here is their answer.
Which means that if you choose to use GTK3 today with Ruby, you have to:
Deliver MSYS2 and Ruby with your GEM.
Deliver your gem and tell users to install themselves msys2 (with updates) and ruby and your gem with dependencies.
It seems that the core developers of ruby-gnome2 are unconcerned about app distribution outside the Ruby community.
For example, Mr. Sutou, one of the maintainers of ruby-gnome2, distributes his Ruby/Gtk presentation tool "Rabbit" only as a Ruby Gem.
I have played with some gosu tutorials to create a simple gosu game using my mac. I followed the instructions in https://www.libgosu.org/ruby.html
My question is:
Can a gosu game be set up to run on a website using something like https://github.com/opal/opal-browser using a gem "opal"
Opal compiles the game.rb file but does not add gems. So I get an error, cannot find require file.
I want to set up an index.html page and run the game in a web browser with a button that runs bundle exec ruby game.rb instead of running the file from the console.
This question Ruby: Running Gosu game from a web browser may have asked the same thing but my question is around using Google Native Client tools to solve it.
I am looking to write an app that overlays images and copy on top of another image. I know in PHP you can use the GD library but for Ruby does anyone have a specific suggestion of a gem that would help with this?
I have seen 2 gems already but not sure which is the one most people use.
https://github.com/Spakman/ruby-gd
http://rubygems.org/gems/gd2
gd is a bit dated as a library for image manipulation/processing. The gems you listed are old, quite old in fact and likely will have issues with newer versions of Ruby.
Based on my own experience, I would look into a gem like minimagick which provides a nice interface to ImageMagick which is a more common library for the tasks you're trying to do.
The modern version of gem for working with GD library is https://github.com/dark-panda/gd2-ffij ... obviously, ImageMagick bindings are more powerful, but ImageMagick library have much more dependences and is generally heavyweight.
i'm a web designer (front-end developer) who would like to use sass+compass and slim-lang (similar to haml, but more lightweight). if you're unfamiliar, these are all rubygems, which parse code and compile to html and css. That's where my understanding ends.
i've been through a few ruby tutorials, but they're ALL geared towards mac users. sadly, i'm a windows user, and i get but a confusing footnote. i tried installing ruby, but none of the commands would work, so i started looking at other solutions (due to windows' sickening lack of a useful command line).
currently i'm looking into using cloud9 for editing and github for compiling (is that even possible?)... but i don't understand git at all. is this overkill? is there an easy way to do this, or at least some concise explanation of all this? i know i'm not stupid; i just feel like there's some key thing i'm missing here.
(note to self: buy a mac)
tl;dr:
Things I have:
windows
Things I need:
a simple ide to edit code / manage projects
a simple way to compile slim,compass,sass without a headache
Sorry to hear you're having problems. Some things to try:
Install RubyInstaller
In the Windows Start menu locate the Ruby program group and run "Start Command Prompt with Ruby"
At the prompt type gem install compass
You should see something like this:
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
C:\>gem install compass
Fetching: sass-3.1.15.gem (100%)
Fetching: chunky_png-1.2.5.gem (100%)
Fetching: fssm-0.2.8.1.gem (100%)
Fetching: compass-0.11.7.gem (100%)
Successfully installed sass-3.1.15
Successfully installed chunky_png-1.2.5
Successfully installed fssm-0.2.8.1
Successfully installed compass-0.11.7
4 gems installed
Does this work? If so then you're good to go. You'll also need to install Slim: gem install slim. Try following the Compass install documentation from here. The commands for Windows are identical to those for Mac/Linux. If you need some help learning about the Windows command line, there are plenty of tutorials around.
Take a look at Compass.app and Scout if you really don't get on with the command line. I really do recommend getting to grips with the command line, though. It's a very handy skill to possess.
I'd recommend using a simple text editor rather than an IDE. I prefer Sublime Text 2, but Notepad++ or Scite might suit you better. RubyMine is a good IDE, but it's not exactly simple.
Forget Git for now - you don't need it for what you're trying to do (compile Sass and Slim files).
One final parting thought: what you're after doing it roughly equal in difficulty on a Mac, so purchasing one wouldn't, at this stage, make life much easier for you. In the long-run, though, if you get into, say, Rails development seriously, then a Mac would make life easier. If you're simply compiling Sass and Slim, though, no need to switch. The authors have done a great job cross-platform job.
Ruby. Shoes. DataMapper.
After an encoding error I get 'failed to build native extensions'.
That happens when I do the Shoes.setup and it tries to fetch and install the gem.
Since Shoes can't be run as a gem is there a different approach?
you're wrong, shoes CAN be run as a gem, you have different flavors (colors) of shoes.
Most people work with Red Shoes but you also have a Green Shoes implementation, i use it always with native extensions. Not all methods from red are available and possibly you have to change your code a little but it should work. Success !