Game

More...

Functions

bool
addBadWord(string badWord)

Add a string to the bad word filter.

bool
containerBoxEmpty(uint mask, Point3F center, float xRadius, float yRadius, float zRadius, bool useClientContainer)

See if any objects of the given types are present in box of given extent.

string
containerFindFirst(uint typeMask, Point3F origin, Point3F size)

Find objects matching the bitmask type within a box centered at point, with extents x, y, z.

string

Get more results from a previous call to containerFindFirst().

string
containerRayCast(Point3F start, Point3F end, uint mask, SceneObject pExempt, bool useClientContainer)

Cast a ray from start to end, checking for collision against items matching mask.

float
containerSearchCurrDist(bool useClientContainer)

Get distance of the center of the current item from the center of the current initContainerRadiusSearch.

float
containerSearchCurrRadiusDist(bool useClientContainer)

Get the distance of the closest point of the current item from the center of the current initContainerRadiusSearch.

containerSearchNext(bool useClientContainer)

Get next item from a search started with initContainerRadiusSearch() or initContainerTypeSearch().

bool
containsBadWords(string text)

Checks to see if text is a bad word.

string
filterString(string baseString, string replacementChars)

Replaces the characters in a string with designated text.

void
initContainerRadiusSearch(Point3F pos, float radius, uint mask, bool useClientContainer)

Start a search for items at the given position and within the given radius, filtering by mask.

void
initContainerTypeSearch(uint mask, bool useClientContainer)

Start a search for all items of the types specified by the bitset mask.

string
materialRayCast(Point3F start, Point3F end, uint mask, SceneObject pExempt, bool useClientContainer)

Cast a ray from start to end, checking for collision against items matching mask.

void

Reset FPS stats (fps::)

void
sceneDumpZoneStates(bool updateFirst)

Dump the current zoning states of all zone spaces in the scene to the console.

sceneGetZoneOwner(uint zoneId)

Return the SceneObject that contains the given zone.

bool
spawnObject(class )

Global function used for spawning any type of object.

Variables

float

The camera's Field of View.

float

Backwards movement speed for the active player.

bool

Boolean state for it the system is using a keyboard and mouse or not.

float

Downwards movement speed for the active player.

float

Forwards movement speed for the active player.

bool

Boolean state for if freelook is active or not.

float

Left movement speed for the active player.

float

Current pitch value, typically applied through input devices, such as a mouse.

float

Downwards pitch speed.

float

Upwards pitch speed.

float

Right movement speed for the active player.

float

Current roll value, typically applied through input devices, such as a mouse.

float

Left roll speed.

float

Right roll speed.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

float

Upwards movement speed for the active player.

float

Left thumbstick X axis position on a dual-analog gamepad.

float

Right thumbstick X axis position on a dual-analog gamepad.

float

Current yaw value, typically applied through input devices, such as a mouse.

float

Left Yaw speed.

float

Right Yaw speed.

float

Left thumbstick Y axis position on a dual-analog gamepad.

float

Right thumbstick Y axis position on a dual-analog gamepad.

int

Backwards ease for curve movement.

int

Bounce ease for curve movement.

int

Circular ease for curve movement.

int

Cubic ease for curve movement.

float

A scale to apply to the normal visible distance, typically used for tuning performance.

int

Elastic ease for curve movement.

bool

If true, the bad word filter will be enabled.

bool

If true, post effects will be eanbled.

int

Exponential ease for curve movement.

int

In ease for curve movement.

int

InOut ease for curve movement.

int

Linear ease for curve movement.

int

Out ease for curve movement.

int

Quadratic ease for curve movement.

int

Quartic ease for curve movement.

int

Quintic ease for curve movement.

int

Sinusoidal ease for curve movement.

Detailed Description

Functions

addBadWord(string badWord)

Add a string to the bad word filter.

The bad word filter is a table containing words which will not be displayed in chat windows. Instead, a designated replacement string will be displayed. There are already a number of bad words automatically defined.

Parameters:

badWord

Exact text of the word to restrict.

return:

True if word was successfully added, false if the word or a subset of it already exists in the table

// In this game, "Foobar" is banned
%badWord = "Foobar";

// Returns true, word was successfully added
addBadWord(%badWord);

// Returns false, word has already been added
addBadWord("Foobar");

containerBoxEmpty(uint mask, Point3F center, float xRadius, float yRadius, float zRadius, bool useClientContainer)

See if any objects of the given types are present in box of given extent.

note:

Extent parameter is last since only one radius is often needed. If one radius is provided, the yRadius and zRadius are assumed to be the same. Unfortunately, if you need to use the client container, you'll need to set all of the radius parameters. Fortunately, this function is mostly used on the server.

Parameters:
mask

Indicates the type of objects we are checking against.

center

Center of box.

xRadius

Search radius in the x-axis. See note above.

yRadius

Search radius in the y-axis. See note above.

zRadius

Search radius in the z-axis. See note above.

useClientContainer

Optionally indicates the search should be within the client container.

return:

true if the box is empty, false if any object is found.

containerFindFirst(uint typeMask, Point3F origin, Point3F size)

Find objects matching the bitmask type within a box centered at point, with extents x, y, z.

return:

The first object found, or an empty string if nothing was found. Thereafter, you can get more results using containerFindNext().

containerFindNext()

Get more results from a previous call to containerFindFirst().

note:

You must call containerFindFirst() to begin the search.

return:

The next object found, or an empty string if nothing else was found.

containerRayCast(Point3F start, Point3F end, uint mask, SceneObject pExempt, bool useClientContainer)

Cast a ray from start to end, checking for collision against items matching mask.

If pExempt is specified, then it is temporarily excluded from collision checks (For instance, you might want to exclude the player if said player was firing a weapon.) Parameters:

start

An XYZ vector containing the tail position of the ray.

end

An XYZ vector containing the head position of the ray

mask

A bitmask corresponding to the type of objects to check for

pExempt

An optional ID for a single object that ignored for this raycast

useClientContainer

Optionally indicates the search should be within the client container.

return:

A string containing either null, if nothing was struck, or these fields:

  • The ID of the object that was struck.

  • The x, y, z position that it was struck.

  • The x, y, z of the normal of the face that was struck.

  • The distance between the start point and the position we hit.

containerSearchCurrDist(bool useClientContainer)

Get distance of the center of the current item from the center of the current initContainerRadiusSearch.

Parameters:

useClientContainer

Optionally indicates the search should be within the client container.

return:

distance from the center of the current object to the center of the search

containerSearchCurrRadiusDist(bool useClientContainer)

Get the distance of the closest point of the current item from the center of the current initContainerRadiusSearch.

Parameters:

useClientContainer

Optionally indicates the search should be within the client container.

return:

distance from the closest point of the current object to the center of the search

containerSearchNext(bool useClientContainer)

Get next item from a search started with initContainerRadiusSearch() or initContainerTypeSearch().

Parameters:

useClientContainer

Optionally indicates the search should be within the client container.

return:

the next object found in the search, or null if no more

// print the names of all nearby ShapeBase derived objects
%position = %obj.getPosition;
%radius = 20;
%mask = $TypeMasks::ShapeBaseObjectType;
initContainerRadiusSearch( %position, %radius, %mask );
while ( (%targetObject = containerSearchNext()) != 0 )
{
   echo( "Found: " @ %targetObject.getName() );
}

containsBadWords(string text)

Checks to see if text is a bad word.

The text is considered to be a bad word if it has been added to the bad word filter.

Parameters:

text

Text to scan for bad words

return:

True if the text has bad word(s), false if it is clean

see:

filterString()

// In this game, "Foobar" is banned
%badWord = "Foobar";

// Add a banned word to the bad word filter
addBadWord(%badWord);

// Create the base string, can come from anywhere like user chat
%userText = "Foobar";

// Create a string of random letters
%replacementChars = "knqwrtlzs";

// If the text contains a bad word, filter it before printing
// Otherwise print the original text
if(containsBadWords(%userText))
{
  // Filter the string
  %filteredText = filterString(%userText, %replacementChars);

  // Print filtered text
  echo(%filteredText);
}
else
  echo(%userText);

filterString(string baseString, string replacementChars)

Replaces the characters in a string with designated text.

Uses the bad word filter to determine which characters within the string will be replaced.

Parameters:

baseString

The original string to filter.

replacementChars

A string containing letters you wish to swap in the baseString.

return:

The new scrambled string

see:

containsBadWords()

// Create the base string, can come from anywhere
%baseString = "Foobar";

// Create a string of random letters
%replacementChars = "knqwrtlzs";

// Filter the string
%newString = filterString(%baseString, %replacementChars);

// Print the new string to console
echo(%newString);

initContainerRadiusSearch(Point3F pos, float radius, uint mask, bool useClientContainer)

Start a search for items at the given position and within the given radius, filtering by mask.

Parameters:

pos

Center position for the search

radius

Search radius

mask

Bitmask of object types to include in the search

useClientContainer

Optionally indicates the search should be within the client container.

initContainerTypeSearch(uint mask, bool useClientContainer)

Start a search for all items of the types specified by the bitset mask.

Parameters:

mask

Bitmask of object types to include in the search

useClientContainer

Optionally indicates the search should be within the client container.

materialRayCast(Point3F start, Point3F end, uint mask, SceneObject pExempt, bool useClientContainer)

Cast a ray from start to end, checking for collision against items matching mask.

If pExempt is specified, then it is temporarily excluded from collision checks (For instance, you might want to exclude the player if said player was firing a weapon.) Parameters:

start

An XYZ vector containing the tail position of the ray.

end

An XYZ vector containing the head position of the ray

mask

A bitmask corresponding to the type of objects to check for

pExempt

An optional ID for a single object that ignored for this raycast

useClientContainer

Optionally indicates the search should be within the client container.

return:

A string containing either null, if nothing was struck, or these fields:

  • The ID of the object that was struck.

  • The x, y, z position that it was struck.

  • The x, y, z of the normal of the face that was struck.

  • The distance between the start point and the position we hit.

resetFPSTracker()

Reset FPS stats (fps::)

sceneDumpZoneStates(bool updateFirst)

Dump the current zoning states of all zone spaces in the scene to the console.

Parameters:

updateFirst

If true, zoning states are brought up to date first; if false, the zoning states are dumped as is.

note:

Only valid on the client.

sceneGetZoneOwner(uint zoneId)

Return the SceneObject that contains the given zone.

Parameters:

zoneId

ID of zone.

return:

A SceneObject or NULL if the given zoneId is invalid.

note:

Only valid on the client.

spawnObject(class )

Global function used for spawning any type of object.

Note: This is separate from SpawnSphere::spawnObject(). This function is not called off any other class and uses different parameters than the SpawnSphere's function. In the source, SpawnSphere::spawnObject() actually calls this function and passes its properties (spawnClass, spawnDatablock, etc).

Parameters:

class

Mandatory field specifying the object class, such as Player or TSStatic.

datablock

Field specifying the object's datablock, optional for objects such as TSStatic, mandatory for game objects like Player.

name

Optional field specifying a name for this instance of the object.

properties

Optional set of parameters applied to the spawn object during creation.

script

Optional command(s) to execute when spawning an object.

// Set the parameters for the spawn function
%objectClass = "Player";
%objectDatablock = "DefaultPlayerData";
%objectName = "PlayerName";
%additionalProperties = "health = \"0\";"; // Note the escape sequence \ in front of quotes
%spawnScript = "echo(\"Player Spawned\");" // Note the escape sequence \ in front of quotes
// Spawn with the engine's Sim::spawnObject() function
%player = spawnObject(%objectClass, %objectDatablock, %objectName, %additionalProperties, %spawnScript);

Variables

float $cameraFov 

The camera's Field of View.

float $mvBackwardAction 

Backwards movement speed for the active player.

bool $mvDeviceIsKeyboardMouse 

Boolean state for it the system is using a keyboard and mouse or not.

float $mvDownAction 

Downwards movement speed for the active player.

float $mvForwardAction 

Forwards movement speed for the active player.

bool $mvFreeLook 

Boolean state for if freelook is active or not.

float $mvLeftAction 

Left movement speed for the active player.

float $mvPitch 

Current pitch value, typically applied through input devices, such as a mouse.

float $mvPitchDownSpeed 

Downwards pitch speed.

float $mvPitchUpSpeed 

Upwards pitch speed.

float $mvRightAction 

Right movement speed for the active player.

float $mvRoll 

Current roll value, typically applied through input devices, such as a mouse.

float $mvRollLeftSpeed 

Left roll speed.

float $mvRollRightSpeed 

Right roll speed.

int $mvTriggerCount0 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int $mvTriggerCount1 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int $mvTriggerCount2 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int $mvTriggerCount3 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int $mvTriggerCount4 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

int $mvTriggerCount5 

Used to determine the trigger counts of buttons. Namely used for input actions such as jumping and weapons firing.

float $mvUpAction 

Upwards movement speed for the active player.

float $mvXAxis_L 

Left thumbstick X axis position on a dual-analog gamepad.

float $mvXAxis_R 

Right thumbstick X axis position on a dual-analog gamepad.

float $mvYaw 

Current yaw value, typically applied through input devices, such as a mouse.

float $mvYawLeftSpeed 

Left Yaw speed.

float $mvYawRightSpeed 

Right Yaw speed.

float $mvYAxis_L 

Left thumbstick Y axis position on a dual-analog gamepad.

float $mvYAxis_R 

Right thumbstick Y axis position on a dual-analog gamepad.

int Back 

Backwards ease for curve movement.

int Bounce 

Bounce ease for curve movement.

int Circular 

Circular ease for curve movement.

int Cubic 

Cubic ease for curve movement.

float distanceScale 

A scale to apply to the normal visible distance, typically used for tuning performance.

int Elastic 

Elastic ease for curve movement.

bool enableBadWordFilter 

If true, the bad word filter will be enabled.

bool enablePostEffects 

If true, post effects will be eanbled.

int Exponential 

Exponential ease for curve movement.

int In 

In ease for curve movement.

int InOut 

InOut ease for curve movement.

int Linear 

Linear ease for curve movement.

int Out 

Out ease for curve movement.

int Quadratic 

Quadratic ease for curve movement.

int Quartic 

Quartic ease for curve movement.

int Quintic 

Quintic ease for curve movement.

int Sinusoidal 

Sinusoidal ease for curve movement.