This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Introduction

This manual is aimed at helping people to bug fix or develop new gbrainy's games functionality. It covers the following areas:

gbrainy uses Mono project coding guidelines. Please read before doing any new development.

There is a gbrainy public group where people can share its experiences, ideas and get involved in gbrainy development.

If you extend gbrainy, please considering contributing your work to be included in gbrainy.

Recommendations for developing new games

If you are creating a new gbrainy game, please take into account the following criteria:

Using external game definition files

External game definition files allow game authors to define new gbrainy games without the need to do any coding.

You can define new verbal analogies and logic/calculation games using two different xml files. See games.xml and verbal_analogies.xml for real examples of how to use them.

Verbal analogies

Verbal analogies help to prove your abilities linking concepts and using the language.

gbrainy reads the file verbal_analogies.xml that contain the verbal analogies definitions for gbrainy. This file is located in the shared gbrainy directory (usually /usr/share/gbrainy/verbal_analogies.xml). You can edit, modify and extend this file as you wish.

1. Description of verbal_analogies.xml format

Brief description of the tags and attributes used:

<_question>. Specifies the question for the analogy

The type attribute allows to specify the type of question:

<_tip>. Optional tag that allow to give a tip to the user on how to resolve the analogy

<_answer>. Allows to specify one or more answers

The attribute correct with value "yes" indicates that this is right answer.

You can use the "|" character to separate possible answers.

You can also look at AnalogiesFactory.cs in gbrainy source code as additional reference.

New logic and calculation games

The games.xml file allows you you to define new gbrainy games without the need to do any coding.

gbrainy reads the file games.xml that contain games definitions for gbrainy. This file is located in the shared gbrainy directory (usually /usr/share/gbrainy/games.xml). You can edit, modify and extend this file as you wish.

1. Description of games.xml format

Brief description of the tags and attributes used:

<_name>. Specifies the name of the game.

<type>. Specifies the type of the game. Logic and Calculation games are currently supported.

<question>. Specifies the question for the game.

<answer>. Specifies the correct answer for the game.

<difficulty>. Indicates the difficulty for which the game is available.

<variables>. Defines a set of variables that are evaluated as C# and then can be referenced in question, answer and rationale strings using brackets.

<_rationale>. Defines the rationale behind the answer considered correct.

<svg>. Defines a SVG file that will be shown as part of the puzzle.

You can also look at GameXmlFactory.cs in gbrainy source code as additional reference.

Using extensions

Introduction

You can extend gbrainy easily with new games that you develop as extensions. This provide more flexibility that using external files since you can use a programming language to express more complex games. Extensions are external assembly files that gbrainy recognizes at runtime. The extensibility capabilities are provided by Mono.Addins framework. You do not need to recompile gbrainy to develop or deploy extensions.

gbrainy supports three types of extensions Logic, Memory and Calculation that correspond to the types of games that gbrainy supports.

Anatomy of an extension

An extension should be a self-contained game. It should provide at least two files:

It also may contain graphics or additional resources required by the game.

At gbrainy source code repository there is a directory called sample_extensions that contain three types of games supported.

Building extensions

You do not need gbrainy source code to build extensions, you only need to have gbrainy properly installed. For a simple extension containing a single code file and a manifest, you should be able to compile it like this:

gmcs -t:library CalculationSample.cs -resource:CalculationSample.addin.xml -pkg:gbrainy

Installing an extension

The assembly containing your extension (and the manifest file if not bundled as resource in the assembly) have to be copied either in $PREFIX/lib/gbrainy/ (e.g. /usr/lib/gbrainy/) to make it available system-wide, or in ~/.gnome2/gbrainy/addins if you don't have enough rights to install it system-wide.

Porting gbrainy

gbrainy has been designed to be portable to different operating systems and devices. It is written in C#.

It requires the following software stack:

Optionally:

gbrainy source code is structured in three assemblies:

gbrainy functionality has been made available as porting to the different systems:


2024-10-23 10:58