Public Member Functions | |
def | __init__ |
def | run |
def | addPoll |
def | switchOffPoll |
def | switchOnPoll |
def | initialState |
def | currentState |
def | pushState |
def | currentStateDiff |
Public Attributes | |
name | |
The Game's name. | |
description | |
The Game's description. | |
space | |
Game's GameSpace object. | |
gameobjects | |
The Game's list of GameObjects (GameObject) | |
teams | |
The Game's list of Teams (Team) | |
isdiscrete | |
Boolean to indicate whether or not the to use self.space.grid for objects position. | |
polls | |
A list of Polls (Poll) | |
activepolls | |
The subset of active Polls (Poll) within self.polls. | |
finit | |
The Game's initialization function. | |
fturn | |
A function to be called on each new turn. | |
fend | |
A function to be called when the game ends. | |
lastturn | |
A boolean that inidicates if the Game's current turn is its last. | |
turncount | |
The number of the current turn. | |
rigidobjects | |
A subset of rigid GameObjects (GameObject) within self.gameobjects. | |
collisions | |
A list of collisions (Collision) to be addressed. | |
statebuff | |
A list of past game states self.paststates[0] is the current state self.paststates[n] is the n'th past state. | |
Static Public Attributes | |
initialstate = None | |
The dictionary containing the Game's initial state information. |
The Class that contains the game itself. It has the game's state and is responsible for its execution
def Game.Game.__init__ | ( | self, | |
name, | |||
description, | |||
space, | |||
gameobjects, | |||
teams, | |||
isdiscrete, | |||
polls, | |||
finit = lambda x: None , |
|||
fturn = lambda x: None , |
|||
fend = lambda x: None , |
|||
statebuffsize = 2 |
|||
) |
Game.__init__(self, name, description, gameobjects, teams, finit = lambda: None, fturn = lambda: None, fend = lambda: None, statebuffsize = 2 ) name is the Game's name description is a brief Game description space is the Game's GameSpace gameobjects is a list of the Game's GameObjects teams is a list of the Game's Teams isdiscrete indicates if the game space is discrete. If so, all objects will be positioned according to space's Grid Cells finit is a function to be called once fturn is a function that marks de division between Game turns fend is a function to be called once right before the Game ends statebuffsize is the size of the states buffer, or how many turns previous to current are stored
def Game.Game.addPoll | ( | self, | |
poll | |||
) |
Game.addPoll(self, poll) A function to add a Poll to a Game. Returns True on success and False on failure
def Game.Game.currentState | ( | self | ) |
Game.currentState(self) Returns a dictionary containing the Game's current state
def Game.Game.currentStateDiff | ( | self, | |
i = 0 , |
|||
j = 1 |
|||
) |
Game.currentStateDiff(self) Returns a minimal dictionary containing only the differences between self.statebuff[i] and self.statebuff[j]. Any object with access to the Game's last state can deduce its current state by the differences. This function is used to minimize the network's communication overhead.
def Game.Game.initialState | ( | self | ) |
Game.initialState(self) Returns a dictionary containg the game initial state and sets static Game.initialstate
def Game.Game.pushState | ( | self, | |
state | |||
) |
Game.pushState(self) adds the argument to self.statebuff
def Game.Game.run | ( | self | ) |
Game.run(self) the Game's execution function
def Game.Game.switchOffPoll | ( | self, | |
poll | |||
) |
Game.switchOffPoll(self, poll) Function to make an active Poll inactive. Returns True on success and False on failure
def Game.Game.switchOnPoll | ( | self, | |
poll | |||
) |
Game.switchOnPoll(self, poll) Function to make an inactive Poll active. Returns True on success and False on failure