[LINK] Ruby DSL for turn-based strategy game

"I continue to develop Dr Nic’s Civilizations game. This lead me to
develop a DSL for the specification of game rules. You need to see this.

"Here’s an example definition of some terrain:

  class Desert < Terrain
    title "Desert"
    letter "d"
    graphic "desert"
    movement_cost 1
    defense_bonus 10
    food 0
    shield 1
    trade 0
  end
  class Oasis < Desert
    title "Oasis"
    special_code 1
    food 3
    shield 1
    trade 0
    graphic "oasis"
  end

"An Oasis is a special version of the Desert terrain, so Ruby subclasses
offer a compatible relationship."

I've written up why I used a Ruby DSL for this static configuration, and
how it is implemented here:
http://drnicwilliams.com/2006/09/07/turn-based-game-dsl/

Cheers
Nic

···

--
Posted via http://www.ruby-forum.com/.