Developing a Game with Ruby and Gosu

After seeing Mike Moore’s talk at Ruby on Ales about Writing Games with Ruby I knew I had to give it a try. In his talk, Mike presents how game development in Ruby using Gosu. It’s a 2D graphics engine, written in C++ and has Ruby bindings — combining performance with a beautiful programming language. Out of the box it supports images, fonts, sounds, keyboard and mouse inputs and much more.

I’m a web and backend developer, so I don’t have a lot experience working with realtime interactive applications. But as Mike puts it: “If you can print text to a website, you can print text to a screen!” Also, I’m not an artist, so it would be ugly for sure. The last few days I sat down and started writing a small game to test out a few core concepts. I enjoyed playing Minigore 2 on my iPad a lot, so I decided to copy the core concept: You have a gun, limited life and a neverending horde of enemies tries to get at you.

I managed to get together a basic game loop, a HUD, an end condition, some sounds and you can even pause the game. As soon as you start with these things a ton of ideas pop up, but for I’m too slow and inexperienced as a game developer and too busy in my life to pursue this further.

If you want to to give it a go yourself, you can download this ZIP file and play. You need Ruby on your machine, have the Gosu gem installed (gem install gosu) and then you can run the game with ruby game.rb.

Controls:

References