Entity

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
m
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
 
'''Entity''' (edict, object) - any object in game world. Players, Monsters, Items etc. are entities.
 
'''Entity''' (edict, object) - any object in game world. Players, Monsters, Items etc. are entities.
  
There is 3 types of game entities, depends on what programs they exists:
+
== Game entity ==
  
* Game entity
+
Each game entity have unique number (a position in entities array) and set of fields. Set of fields are shared between all entities, but their usage is based on entity class and subclass functions.  It means if "health" field is defined, any entity can access it, but based on entity class, it can have different meaning. There is system fields used by engine routines (spawnflags, movetype).
** Server entity (actual game entity, get saved to savegames)
+
** Client entity (networked game entity on a client)
+
** Menu entity (exists only in menu program which is a separated from a client because client program get unloaded when level changes)
+
* Network entity - legacy engine-based networking (not using client-side progs)
+
* Render entity - a Network/Client entity that is sent to render.
+
  
=== Game entity structure ===
+
Entity fields can be one of 5 types:
 +
* float - 32bit float value
 +
* vector - 3-dimensional vector (3 floats)
 +
* entity - pointer to another entity (really integer number)
 +
* string - pointer to a string (strings are stored in special memory zones - constant strings, temp strings, zoned strings).
 +
* function - funtion pointer
  
Each game entity have:
+
Depending of engine build, strings could be from 1024(game build) to 16384 (developer build) characters long. Max entities is also 2048 in game build and 128k in development build.
* entity number (index in global entity storage)
+
 
* entity class (code-driven behavior)
+
When game is saved engine writes all entity keys except ones prefixed with ''_''. This fields are meant to be runtime-only.
* fields (or keys) - entity properties.
+
  
 
Example of entity fields:
 
Example of entity fields:
  health - health of entity
+
origin - position or entity in the world space
  classname - entity class name
+
  health - health of monster/trigger
 +
  classname - entity class name (a function called after entity get spawned)
 +
th_die - internal game field, a game function to call when monster dies
 +
_next - system field used by entity chain routines
 
  _ls - q3map2 field, sets scale of lightmaps to be generated for entity surfaces
 
  _ls - q3map2 field, sets scale of lightmaps to be generated for entity surfaces
  
In QuakeC, all entities shares the same fieldset. But on different entity classes, same fields can have different functionality.
+
== Other entities ==
 
+
Game entity represents server entity - entity spawned and processed on server programs. There are more entitity types created and processed in other programs:
==== Fields classification ====
+
  
* Common field - field of entity that can be set in level editor (such as '''origin''')
+
* Client entity (networked game entity on a client)
* Gamecode field - this one is being set by gamecode, not acessible in level editor
+
* Menu entity (exists only in menu program which is a separated from a client because client program get unloaded when level changes)
* Non-Saved field - not saved to a savegame filed, this fields always prefixed by _.
+
* Render entity - entity that is sent to render.
* Compiler-only field - this field dont exist in the game logic and only used by Q3map2 to guide compilation of map.
+
  
 
[[Category:Glossary]]
 
[[Category:Glossary]]

Latest revision as of 15:39, 25 September 2012

Entity (edict, object) - any object in game world. Players, Monsters, Items etc. are entities.

[edit] Game entity

Each game entity have unique number (a position in entities array) and set of fields. Set of fields are shared between all entities, but their usage is based on entity class and subclass functions. It means if "health" field is defined, any entity can access it, but based on entity class, it can have different meaning. There is system fields used by engine routines (spawnflags, movetype).

Entity fields can be one of 5 types:

  • float - 32bit float value
  • vector - 3-dimensional vector (3 floats)
  • entity - pointer to another entity (really integer number)
  • string - pointer to a string (strings are stored in special memory zones - constant strings, temp strings, zoned strings).
  • function - funtion pointer

Depending of engine build, strings could be from 1024(game build) to 16384 (developer build) characters long. Max entities is also 2048 in game build and 128k in development build.

When game is saved engine writes all entity keys except ones prefixed with _. This fields are meant to be runtime-only.

Example of entity fields:

origin - position or entity in the world space
health - health of monster/trigger
classname - entity class name (a function called after entity get spawned)
th_die - internal game field, a game function to call when monster dies
_next - system field used by entity chain routines
_ls - q3map2 field, sets scale of lightmaps to be generated for entity surfaces

[edit] Other entities

Game entity represents server entity - entity spawned and processed on server programs. There are more entitity types created and processed in other programs:

  • Client entity (networked game entity on a client)
  • Menu entity (exists only in menu program which is a separated from a client because client program get unloaded when level changes)
  • Render entity - entity that is sent to render.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox