Functions

void sleep( uint ms )

Stops thread processing for some number of milliseconds.

void resetLights( )

Resets to default lighting. State of input lights is unchanged.

Object@ makeObject( ObjectDesc& desc )

Create an object based on a description of it. Returns Object@ : Created object.

ObjectGroup@ makeObjectGroup( ObjectDesc& desc, uint count )

Create an object group based on a description of an object. Returns ObjectGroup@ : Created object.

void bindMesh( Object& obj, MeshDesc& desc )

Bind a graphical representation to an object in accordance to a mesh descriptor.

void bindGroupIcon( ObjectGroup& group, const SpriteSheet@ sheet, uint index )

Binds an icon to represent a ship group.

Node@ bindCullingNode( Object& obj, vec3d& position, double radius )

Bind a node that can be used for region culling to the object. Returns Node@ : Handle to the created node.

Node@ createCullingNode( vec3d& position, double radius )

Create a node that can be used for region culling. Returns Node@ : Handle to the created node.

Node@ bindNode( Object& obj, string& type )

Bind a custom graphical node to an object. Returns Node@ : Handle to the created node.

void makeLight( LightDesc& desc )

Create a light based on a description of it.

Object@ getObjectByID( int id )

Returns the Object associated with the ID. Returns Object@ : Null if the object doesn't exist.

Object@ getOrCreateObject( int id )

Get the object belonging to the identifier, or create a dummy object with that id for later initialization. Should only be used for synchronization of objects in multiplayer or during save game loading. Returns Object@ : Object with that identifier.

Object@[]@ findInBox( vec3d& min, vec3d& max, uint ownerFilter = 0 )

Returns an array of objects within the specified region.

Object@ trace( line3dd& ray, uint ownerFilter = 0 )

Returns the first object located along a line. Returns Object@ : First object (if any) hit by the trace.

const SoundSource@ getSound( string& id )

Returns the sound source associated with the id. Returns const SoundSource@ : Can be null if not present.

Sound@ playTrack( string& filename, bool loop = false, bool pause = false )

Plays a streaming sound source from the beginning. Returns Sound@ : Handle to the sound.

Sound@ playTrack( string& filename, vec3d& pos, bool loop = false, bool pause = false )

Plays a streaming sound source from the beginning. Returns Sound@ : Handle to the sound.

bool get_soundEnabled( )

Returns true if the sound system is present (even at 0 volume).

float get_soundVolume( )

Returns the current volume of the sound system. Returns float : Multiplier to output volume between 0 and 1.

void set_soundVolume( float arg0 )

Sets the sound system's volume.

void set_soundScale( float arg0 )

Sets the overall scale of the sound system's world.

string get_profileRoot( )

Returns string : Path to the game's global profile folder.

string get_modProfile( )

Returns string : Path to the current mod's profile folder.

string get_modProfile( string& folder )

Get the path to a child directory in the mod's profile. Returns string : Path to the folder.

string get_baseProfile( string& folder )

Get the path to a child directory in the base profile. Returns string : Path to the folder.

string resolve( string& filename )

Resolves the filename to an absolute path to an overriden file. The top-most mod with a file in the same relative path is used.

void deleteFile( string& filename )

Deletes the specified file. Must be within the profile or game folders.

void makeDirectory( string& dirname )

Create a new directory.

bool isDirectory( string& path )

Check whether a particular path is a directory. Returns bool : Whether a directory exists at that path.

int64 getModifiedTime( string& path )

Get the timestamp a file was last modified at. Returns int64 : Last modification time of file.

bool fileExists( string& path )

Check whether a particular file exists. Returns bool : Whether a file exists at that path.

string path_join( string& first, string& second )

Concatenate two file paths. Returns string : Concatenated path.

string path_up( string& path )

Go up one directory from a path. Returns string : Parent path.

string getBasename( string& path, bool includeExtension = true )

Get the basename of a path. Returns string : Path basename.

void openBrowser( string& url )

Open a URI in the user's configured browser.

double getExactTime( )

Returns nanosecond-accurate system time in seconds (slow).

double get_gameTime( )

Returns the current game clock, updated periodically, in seconds.

double get_frameTime( )

Returns the current frame time in seconds.

double get_frameLength( )

Returns the timespan represented by this frame in seconds.

uint get_systemTime( )

Returns millisecond-accurate system time in milliseconds.

double randomd( )

Generate a random double value. Returns double : Random value from [0.0,1.0).

double randomd( double min, double max )

Generate a random double value. Returns double : Random value from [min,max).

float randomf( )

Generate a random float value. Returns float : Random value from [0.f,1.f).

float randomf( float min, float max )

Generate a random float value. Returns float : Random value from [min,max).

uint randomi( )

Generate a random uint value. Returns uint : Random value from 0 to UINT_MAX, inclusive.

int randomi( int min, int max )

Generate a random int value. Returns int : Random value from min to max, inclusive.

double normald( double min, double max, int steps = 3 )

Generates an approximately normally distributed value within a range, within an average return at the mean of min and max. Returns double : Random value from [min,max)

vec3d random3d( double radius = 1.0 )

Generates a random 3D rotation, uniformly distributed over a sphere surface. Returns vec3d : Random rotation vector.

vec2d random2d( double radius = 1.0 )

Generates a random 2D rotation, uniformly distributed over a circle's circumference. Returns vec2d : Random rotation vector.

vec3d random3d( double minRadius, double maxRadius )

Generates a random 3D rotation, distributed evenly on the volume between minRadius and maxRadius. Returns vec3d : Random rotation vector.

vec2d random2d( double minRadius, double maxRadius )

Generates a random 2D rotation, distributed evenly on the area between minRadius and maxRadius. Returns vec2d : Random rotation vector.

double clamp( double value, double minimum, double maximum )

Clamps the value to within the specified range.

int clamp( int value, int minimum, int maximum )

Clamps the value to within the specified range.

void quarticRoots( double a, double b, double c, double d, double e, double[]& roots )

Calculates all real roots of a quartic polynomial.

vec3d toVec3d( string& str )

Parses a vec3d printed by vec3d::toString()

void addConsoleCommand( string& name, ConsoleCommand@ comm )

Registers a script console command.

string format( string& fmt, string& arg1 )

Replaces $n in fmt with the related argument. Returns string : Formatted string.

string format( string& fmt, string& arg1, string& arg2 )

Replaces $n in fmt with the related argument. Returns string : Formatted string.

string format( string& fmt, string& arg1, string& arg2, string& arg3 )

Replaces $n in fmt with the related argument. Returns string : Formatted string.

string format( string& fmt, string& arg1, string& arg2, string& arg3, string& arg4 )

Replaces $n in fmt with the related argument. Returns string : Formatted string.

string format( string& fmt, string& arg1, string& arg2, string& arg3, string& arg4, string& arg5 )

Replaces $n in fmt with the related argument. Returns string : Formatted string.

string format( string& fmt, string[]& args )

Replaces $n in fmt with the related argument. Returns string : Formatted string.