One of the challenges facing Somusar, the developer of the SoProMach, is how
to best explain its code generation technology. The recently released Harpsichord
Riddle has been designed to showcase SoProMach on S60. Richard Bloor takes a look
at the game and the technology that created it.
The goal of The Harpsichord Riddle is to unlock the spell
cast by three treacherous witches. This spell locks the protectors of Lady Cordelia
in limbo within the walls of several mysterious castles. The game requires the
player to travel to various locations, over water, through fog and listening to
fragments of music to solve a riddle, which is the key to the prison.

The game play in The Harpsichord Riddle is straight forward, each move involves
an image generally accompanied by text and sound. At the end of each move the
player either continues to the next move or is offered a set of choices about
where to go next. A fairly familiar format.
From a technology perspective the game consists of a data driven story engine
that displays and plays the elements of a scene, offers the player choices and
then, when the player has made their choice, loads the next scene. The engine
itself is capable of playing both linear (fixed path) and non-linear (random path)
stories, although the Harpsichord Riddle only uses the linear features.
To create the game the following elements were required:
- A textual description of the story, defining the script and flow, created in
Microsoft Word.
- Image files for each scene, as bitmaps.
- Sound file for each scene, in both MIDI and WAV format (MIDI for the distributed
version, WAV for use in the emulator version).
- A SoProMach "stamp" for the application and its associated project files.
From these files the primary output of the SoProMach generator is the C++ game
application and a set of resource files used by the story engine to play the story.
In addition SoProMach creates all the related project files required in a S60
C++ project, text localization (*.loc), project definition files (*.mmp and bld.inf)
and the installation package definition (*.pkg). SoProMach also automatically
runs the standard S60 build tools, thus providing straight-through conversion
of input descriptions into ready-to-install *.sis files.
The diagram below shows the inputs to and outputs from SoProMach.

To illustrate in some more detail. The following specification defined the behavior
of an additional scene which displays a "hole" in a lake the player crosses in
a rowing boat at one point in the game. The player is given the choice of avoiding
the hole (and taking a longer route to the games conclusion) or rowing into it
(and taking a shorter route to the end of the game). @ BeginRoom(water_hole)
: rText=
Further on, you encounter an impossible hole in the water, reflecting what appears
to be a cloudy sky. You smell some metaphysics, here. A strong temptation attracts
you to enter the hole...
: rLinks=dream_1@Enter hole,fog_4@Bypass hole
@ EndRoom
The SoProMach can work from a specification written in more natural English,
its only basic requirement is that the specification uses consistent language
and constructs to define the logic.
It is this specification that SoProMach uses to create the project assets. The
main three are the application, its header file and its resource file.
In S60 it is possible to define most user interface elements using resource file
(which allows the UI to be altered without recompiling the application). The resource
file code from the "water hole" specification is: RESOURCE ARRAY r_hrd_query_room_water_hole_choice
{
items =
{
LBUF { txt = qtn_hrd_room_water_hole_link0; },
LBUF { txt = qtn_hrd_room_water_hole_link1; }
};
}
RESOURCE DIALOG r_hrd_query_room_water_hole_choice_box
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtListQueryControl;
id = EListQueryControl;
control = AVKON_LIST_QUERY_CONTROL
{
listtype = EAknCtSinglePopupMenuListBox;
listbox = LISTBOX
{
flags = EAknListBoxMenuList;
height = HRD_QUERY_LISTBOX_HEIGHT;
width = HRD_QUERY_LISTBOX_WIDTH;
array_id = r_hrd_query_room_water_hole_choice;
};
heading = qtn_hrd_your_choice_prompt;
};
}
};
}
While in the game application the following lines of code are created: bgImages[KRoomIdWaterHole] = KBitmapWaterHole;
…
texts[KRoomIdWaterHole] = KTextBlockWaterHole;
…
soundFiles[KRoomIdWaterHole] = KSoundWaterHole;
…
choices[KRoomIdWaterHole] = KChoiceWaterHole; // water_hole
…
links[KRoomIdFog3][1] = KRoomIdWaterHole;
links[KRoomIdWaterHole][0] = KRoomIdDream1;
links[KRoomIdWaterHole][1] = KRoomIdFog4;
In addition, SoProMach adds the scene narrative and choice options to the application
*.loc file. It also adds with detail of image and sound file to the bld.inf, *.mmp
file, and *.pkg file.
Clearly there is a significant amount of effort involved in creating the original
story engine stamp for SoProMach, however once that had been completed the ability
to create story book style games has become trivial from the C++ development point
of view.
The same story engine and SoProMach software factory could also be used for a
wide range of other applications where the content could be divided into "pages"
to relate some form of "story", such as:
- Soap operas
- Product guides
- Repair manuals
- Travel guides
- Quizzes
- Questionnaires
Unfortunately SoProMach is not sufficiently sophisticated to create the games
image and sound files from a textual description, that job still requires human
designers!
The Harpsichord Riddle is an entertaining, if not overly demanding, story game,
and is quite good value at $9.99. It will take a few hours to solve, but its fixed
linear nature means that once the riddle is solved there is little incentive to
revisit the game.
While Somusar undoubtedly hope to make some money from sales of the game its
primary purpose is to showcase the SoProMach technology. Code generation offers
a option to developers who are creating application which contain repeated elements
of processing. However, with RAD tools for Symbian platforms such as S60 and UIQ
due to be released in 2006 SoProMach will face some interesting competition from
tools which have more obvious benefits. Nonetheless, SoProMach has been successfully
integrated with Eclipse, and Somusar expect to have it running within Carbide.c++ in the future.
To find out more about SoProMach visit the Somusar Web site at www.somusar.com. The Harpsichord Riddle is available here from the SymbianOne shop, the game offers limited play until registered. |