Entity

From Blood Wiki
Revision as of 15:39, 25 September 2012 by VorteX (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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