AIConnection

consoledoc.h

Special client connection driven by an AI, rather than a human.

More...

Public Functions

string
bool

getFreeLook()Is freelook on for the current move?

float
getMove(string field)

Get the given field of a move.

bool
getTrigger(int idx)

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 idx, bool set)

Set a trigger.

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.

// 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.

Public Functions

getAddress()

getFreeLook()

getFreeLook()Is freelook on for the current move?

getMove(string field)

Get the given field of a move.

Parameters:

field

One of {'x','y','z','yaw','pitch','roll'}

return:

The requested field on the current move.

getTrigger(int idx)

Is the given trigger set?

setFreeLook(bool isFreeLook)

Enable/disable freelook on the current move.

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.

setTrigger(int idx, bool set)

Set a trigger.