Need advice on Ruby and game dev

Ok I am new to programming still. I know how to do small basic things
like loops, strings, variables in like python, C, ruby…but thats it.
The farthest which isnt probably even related is PHP/SQL which I am
getting pretty good at. Anyways I want to start developing some very
basic games like NES style games. Some people said to start with C but
man its very ugly to me compared to ruby. I dont need super speed since
its going to be a simple game so Ruby should suffice. And another thing
is that I wont have to port or make a lot of changes if I want it on
Linx, Windows…but the problem is that I also like game consoles and
they always run C games if you get it modded. And then it takes a while
for someone to make a python or lua or ruby interpreter for it…I guess
I can start with Linux and Windows. But another question is how much
ruby do I have to learn before I can start gui/game stuff, like making
things move an all that? Do I have to learn all of ruby or what? Thanks

Haroon F. wrote:

Ok I am new to programming still. I know how to do small basic things
like loops, strings, variables in like python, C, ruby…but thats it.
The farthest which isnt probably even related is PHP/SQL which I am
getting pretty good at. Anyways I want to start developing some very
basic games like NES style games.

See RailGun:

http://rubyforge.org/projects/railgun/

Still a bit early in development, but well worth looking into.


James B.

www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.risingtidesoftware.com - Wicked Cool Coding

“Do I have to learn all of ruby or what?”

Just use what works for you. If you think a concept such as
lambda is too difficult, dont bother using it.
You can survive easily on ruby without it, despite what
others may say about this :wink:

For ruby+games I would recommend the SDL bindings of ruby, but
actually the name is “rubygame” on
http://sourceforge.net/projects/rubygame/
Gosu exists too but i have like 0 experience about this.
(Rubygame is nice btw but I think it could need a little nicer API call,
hopefully the 3.x branch on it will tackle this)

In my opinion though, game development in general is very time taking :frowning:
I felt left alone kinda, cant people put up the game-logic in .rb files
for all the common games… building a GUI around this is a lot LESS
work than thinking about algorithm, win conditions lose conditions
allowed actions, game logic stuff etc… etc… :slight_smile:

From: “Marc H.” [email protected]

For ruby+games I would recommend the SDL bindings of ruby, but
actually the name is “rubygame” on
http://sourceforge.net/projects/rubygame/
Gosu exists too but i have like 0 experience about this.
(Rubygame is nice btw but I think it could need a little nicer API call,
hopefully the 3.x branch on it will tackle this)

Just to round things out, here’s a link to a recent thread discussing
the
basics of getting started writing a 2D tile-based game ala “Zelda”,
using
Gosu:

http://groups.google.com/group/comp.lang.ruby/msg/69760f66678d3f42

In my opinion though, game development in general is very time taking :frowning:
I felt left alone kinda, cant people put up the game-logic in .rb files
for all the common games… building a GUI around this is a lot LESS
work than thinking about algorithm, win conditions lose conditions
allowed actions, game logic stuff etc… etc… :slight_smile:

On a related note, it does seem to be difficult to convince people to
try
an extremely, utterly simple game for their first attempt. Simple like
Pong or Asteroids simple.

Even with Pong or Asteroids, you’ll deal with the following concepts:

  • sprites & animation
  • texture loading (if you choose to draw textured planets as
    asteroids, for instance)
  • collision detection
  • collision resolution
  • a frame-based rendering loop
  • frame-based keyboard/mouse/joystick input processing
  • framerate-independent physics (unless you are certain you can
    achieve
    a constant framerate on all systems)
  • computer opponent AI (the computer controlled paddle in Pong, or the
    occasional alien spaceship in Asteroids that flies by and shoots at
    you)
  • game HUD display (score overlay text, etc.)
  • sound effects
    etc.

I think people tend to underestimate what they’re getting into on their
first game project. Thus I’d recommend starting with the simplest
game possible that gives experience with the above concepts. Once
that basic experience is gained, it should be more apparent how to
approach a little more complex game.

Hope this helps,

Bill

On Oct 24, 7:02 am, Haroon F. [email protected] wrote:

[…] the problem is that I also like game consoles and
they always run C games if you get it modded.

I wouldn’t spend too much time thinking about this. Once you can write
a platformer in Ruby, porting the game logic to C and exchanging the
rendering calls should be grunt work; getting the platformer to work
in the first place is something that needs experience and creativity,
though, no matter in which language you do it. (I.e. go with the
pleasant one!) And if you use a very high-level, railsy library, make
sure you understand that it’s doing for you.

But another question is how much
ruby do I have to learn before I can start gui/game stuff, like making
things move an all that? Do I have to learn all of ruby or what? Thanks

No. I got into both C++ and Ruby by writing small, one-file games
without knowing much about the languages. As long as you have ifs,
loops, arrays, classes, timers and an output method (flexible console
I/O will suffice), you can quickly put a minimalist Super Mario
together in any language.
Beyond these features that make a language Mario-complete, every
single thing you learn about Ruby can be used for making your life a
bit easier, but you will end up (re)writing many games anyway and have
plenty of time to try everything out.

I would recommend picking any gamedev library, understanding one or
two of the example games and then extending them. Do this for a
handful of libraries and you will not only learn how games ‘work’, but
also see that there is a lot of room for different designs. Andrea
Wright’s talk has been mentioned in this thread, and gives a good
overview over the current libraries and their design. With some
creativity you can write the same game in all of them, and with some
more the same applies to different languages (even C), and eventually,
different platforms (consoles).

Julian

Andrea K. Wright did a presentation on using Ruby for games at the Ruby
Hoedown.

The video is here:

http://rubyhoedown2007.confreaks.com/session05.html


Giles B.

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com/

Thanks!

Is there a similarly nice library for client / server applications
in Ruby? Geared towards games would be great.

I have had okay-ish success with sockets (Gosu’s old undocumented own
ones, and the Ruby standard sockets), but I’ve never written a dead-
serious network game so I don’t know all the requirements. If you find
something like a RakNet Ruby port, let me know. I’m always happy to
include integration demos to show how Gosu could be used with other
libraries that do their job well.

Julian

ooh. Gosu looks like its a very nice library. (Tip: dont name your
test application ‘gosu.rb’ :wink:

Is there a similarly nice library for client / server applications
in Ruby? Geared towards games would be great.

On the C side a good library is RakNet.

Don’t be afraid to try another language to use or learn a game library.
Unfortunately, intro books all start with C, C++, Java, or Python,
and not much else.
But most of them use some sort of library, and that really makes
things easier by abastracting away a lot or by teaching you the
language as you go. It’s far less painful than sitting through one of
the usual dry C++ books or something.
Work through several of them even, and you start to learn the
concepts you will need for almost any game library.

Everyone is right, with game programming you (we!) really do have to
start small and simple. It is surprising how much can go into even
Pong or Space Invaders or Missile Command. Starting with simple 2D
stuff will get a lot more into your head than you think. Then as you
go along, you start to put parts together and the ideas begin to sync
up.

Many types of games really do mostly follow certain patterns
(platformers, shooters, FPSs, 2D RPGs) and once you get a sense of
how they’re done and how they could be done, you find your way and
get back to the hard part: designing fun.

I’d recommend EventMachine. It’s a high performance I/O library
that can be interfaced either from Ruby, or directly from C/C++.

http://rubyforge.org/projects/eventmachine/

In addition to using EM in a number of Ruby programs, I’m also using
it in a game-like C++ -only app.

Thanks, I will look into this! :slight_smile:

Julian

From: “Julian R.” [email protected]

Is there a similarly nice library for client / server applications
in Ruby? Geared towards games would be great.

I have had okay-ish success with sockets (Gosu’s old undocumented own
ones, and the Ruby standard sockets), but I’ve never written a dead-
serious network game so I don’t know all the requirements. If you find
something like a RakNet Ruby port, let me know. I’m always happy to
include integration demos to show how Gosu could be used with other
libraries that do their job well.

I’d recommend EventMachine. It’s a high performance I/O library
that can be interfaced either from Ruby, or directly from C/C++.

http://rubyforge.org/projects/eventmachine/

In addition to using EM in a number of Ruby programs, I’m also using
it in a game-like C++ -only app.

NOTE: Typically EM wants to run the main loop of the app, and call
your handlers with I/O or timer events. But you can turn it inside
out if you want to, and poll EM once per game frame (for instance.)

Currently in my game-like app, rather than turn EM completely inside
out, I’ve adjusted it’s timer quantum (evma_set_timer_quantum()) and
set up a 16 msec callback, so that it calls my “render” function at
roughly 60Hz.

That’s sort of an experiment, but it’s working fine so far. I may
decide I want my render loop to run the show (to more effectively
synchronize with various CRT refresh rates, for instance) in which
case I’ll just poll EM from my render loop.

Anyway EventMachine is a very nice library. I’ve written numerous
programs using the Berkeley sockets API in Ruby and C over the years,
but these days EM is always my preferred choice. It’s less tedious
yet still high performance (indeed, on linux, for example, EM can use
epoll behind the scenes instead of select, and you don’t have to
change your code.)

Regards,

Bill

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs