Constants Module

This module implement all constants used by the game.
Do not directly edit this one.

Configure your client

To configure the client, edit this config file. His documentation can be found here.

Configure your server

To configure the server, edit this config file. His documentation can be found here.

About specification:

In particular, the following constants are convention, fixed in the specification:
  • LX_CST=11 – dimension of the board for x (horizontal),
  • LY_CST=11 – dimension of the board for y (vertical),
  • NB_PLAYER=3 – number of client for the game,
  • pv_Init=3 – initial number of PV for a player (have to be the same both in client and server),
  • force_default=4 – distance of explosion for a bomb (only fixed for the server),
  • NB_BOMB_MAX_ALLOW=1 – max number of bomb allowed to be possessed by one player at any moment,
  • PORT_INIT=12882 – default port for the client and the server.

About other conventions:

  • a spot is free (i.e. a player can move there) if there is no wall (destructible or not), and if there is no bomb. It is better because that allows players to block each other with their bomb (and, of course, to be blocked by their own bomb).
  • that mean a spot is free even if a player is already in it.
  • when the explosion of a bomb reach an other bomb, it should trigger the explosion of the new one (that allows chain reaction, and it’s more funny).
  • a bomb should hurt a player regardless of who initially plant it.
  • the server is the oracle for the game : from the point of view of the client, each order coming from the server is to take au pied de la lettre, i.e. as pure truth (that means, no verification of incoming order is required, even in a good client).

The constants are sorted by modules. Some tool functions are also defined here, mainly for textual mod (TUI).

Constants.NB_PLAYER = 3

Number of player for the game.

Constants.LX_CST = 11

Dimension of the board, over the x axis (horizontal)

Constants.LY_CST = 11

Dimension of the board, over the y axis (vertical)

Constants.pv_Init = 3

Have to be the same for all player

Constants.clearScreen() → unit

To erase the current screen.

Constants.PRINT_CLEAR_EACH_TIME = False
For printing, erase the screen or not before print the map
It is better not to, because that take a lot of unused space in your terminal emulator buffer.
Constants.print_clear(e) → unit[source]

Clear the screen if [PRINT_CLEAR_EACH_TIME], then print [e].

Constants.ColorOff(verb=False)[source]

Turn off the support of ANSI Colors. Can be used other somewhere else, or on other modules, AFTER importing ANSIColors module !

Constants.ColorOn(verb=False)[source]

Turn on the support of ANSI Colors. Can be used other somewhere else, or on other modules, AFTER importing ANSIColors module !

Constants.print_pvs_player(pl) → unit[source]

Print the PVs of all the players in pl.

Constants.force_default = 4

Distance of explosion.

Constants.timer_default = 4

In seconds. For the server only.

Constants.power_default = 1

Power of explosion.

Constants.owner_default = None

No player owner the empty default bomb.

Constants.toc_default = 1

Number of tic with one tic() application.

Constants.SIGNAL_WALL_BREAKE = 2

They have to not be modified by some exterior stuffs

Constants.SIGNAL_WALL_NOT_BREAKE = 4

They have to not be modified by some exterior stuffs

Constants.SIGNAL_PLAYER_HURT = 3

Signal returned by the destroy method over a state, if it hurts a player

Constants.SIGNAL_BOMB_HURT = 5

Signal returned by the destroy method over a state, if it hits a bomb

Constants.BREAK_ON_WALL = True

To know if an explosion is stoped by a destructible wall when it is destroyed.

Constants.lx_Max = 19

Max Length of the board over X axis

Constants.ly_Max = 19

Max Length of the board over Y axis

Constants.nbmax_Max = 8

Nb Max of player over the board

Constants.str_of_InfoServer((HOST, PORT))[source]
A very small function to change a tuple (HOST, PORT).
representing informations about a server, to a string.

Warning

Delete it : useless.

Constants.pseudo_Init = 'YouCanSetYourPseudoWithCommand--pseudo'

The default pseudo is your UNIX login, appended with the PID of the current process. This is mainly to force the introduction of differents pseudos for testing.

Constants.color_Init = 'white'

The default color

Constants.death_message_Init = 'You died :('

FIXME find a way to receive it from the server.

Constants.nb_bomb_Init = 0

No bomb on the board initially

Constants.x_Init = 0

Default position for x

Constants.y_Init = 0

Default position for y

Constants.SIGNAL_TYPE_WRONG = 1

The type of i or j in Player.Player.move was not an integer

Constants.SIGNAL_I_NEGATIVE = 2

i in Player.Player.move was not a valid integer

Constants.SIGNAL_J_NEGATIVE = 3

j in Player.Player.move was not a valid integer

Constants.pseudos_CST = ['Aur\xc3\xa9lie', 'Bobby', 'Celia', 'Dalia', '\xc3\x89milie', 'Fhu', 'Gnome', 'Harry']

The default pseudos

Constants.pseudos_IA = ['Anne', 'Bob', 'Clark', 'Dan', 'Emma', 'Fabian', 'George', 'Hermionne', 'Ian', 'John', 'Karol', 'Laura', 'Manu', 'Natalie', 'Oph\xc3\xa9lie', 'Patrice', 'Quention', 'Raoul', 'Susane', 'Tiphaine', 'Ubuntu', 'Valentin', 'Walter', 'Xiu', 'Yoda', 'Zorro']

For the bots.

Constants.colors_CST = ['green', 'red', 'blue', 'black', 'cyan', 'magenta', 'yellow', 'white']

The default colors

Constants.SERVEUR_INIT = '0.0.0.0'

For the server : choose where it is hosted. (simple values, used by server AND client for Bomberman)

Constants.PORT_INIT = 12882

The port of the listening connection for the server.

Constants.info_server_Init = ('0.0.0.0', 12882)

Default value, for testing

Constants.verb = False

To know what message have to be printed or not (better is True)

Constants.verb2 = False

To know what message have to be printed or not (better is False)

Constants.PRINT_ALL_MESSAGE = 1

1 to print messages

Constants.TYPE_MAP = 0

0, or 1 or 2. 0 is cool (players are initially put in the corner).

Constants.NB_BOMB_MAX_ALLOW = 1

Max number of bombs allowed to be droped by one player. Ok that works (can be changed).

Constants.start_position(type=TYPE_MAP, lx=LX_CST, ly=LY_CST, nb=NB_PLAYER) → [integer,.,.], [integer,.,.,.][source]

Starting position, returned as a couple of a list of [nb] integer. Usefull to make the map : there is currently 3 different types of starting values :

  • type = 0:
On the corner, and on the diagonal, near to the corner.
  • type = 1:
Near to the center.
  • type = 2:
Again nearer to the center.

The map is supposed to be just of size 11x11.

Constants.pseudos_colors(nb=3)[source]

8 pseudos and different colors for initializing the datas only. The server have to wait for real connections to be able

to know the real colors and pseudos of the players.
Constants.filename_pickling = 'savegame.ess'

For ParseMessageIn and ParseMessageOut About pickling : to save and restart variables.

Constants.USE_PICKLING = False

If true, use a pickling file to save current game state for the server

Constants.filename_database = 'database_clients.db'

For storing all incoming connections in BombermanServer.py.

Constants.USE_DATABASE = False

If true, use somes tools with a database of all known clients. And print a warning when a new client is detected.

Warning

This is still experimental and quite limited.

Constants.USE_BONUS_SYSTEM = False

Not yet implemented.

Constants.USE_MUSIC = False

Try to know if music will be used.

Constants.USE_SOUND_EFFECT = False

Try to know if sound effects. will be used.

Constants.USE_WINDOW = True

Try to know if a graphical window will be used.

Constants.USE_NOTIFY = False

Try to know if notifications (with notify-send) will be used.

Constants.CLOCK_FREQUENCY = 20.0

Number of loop each seconds.

Constants.USE_FULLSCREEN = False

To use the window in Full screen.

Warning

By now, fullscreen mod is not supported.

Constants.TIME_FADEOUT = 8

When the game is done, a final music is played during this period of time.

Constants.TIME_EXPLOSION = 3.0

Time for the bombs ?

Constants.PROBA_UMUR = 0.08

with probability PROBA_UMUR, a spot is undestructible.

Constants.PROBA_BONUS = 0.05

with probability PROBA_BONUS, a spot contains a bonus. Unused right now.

Constants.INFORM_CLIENTS = False

If true, send messages to client when a new player is connecting or disconnecting.

Constants.USE_DIRECTION_FOR_PLAYER = False

An other experimental functionnality : use differents frames for displaying the player. That means: one picture for all directions (up, down, left and right). By now, it works, but all player look the same (so it less pretty to use it)

Constants.PRINT_ALL_PARSEOUT = False

To be very verbous with all outputed messages (i.e. send to the network), produced with ParseMessageOut

Constants.PRINT_ALL_PARSEIN = False

To be very verbous with all parsed messages, produced with ParseMessageIn

Constants.PLAYER_CHECK_ACTION = False
To check action on client side before sending them for validation.
Still not well functional.

Table Of Contents

Previous topic

ParseCommandArgs Module

Next topic

SimpleGame Module

This Page