Temple of The Roguelike Forums

Game Discussion => Early Dev => Topic started by: kipar on March 19, 2011, 12:19:37 PM

Title: Mech combats roguelike in Ruby
Post by: kipar on March 19, 2011, 12:19:37 PM
The best way of learning a new language is to write a game in it. So it's my first attempt to create something in Ruby and my first attempt to use Curses library.
I've used algorithms from roguebasin page about ruby (permissive FOV and Bresenham). At first I've used recommended at roguebasin library NCurses, but there is no compiled version of this module for ruby 1.9, so i migrated to standard curses module (sadly it doesn't support some keypresses (arrows and numpad without Numlock)).

The link is
http://www.mediafire.com/?19q577h9flfkzbf

You need a Ruby (www.ruby-lang.org) to run it though. I have only tried it in Windows, but it should works in linux too (at least i hope so).
Title: Re: Mech combats roguelike in Ruby
Post by: Psiweapon on March 20, 2011, 06:43:33 PM
Downloading Ruby. Let's give this a shot =)
Title: Re: Mech combats roguelike in Ruby
Post by: Psiweapon on March 21, 2011, 10:51:20 PM
Man, I've downloaded Ruby, and ran your game, but my laptop has no keypad =< I'll have to try it on my desktop.

They look nice, though =D Both your game and Ruby.
Title: Re: Mech combats roguelike in Ruby
Post by: TSMI on May 06, 2011, 08:48:06 AM
Doesn't work on linux (and won't work on mac either probably) because you've used ".\" to specify filepaths. I think the cross-platform way is to use the unix "./", but I'm not sure.

Anyway I edited them all myself. Looks good so far. Two things that would make it a lot more playable would be to display all the keybindings when "?" is pressed, and to have Enter confirm a target for Missles *AND* Lasers.

I dunno if it's worth mentioning but it's quite slow on my (decade old) machine. Ruby is very nice but also very slow - thankfully extending it with C is relatively easy (I added a bit about that to ruby page on roguebasin)
Title: Re: Mech combats roguelike in Ruby
Post by: Jolly Roger on May 06, 2011, 09:02:54 AM
Mech Combat was kipar's side project, to test Ruby and so on. I don't know would he continue development.
Title: Re: Mech combats roguelike in Ruby
Post by: kipar on May 06, 2011, 11:38:43 AM
Well, under Ruby 1.9 it will be slightly faster than under Ruby 1.8. But there will be more problems with compatibility (require".\zzz" sholud be replaced with require_relative "zzz"). I'll post updated version tomorrow.

I've found a lot of problems (performance and compatibility) when using curses under ruby so perhaps in my next ruby roguelike I'll use pascal code for gui and use Ruby only for the game logic.

BTW, there are Ruby bindings for FreePascal (for fans of pascal): https://github.com/shikhalev/ppruby
Title: Re: Mech combats roguelike in Ruby
Post by: TSMI on May 07, 2011, 01:05:04 AM
I ran it under 1.9, but like I said I am on some seriously ancient hardware.

I am currently attempting an RL in ruby myself, though it makes use of a C "engine" I am concurrently writing. I feel this is a pretty good combination, and it's blazing fast.