Package horizons :: Module manager :: Class MPManager
[hide private]
[frames] | no frames]

Class MPManager

source code

util.living.LivingObject --+
                           |
                          MPManager

Handler for commands. Initiates sending commands over the network for multiplayer games and their correct execution time and is also responsible for handling lags

Instance Methods [hide private]
 
__init__(self, session, networkinterface)
Initialize the Multiplayer Manager
source code
 
end(self)
Put all the code the object needs to end safely here.
source code
 
can_tick(self, tick)
Checks if we can execute this tick via return value
source code
 
tick(self, tick)
Do the tick (execute all commands for this tick) This code may only be reached if we are allowed to tick now (@see can_tick)
source code
 
can_hash_value_check(self, tick) source code
 
hash_value_check(self, tick) source code
 
hash_value_diff(self, player1, hash1, player2, hash2)
Called when a divergence has been detected
source code
 
calculate_execution_tick(self, tick) source code
 
calculate_hash_tick(self, tick) source code
 
execute(self, command, local=False)
Receive commands to be executed from local player
source code
 
get_player_count(self) source code
 
get_builds_in_construction(self)
Returns all Build-commands by the local player, that are executed in the next ticks
source code
 
load(self, db)
Execute outstanding commands, loaded from db.
source code
Class Variables [hide private]
  log = logging.getLogger("mpmanager")
  command_log = logging.getLogger("mpmanager.commands")
  EXECUTIONDELAY = 4
  HASHDELAY = 4
  HASH_EVAL_DISTANCE = 2
Method Details [hide private]

end(self)

source code 

Put all the code the object needs to end safely here. Make sure it always contains the super(YOUROBJECT, self).end() call, to ensure all parentobjects are deinited correctly.

Overrides: util.living.LivingObject.end
(inherited documentation)

execute(self, command, local=False)

source code 

Receive commands to be executed from local player

Parameters:
  • command - Command instance
  • local - commands that don't need to be sent over the wire

load(self, db)

source code 

Execute outstanding commands, loaded from db. Currently not supported for MP