Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   Compound Members   Related Pages  

General Information

in-game objects and statically used objects

In Xē there are two kinds of objects:

-instantiated objects like ships or factories for in-game objects that can also be created by a programmer
-static objects making up the functionality of the game (besides the "systemcalls") which is used by a programmer.

Differences of in-game objects

There is a difference between the so called "Sector-Object" and the "Galaxy-Object".
The X-Universum consists of distinct sectors.
The sector in which the player resides is called "active sector".
Objects in an active sector have a visible representation in the graphics-engine.
Objects in all other sectors do the same things too (factories are producing, ships execute commands...) but the code in the in-game objects treats both cases eventually different. Although it is spoken of a sector and a galaxy object they are nevertheless the same.

Therefore, all in-game objects have the following functions in common:

GetGType() returns the galaxy-type of the object
GetGSubType() returns the galaxy-subtype of the object

GetType() returns the sector-type of the object
GetSubType() returns the sector-subtype of the object

Functions common in every object

void AddTo(GALOBJ env)
Adds object to the given environment.

GALOBJ Create(int x, int y, int z, int ssubtype, int raceid)
creates a object with given parameters an returns the created object itself. See Constant Definitions used in Xē and Race IDs.

void Deactivate()
Deactivates and frees an object. Works only for sector objects.

GALOBJ Destruct()
Clears up data of object (stopping tasks, freeing arrays etc.). Returns the destructed object. The function should be called before the object is removed with delete.

GALOBJ GetEnvironment(), void SetEnvironment(GALOBJ)
The environment is an object that surrounds/contains another object. If an object is in space, itīs environment is the sector (SGTYPE_SECTOR or SSTYPE_SECTOR). With this function the environment can be retrieved or set.

GALOBJ GetOwner()
The owner of the object. This is either a raceobject or the playerobject. See also ga_Races[] in Global Variables .

int GetSize(), int GetGSize()
If an object is in actual sector GetSize() returns itīs size. Otherwise GetGSize() is called. GetGSize() returns a size-class used for galaxy objects.

string GetName()
Returns the name of the object.

array GetPos()
Returns an array of the object-position. Format: [x, y, z, rotation-alpha, rotation-beta, rotation-gamma, gdirx, gdiry, gdirz, formation_x, formation_y, formation_z]

void SetPos()
Sets the x,y,z position of the object.

void SetTargetted()
Sets the object as known by player.

void KilledBy(int reason, SECOBID skiller, SECOBID sother)
Object is killed by another object and therefore destroys itself.
"skiller" - the SECOBID of the killer (obtained via "object.GetObjectID()")
"reason" - reason of death (see Reason for death ).
"sother" - this parameter is not used

void SelfDestruct(reason)
Destroys the object (also object is removed with delete). See Reason for death for reason.

SECOBID GetObjectID()
If an object is in the current sector (itīs a sector-object then), the story-engine sets its ObjectID.
This can be obtained with GetObjectID(). If the function returns 0 the object is not in the active sector.
This sector object ID is needed for all SA system calls into the physics (sector) engine.

int GetClass()
Returns the ID of the object-type. The ID corresponds to the objects documented in this documentation (OBJ_*).

BOOL IsClass(para)
Check if the object is of the type given in "para".

Engine Overview

The picture gives an overview which parts of the system uses another part.
engine_overview.jpg

This shows why there has to be a difference between "sector" and "galaxy". Because the economy of the universe depends on the needed wares and itīs availability the system has to maintain thousends of tasks. A task thatīs not located in the actual sector doesnīt need visual representation, thus saving calculation-time. The story engine cares about those things going on in the galaxy and the sector engine manages (also) the visual representation using the B3D and the S3D engine.


For further information see Systemcalls:
SE_ Story Engine System Calls
SA_ Sector Engine System Calls


Generated on Mon Aug 26 18:26:22 2002 for Xē KC by doxygen1.2.17