Skip to content
Michael Fairley edited this page Sep 1, 2013 · 2 revisions

Configuration

Within each metro game is a configuration file. By default this file is named metro and is contained in the root of the game. The configuration file contains details about the game like the: name; resolution; starting scene; contact details; and control schemes.

A metro configuration is written entirely in Ruby using a Domain Specific Language written specifically to handle game configuration. This document outlines several of the configuration options.

Name

This is the name of the game.

name "Super Street Plumbers 2"

First Scene

This is the name of the first scene to start when the game starts. By default this is set to the brand scene.

first_scene :brand

During development setting the first_scene to the current scene you are creating makes it easier to start up where you left off.

Resolution

Set the resolution of the game. By default if the resolution has not been set then it will default to 640 width and 480 height.

resolution WIDTH, HEIGHT
resolution 640, 480

Note, the layout of components is tied to the current resolution so changing the resolution after development has started will require all the previously laid out scenes to be redefined.

Fullscreen

Sets the game to full screen. By default the game is run in windowed mode.

fullscreen true

Controls

Defines controls which are meta events. They can be used group button events together under a single name so that they can be used throughout the game under the same name. This allows for the keys to be redefined or configured by the player.

controls do
  confirmation is: :button_up, with: [ KbReturn, KbEnter, KbSpace, GpButton0 ]
  cancel is: :button_up, with: [ KbEscape, KbDelete ]
end

Throughout the game you can look for the event :confirmation and :cancel in places instead of repeating the same series of key sequences. This will ensure that you maintain support for a continuous input scheme through your entire game.

class BrandToTitleScene < GameScene
  event :cancel do
    transition_to :title
  end
end

Debug

Set the game mode to debug. By default the game is not not run in debug mode.

debug true

Placing the game in debug mode does not, at the moment, change the way the game is executed. Functionality or data will need to be encased within conditionals that check to see if debug has been enabled.

class FirstScene

  if Game.debug?
    draw :debug_label, model: "metro::ui::label", text: "DEBUG MODE", 
      position: "10,10,99"
  end

end

Author, Artist, Designer

The author, artist, and designer fields allow you give credit to those that have worked on the game. All of the fields capture individuals and place them as authors of the game. They can be called out individually like that to more clearly define the role that they played.

author 'Franklin Webber'
author 'Trevor Menagh-Lalish'
artist 'Brandon Faloona'
designer 'Ivan Stork'

Website

Provides a website where more information can be found about the game or the team of people that development the game.

website 'http://rubymetro.com'

Contact

Provides a contact email where a person could query for more information about the game, ask for help getting it running, or provide feedback.