[LINK] Ruby DSL for turn-based strategy game

D

Dr Nic

"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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top