Entities are the dynamic objects, the actors, monsters, vehicles and other things who can move around in our game world. Additionally to the parameters which can be set in WED's entity property panel, there are many more properties which can be set, evaluated, or changed by functions. These properties influence the entities' look, its reaction to certain events, and its moving or collision behavior. For an overview, see Entity Types.

Entities can be created in three ways:

Entities placed or created in the level are named Level Entities; entities defined in the script are either visible in front of the screen (View Entities) or in the background of the level (Sky Entities). View entities are visible even if there is no level loaded at all, and 'survive' level changes. They can be used to display 3D elements of the user interface, like a rotating compass or a steering wheel . Here's a short table with the main differences between level, view, or sky entities:

Level entities
View entities
Sky entities
Entitity types Model, map, sprite, terrain Model, sprite Model, sprite
Created with WED, ent_create ENTITY* struct, ent_createlayer ENTITY* struct, ent_createlayer
Used for actors, vehicles, vegetation 3D panel elements sky, background, horizon
Rendered in level screen foreground level background
Visible when INVISIBLE flag not set SHOW flag set (flags2) SHOW flag set (flags2)
Removed by ent_remove, level_load ent_remove* ent_remove*
Events collision & mouse none none
Visual order view distance layer layer, view distance
Coordinates world coordinates view coordinates view position, world rotation
* view entities created after level loading must be removed at level change.

View entities are defined in the following way:

ENTITY* name = { . . . }

Within the definition, any entity parameter or flag can be given an initial value. The layer parameter determines the rendering order. The client_id parameter connects the entity to a certain view from which it takes its arc and aspect parameters, the clip borders, and the render target . By default the entity is connected to the camera view.


ENTITY* compass_panel =
  type = "compass.mdl";
  layer = 2; // display above panels with layer 1
  flags2 = SHOW; // visible on screen from the start
x = 100; // place 100 quants ahead of the view y = -50; // 50 to the right z = 0; // and center vertically }


Sky entities are defined in the following way:

ENTITY* name = { ...  flags2 = SKY..; }

Defines a sky texture, sprite, or model with the given name. Sky textures are mapped onto all sky surfaces in the level. Sky models are centered around the camera, so they can cover sky textures, but also level elements, depending on their distance to the camera. An unlimited number of sky entities can be combined. As with view entities, the drawing order is determined by the layer parameter. They are not affected by level light and fog.

Sky entities are either dome, cylinder, or cube mapped, depending on flags given in the definition. When no such flag is set, the sky entity is rendered into the level background at its x y z position given. This way, sun, moon or other celestial objects can be drawn onto the sky.  LC  In lite-C, sky entities are defined the same way as view entities, except that their SKY flag is set.

In a level without map geometry (blocks), a sky that you activate in the script is automatically visible in the background. In a level with map geometry (blocks), the sky is only visible when a block with a sky surface is visible. When using several sky layers, take care to disable any sky layer that is covered by other intransparent layers, and also disable the background color (sky_color). This avoids unnecessary rendering and keeps the frame rate high.

Example (lite-C):

ENTITY* skycube =
  type = "skycube+6.tga"; // the image for a backdrop scene
  flags2 = SKY | CUBE | SHOW; // sky cube, visible

Example (C-Script):

SKY skycube =
  type = "skycube+6.tga"; // the image for a backdrop scene
  flags = CUBE | SHOW; // sky cube, visible

See also:

Entities, ent_create, ent_createlayer, ent_preload, ent_purge, CUBE, DOME, SCENE

► latest version online