The tetris module provides a tetris game on demand. If starts when the operator connection for the player is established.
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 |
The configuration of the tetris module with name NAME
is located in the tetrises/NAME
subdirectory.
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 | |
stoneColor |
stones - falling stone as well as fixed stones |
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 |
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.
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.
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).
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 |
The name of the operator connection interface provided by this module
is the module name. Thus, it is tetrises/NAME
.