| Home | Trees | Index | Help |
|---|
| Package tp :: Package client :: Module SinglePlayer :: Class SinglePlayerGame |
|
The single-player game manager. This is the object which should be instantiated externally to create a single player game.
| Method Summary | |
|---|---|
__init__(self)
| |
__del__(self)
| |
Adds an AI client opponent to the game (before starting). | |
Returns information about an AI client. | |
Returns a list of AI clients supporting the current or specified ruleset. | |
Returns the parameter list for the specified AI client. | |
Returns the parameter list for the current or specified ruleset. | |
Returns a list of servers supporting the current or specified ruleset. | |
Returns the parameter list for the current or specified server. | |
Returns information about a ruleset. | |
Returns information about a server. | |
Starts the server and AI clients. | |
Stops the server and AI clients. | |
Internal: formats a parameter value based on type. | |
Internal callback for process termination. | |
Internal callback for process ready state. | |
| Property Summary | |
|---|---|
aiclients | |
rulesets | |
servers | |
| Method Details |
|---|
add_opponent(self, name, user, parameters)
Adds an AI client opponent to the game (before starting).
@param name: The name of the AI client.
@type name: C{string}
@param user: The desired username of the opponent.
@type user: C{string}
@param parameters: A dictionary of parameters in the form {'name', 'value'}.
@type parameters: C{dict}
@return: True if successful, false otherwise.
@rtype: C{bool}
|
aiclient_info(self, ainame=None)
Returns information about an AI client.
@param ainame: AI client name.
@type ainame: C{string}
@return: Information about specified AI client.
@rtype: C{dict}
|
list_aiclients_with_ruleset(self, rname=None)
Returns a list of AI clients supporting the current or specified ruleset.
@param rname: Ruleset name (optional).
@type rname: C{string}
@return: A list of AI clients.
@rtype: C{list} of C{string}
|
list_aiparams(self, ainame)
Returns the parameter list for the specified AI client.
@param ainame: AI client name.
@type ainame: C{string}
@return: The AI client parameter list.
@rtype: C{dict}
|
list_rparams(self, sname=None, rname=None)
Returns the parameter list for the current or specified ruleset.
@param rname: Ruleset name (optional).
@type rname: C{string}
@return: The ruleset parameter list.
@rtype: C{dict}
|
list_servers_with_ruleset(self, rname=None)
Returns a list of servers supporting the current or specified ruleset.
@param rname: Ruleset name (optional).
@type rname: C{string}
@return: A list of servers.
@rtype: C{list} of C{string}
|
list_sparams(self, sname=None)
Returns the parameter list for the current or specified server.
@param sname: Server name (optional).
@type sname: C{string}
@return: The server parameter list.
@rtype: C{dict}
|
ruleset_info(self, rname=None)Returns information about a ruleset. @param rname Ruleset name (optional). @return Information about current or specified ruleset. |
server_info(self, sname=None)
Returns information about a server.
@param sname: Server name (optional).
@type sname: C{string}
@return Information about current or specified server.
@rtype: C{dict}
|
start(self)
Starts the server and AI clients.
@return: Port number (OK to connect) or False.
@rtype: C{int}
|
stop(self)Stops the server and AI clients. Should be called by the client when disconnecting/closing. |
_format_value(self, value, ptype)
Internal: formats a parameter value based on type.
@oaram value: The value to format.
@type value: C{string}
@param ptype: The target value type (I, S, F, B).
@type ptype: C{string}
@return: The formatted value or None.
|
_onexit(self, launcher)
Internal callback for process termination. If called prematurely (i.e.
while the game is still active, stop() has not been called) it raises
a SubprocessError.
@param launcher: Reference to the calling process launcher instance.
@type launcher: L{launcher.Launcher}
|
_onready(self)Internal callback for process ready state. Sets the ready event. |
| Property Details |
|---|
aiclients
|
rulesets
|
servers
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Fri Jan 1 08:00:27 2010 | http://epydoc.sf.net |