|
AIConnection Class Reference
[AI, Networking]
Special client connection driven by an AI, rather than a human. More...
Public Member Functions | |
float | getMove (string field) |
Get the given field of a move. | |
bool | getTrigger (int trigger) |
Is the given trigger set? | |
void | setFreeLook (bool isFreeLook) |
Enable/disable freelook on the current move. | |
void | setMove (string field, float value) |
Set a field on the current move. | |
void | setTrigger (int trigger, bool set) |
Set a trigger. | |
Public Attributes | |
string | getAddress |
bool | getFreeLook |
getFreeLook()Is freelook on for the current move? |
Detailed Description
Special client connection driven by an AI, rather than a human.
Unlike other net connections, AIConnection is intended to run unmanned. Rather than gathering input from a human using a device, move events, triggers, and look events are driven through functions like AIConnection::setMove.
In addition to having its own set of functions for managing client move events, a member variable inherited by GameConnection is toggle: mAIControlled. This is useful for a server to determine if a connection is AI driven via the function GameConnection::isAIControlled
AIConnection is an alternative to manually creating an AI driven game object. When you want the server to manage AI, you will create a specific one from script using a class like AIPlayer. If you do not want the server managing the AI and wish to simulate a complete client connection, you will use AIConnection
.To get more specific, if you want a strong alternative to AIPlayer (and wish to make use of the AIConnection structure), consider AIClient. AIClient inherits from AIConnection, contains quite a bit of functionality you will find in AIPlayer, and has its own Player object.
- Example:
// Create a new AI client connection %botConnection = aiConnect("MasterBlaster" @ %i, -1, 0.5, false, "SDF", 1.0); // In another area of the code, you can locate this and any other AIConnections // using the isAIControlled function for(%i = 0; %i < ClientGroup.getCount(); %i++) { %client = ClientGroup.getObject(%i); if(%client.isAIControlled()) { // React to this AI controlled client } }
- Note:
- This is a legacy class, which you are discouraged from using as it will most likely be deprecated in a future version. For now it has been left in for backwards compatibility with TGE and the old RTS Kit. Use GameConnection and AIPlayer instead.
- See also:
- GameConnection, NetConnection, AIClient
Member Function Documentation
float AIConnection::getMove | ( | string | field | ) |
Get the given field of a move.
- Parameters:
-
field One of {'x','y','z','yaw','pitch','roll'}
- Returns:
- The requested field on the current move.
bool AIConnection::getTrigger | ( | int | trigger | ) |
Is the given trigger set?
void AIConnection::setFreeLook | ( | bool | isFreeLook | ) |
Enable/disable freelook on the current move.
void AIConnection::setMove | ( | string | field, | |
float | value | |||
) |
Set a field on the current move.
- Parameters:
-
field One of {'x','y','z','yaw','pitch','roll'} value Value to set field to.
void AIConnection::setTrigger | ( | int | trigger, | |
bool | set | |||
) |
Set a trigger.
Member Data Documentation
string AIConnection::getAddress |
getFreeLook()Is freelook on for the current move?