Blinker - Pong

The pong module provides a pong game on demand. There are two potential operator connections - one for the left player and one for the right player. The game starts as soon as the first player joins. In case only one player is in the game, the other side is played by the computer.

Keys

The game is controlled via operator connections, i.e., via telephone keys. The key have the following functions:
key description
# leave game
* play left or right player sound to inform user about the active game and the side on which he is playing
2 move paddle up
8 move paddle down

Configuration

The configuration of the pong module with name NAME is located in the pongs/NAME subdirectory.

Colors

The colors of the different elements of a pong field are configurable. All of them 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 pong field
ballColor pong ball
computerColor pad played by the computer
goalColor game score when a goal has been scored
lineColor line in the middle of the field
padColor pad played by a real player
scoreColor game score when the ball is moving

Delay

The file delay describes the duration of a frame / a step of the game. It contains a number that specifies the time in milliseconds. Valid values are from 100 to 500. In case the file is not present, a default of 200 is used. Please note that the game speeds up a little bit when the ball bounces a pad and when a goal is scored.

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.

Maximum Score

The file maxScore configures at which score the game ends. The file contains this maximum score as a number. Valid values are from 1 to 99. In case the file is not present, a default of 9 is used.

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. no player has joined 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
leftPlayerSound player entered the game as left player
rightPlayerSound player entered the game as right player
scoreSound player scored a goal
otherScoreSound other player scored a goal
winSound player wins game
looseSound player looses game

Operator Connection Interfaces

The name of the operator connection interfaces provided by this module is the module name plus the side of the player. Thus, the operator connection interface for the left player is pongs/NAME/left and the one for the right player is pongs/NAME/right.