Ruby and Game Engines

[ LiB ]

Ruby and Game Engines

Ruby is available as a tool for a few game-programming engines. ClanLib is an engine I've mentioned before that has been used on many independent projects, while MUES is a new Ruby tool known primarily as the backbone of The F rieMUD World.

ClanRuby

ClanLib (www.clanlib.org) is one of the more popular libraries for amateur game designers today. ClanLib is written entirely in C++ as a graphics and game library. It takes the hard-to-develop functionality like sound mixing, DirectDraw, networking, and working with images and provides an easy-to-use, multi-platform library to develop this functionality. ClanLib also provides low-level interfaces to other popular libraries such as DirectFB, DirectX, OpenGL, and X11.

ClanRuby is a set of bindings from Ruby that tie into ClanLib's library. ClanLib and ClanRuby are licensed under the GNU Library General Public License. ClanRuby was developed by Russell Olsen, and, as of this writing, Version 0.6.5awhich is compatible with ClanLib 0.6.5is available at its Sourceforge project page at http://sourceforge.net/projects/clanruby/. ClanRuby's home pagewhich shows the latest ClanRuby developments, offers a brief ClanRuby tutorial and shows sample ClanRuby usesis at http://clanruby. sourceforge .net.

ClanRuby 0.6.5 is also included on this book's CD in the Chapter 11 folder. Russell Olsen has tested the platform primarily on Red Hat Linux 7.3 using ClanLib 0.6.5 and Ruby 1.6.7 or 1.6.5. ClanRuby can be installed from the source by unpacking the tar files, running the Ruby configuration script (EXTCONF.RB), which creates the make file, and then running make and then make install .

While ClanRuby currently only works in Red Hat, ClanLib delivers a platform-independent interface. If a game is written with ClanLib, it should be possible to compile the game under just about any platform without changing the application source code.

But ClanLib is not just a wrapper library, providing a common interface to low-level libraries such as DirectFB ( Direct Frame Buffer ), DirectX, OpenGL, X11, and so on. While platform independence is ClanLib's primary goal, it also tries to be a service-minded game SDK. In other words, a lot of effort has been put into designing the API in order to ensure that ClanLib is easy to use but still quite powerful.

ClanRuby can be brought into a Ruby program after installation with the following:

 require 'ClanRuby' include ClanRuby 

Setting up the ClanRuby environment is accomplished with a few init methods and Display.setVideoMode , which set the screen size and resolution. Cleanup is handled by deinit methods:

 #Initialize SetupCore.init() SetupDisplay.init() #Set Display 640x480x16bit Display.setVideoMode( 640, 480, 16, false ) # #Actual Bulk of the program here # #De-initialize SetupDisplay.deinit() SetupCore.deinit() 

Users of ClanLib will recognize the upcoming code. Those who have delved into OpenGL and SDL in earlier chapters will also find ClanLib's syntax familiar; for instance, here's how to draw a rectangle:

 Display.fillRect() #Parameters to define where rect is drawn go here Display.flipDisplay() 

Sourceforge is also home to a few games written in ClanLib, including a Boulderdash clone called Epiphany written by Guiseppe D'Aqui; it's at htttp://epiphany.sourceforge.net.

MUES

The MUES ( Multi-User Environment Server ) is a game-environment server written in Ruby. The purpose of MUES is to facilitate building online multiplayer games or simulations. It provides game worlds in the form of dynamically programmed object environments, machine services and daemons for creating in-game systems, and a network client to access these environments.

MUES is just the first half of the projectthe programming of the server platform. MUES is also tied into a MMORPG ( Massively Multi-player Online Role-Playing Game ) called F rieMUD, which is the creative, vision-inspired, story-based world the development team has been building in conjunction with the engine.

MUES itself is open -source software that was released to the public in late 2001. The source code and documentation can be found at http://mues.faeriemud.org/. The MUES engine supports a number of useful MUD features, including:

  • Multi threading

  • I/O abstraction

  • Network sockets and protocols

  • Object persistence

  • Logging

  • Dynamic/data driven environment

  • User authentication

[ LiB ]


Game Programming with Pyton, Lua and Ruby
Game Programming with Pyton, Lua and Ruby
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net