tuxemon.middleware module

This module contains the Tuxemon server middleware.

class tuxemon.middleware.Controller(game_server=None)[source]

Bases: object

This middleware will allow you to use the AsteriaServer for Multiplayer games and the mobile controller. When it receives KEYDOWN/KEYUP events, it will set the corresponding dictionary key in “network_events” to true or false. In your main game loop, you can then iterate through this dictionary and change the game accordingly.

Public functions: event_legal – Returns True for all events that pass the legal logic. Returns False for all events that

fail legal logic.

event_execute – Sets the game_server.network_events dictionary based on what key was pressed

Parameters:

game_server (Any) –

event_execute(cuuid, euuid, event_data)[source]
Parameters:
  • cuuid (str) –

  • euuid (str) –

  • event_data (Any) –

Return type:

None

Parameters:
  • cuuid (str) –

  • euuid (str) –

  • event_data (Any) –

Return type:

bool | None

class tuxemon.middleware.Multiplayer(game_server=None)[source]

Bases: object

This middleware will allow you to use the AsteriaServer for Multiplayer games and the mobile controller. When it receives KEYDOWN/KEYUP/NETKBD events, it will set the corresponding dictionary key in “network_events” to true or false. In your main game loop, you can then iterate through this dictionary and change the game accordingly.

Public functions: event_legal – Returns True for all events that pass the legal logic. Returns False for all events that

fail legal logic.

event_execute – Sets the game_server.network_events dictionary based on what key was pressed

Parameters:

game_server (Any) –

event_execute(cuuid, euuid, event_data)[source]
Parameters:
  • cuuid (str) –

  • euuid (str) –

  • event_data (Any) –

Return type:

None

Parameters:
  • cuuid (str) –

  • euuid (str) –

  • event_data (Any) –

Return type:

bool