Blinker - Tetris

The tetris module provides a tetris game on demand. If starts when the operator connection for the player is established.

Keys

The game is controlled via an operator connection, i.e., via telephone keys. The key have the following functions:
key description
# leave game
* play start sound to inform user about the active game
1 rotate falling stone left (counter-clock-wise)
2 / 3 rotate falling stone right (clock-wise)
4 move falling stone to the left
6 move falling stone to the right
8 drop stone

Configuration

The configuration of the tetris module with name NAME is located in the tetrises/NAME subdirectory.

Colors

The colors of the background and of the stones are configurable. They are given in web notation, i.e., as 6 hexadecimal digits - 2 digits for read, green and blue. The color is automatically converted to the selected format (i.e. number of channels and number of colors). Each color is defined in the appropriate file. If the file is missing or contains an invalid color code, the respective element is not drawn on the frames. The following color files exist:
file name element
backgroundColor background of the tetris field
fixedIColor fixed stones of type "I"
fixedJColor fixed stones of type "J"
fixedLColor fixed stones of type "L"
fixedOColor fixed stones of type "O"
fixedSColor fixed stones of type "S"
fixedTColor fixed stones of type "T"
fixedZColor fixed stones of type "Z"
stoneIColor active stones of type "I"
stoneJColor active stones of type "J"
stoneLColor active stones of type "L"
stoneOColor active stones of type "O"
stoneSColor active stones of type "S"
stoneTColor active stones of type "T"
stoneZColor active stones of type "Z"

Delays

Multiple timins of the tetris game can be configured. This is done by specifying the duration of certain times in the delay files. They contain a number that specifies the time in milliseconds. If the file is not present, a default value is used. The different settings, the valid value ranges and the defaults are listed in the following table:
file name description default minimum maximum
blinkDelay time for blinking of completed rows before they vanish 50 50 250
delay time after which a falling stone moves down a pixel 400 200 1000
dropDelay time after which a dropped stone moves down a pixel 100 50 250
gameOverDelay time the tetris field is still shown after the stones have reached the top before the game ends 2000 100 5000
Please note that the game speeds up a little bit with each completed row.

Format

The file format describes the format of the canvas, i.e. its dimensions, the number of channels and the color depth on each channel. The file must contain a string <width>x<height>-<channels>/<colors>, e.g. 18x8-1/256 for 18 pixels width, 8 pixels height in 256 grayscales.

Locking

It is possible to interlock different games among each other, i.e., to make sure that only one of the those games can be started at the same time. If the file lockName exists, it defines the name of a mutual exclusion lock that is acquired when the game is started. If the lock with this name is already taken by another game, the game will not start.

Output Stream

The file outstream contains the name of the stream to send the frames to. No frames are sent when the game is inactive (i.e. the player has not connected yet).

Sound Names

It is possible to request playing a sound on certain events occuring during the game. The names of the sounds to play are configurable via the following files:
file name play sound on event
gameOverSound stones have reached top of field, game is about to end
rowCompleteSound one row (or multiple rows) have been completed and will vanish
startSound game starts

Operator Connection Interface

The name of the operator connection interface provided by this module is the module name. Thus, it is tetrises/NAME.