2.2.1 Entity Overview:

Entities are one of the major component of Quake MAP files. Structures are the other. An entity is basically a bit like a thing, but they also function as triggers and as pathmarkers. Adding entities will affect your build time, because solid entities (monsters, weapons, armor, ammo, health) have to be lit, so that's one more item for LIGHT to deal with. I once saw a map with 40 lights shoot to 200 entities once I populated it.

A entity statement looks like this:

{
"classname" 	"light"
"origin" 	"0 128 64"
"light" 	"255"
}

This is what is called a general entity statement. It is called a general statement because it does not attach to a brush. An attached entity statement accompany's a brush and the brush entry is nested between the braces for the entity. It looks like this:

{ 
"classname" 	"func_door" 
"angle" 	"0" 
"speed" 	"16" 
"targetname" 	"t1" 	
"sounds" 	"1" 
"wait" 		"16" 

{ 
( 128 0 0 ) ( 128 1 0) ( 128 0 1 ) GROUND1_6 0 0 0 1.0 1.0 
( 256 0 0 ) ( 256 0 1 ) ( 256 1 0) GROUND1_6 0 0 0 1.0 1.0 
( 0 128 0 ) ( 0 128 1 ) ( 1 128 0 ) GROUND1_6 0 0 0 1.0 1.0 
( 0 384 0 ) ( 1 384 0 ) ( 0 384 1 ) GROUND1_6 0 0 0 1.0 1.0
( 0 0 64 ) ( 1 0 64 ) ( 0 1 64 ) GROUND1_6 0 0 0 1.0 1.0 
( 0 0 128 ) (0 1 128 ) ( 1 0 128 ) GROUND1_6 0 0 0 1.0 1.0 
} 
}

In Qoole, you add entities by right clicking where you want to place the entity and scrolling through the menu of items:

Select the entity you want from the pull down menu at the top. Be careful not to let the entity get stuck in a brush. If it's stuck in the brush, chances are the item will fall out of the map or you'll get an error in QBSP.

After placing the entity, you can edit its properties by selecting that entity, then clicking on Entity on the bottom left. For spawnflags with multiple options, Qoole gives you a pulldown menu with the options for you to choose from. See below for more on spawflags. One nice feature of Qoole is that it provides a wireframe rendering of the entity, so you can see how much space it will occupy.

For rotating items (weapons, armor), you will also see lines on the perimeter of the item to give you an idea how much room the item needs to rotate without getting stuck on a wall.

2.2.2 The "spawnflags" tag:

I believe that anything with an origin tag can have an optional 'spawnflags' tag. This is not confirmed, however. Tags can be combined by addition or bitwise or (really the same thing).

The handling of spawnflags is fairly straightforward in Qoole. Simply click on the Entities button on the bottom left and the item's entity menu will come up. Simple items like armor, ammo, and weapons don't have much, just the basic Not in Easy, Not in hard, etc. These are used for setting the availability of items in various skill levels. This also works with monsters.

Some items have their direction set in the spawnflags. These include player starts, teleport locations, moving door directions, and monsters. They move in any 360 degrees horizontally as well as up and down. The view is determined by looking at the entity in the overhead, X/Y view. The four main directions are:

0 - Right
90 - North 
180 - Left 
270 - South

Doors can go up and down as well. These spawnflags are set as -1 (up) or -2 (down) in the Spawnflags entry box for the entity's properties.

This affects almost anything, except rotating items like armor, weapons, and keys. Using this, you can affect the following:

* Which direction the player faces on startup.
* Which direction the play faces after teleporting. 
* Which direction monsters face. 
* The direction doors open.
* The direction spike/laser traps shoot.

Platforms are not affected by this, because you use the target and targetname to dictate the direction of a path_corner entity. (more on that later)

2.2.3 General Entity syntax:

(Thanks to John Wakelin who wrote much of this section)

The entities define the monsters, things, but also the positions in space where something must happen. So they are the Quake equivalent of both the THINGS and the LINEDEF types from DOOM.

The entity definitions are made up of a series of specific details that define what each is, where it starts, when it appears etc. Each specific is followed by a modifier that arguments it. All definitions have the classname specific that identifies that entity. The classname specifics relate intimately with the code lump and are the names of functions written in Quake C.

I have chosen the terms ``specific'' and ``arg'' for the two different parts of each detail of the definition. These terms may or may not suit but, they will have to do until we learn what id calls them.

2.2.4 Setting Spawnflags

Most entities are stand-alone. That is, things like direction or spawnflags, are all you need. For some entities, like a door or gate, you need a "target" and "targetname" to tie the two together. For example, you tie a func_button (a button) or any one of several trigger_ entities (triggers) to a func_door (door, gate) to open a door or gate. This will be discussed in later chapters.

Spawnflags are what you will find if you open a MAP file. Again, we don't edit this way, so these entities have to be added with the Add Entity selection from the right-click menu. Settings are edited by selecting the entity and clicking on the Entities button at the bottom left of the screen. Depending on the entity, you can make lot of changes to the entity.

The spawnflags will vary from one entity to another. For the sake of consistency with the items in the original MAP spec file, I'll use item_health, since we used it above.

For health items, the direction is not important. In Qoole, the default for health items is normal, ie. 25 HP. Selecting "Rotten" from the spawnflags pulldown menu makes it 15 HP, and right below that in the menu is "megahealth," which makes it 100 HP.

A trick: Add two health items in the same area. For the first health item, select "Don't appear if Skill 2" from the spawnflags pulldown menu. For the second health item, select "Rotten" and "Don't appear if Skill 0" and "Don't appear if Skill 1" in the spawnflags. This way, Easy and Normal gives the player a 25 HP health. Hard gives them only 15 HP.

Qoole is a good editing in its handling of spawnflags. It makes almost all of the spawnflags available from a pulldown menu and it explains what they are. Look at the screen capture above for the health item. There can't be much doubt in your mind what each setting is going to do.

2.2.5 Optional Parameters for Entities

Specifics Args Description
--------------------------------------------------------------------------------
"classname" 	"name" 		// Type of entity to be defined (mandatory)
"origin" 	"X Y Z" 	// Coordinates of where it starts in space.
"angle" 	"#" 		// Direction it faces or moves (sometimes in degrees)
"light" 	"#" 		// Used with the light classname.
"target" 	"t#" 		// Matches a targetname.
"targetname" 	"t#" 		// Like a linedef tag.
"killtarget" 	"#" 		// Removes target when triggered?
"spawnflags" 	"#" 		// Used to flag/describe an entity that is not default.
"style" 	"#" 		// Used to flag/describe an entity that is not default.
"message" 	"string"	// Message displayed when triggered (\n for linebreaks)
"mangle" 	"X Y Z" 	// Point where the intermission camera looks at

{BRUSH INFO} // In entities that describe triggers/doors/platforms, etc,
 // the brush info is inserted into the entity brackets,
 // delimited by another set of brackets.

specifics/args present only in models:

"speed" 	"#" 		// How fast the model is moved.
"wait" 		"#" 		// How long a pause between completion of movement or
 				// return to original position (in seconds or 10ths)
"lip" 		"#" 		// Seems to be a means of adjusting the starting position.
"dmg" 		"#" 		// How much damage the model causes when it shuts on you?
"health" 	"#" 		// How much damage the model takes before it triggers
"delay" 	"#" 		// Time before event is triggered
"sounds" 	"#" 		// How much damage the model causes when it shuts on you?
"wad" 		"wadfile" 	// The wad2 graphics file used by the world for textures.
"height" 	"#" 		// How high a platform will raise


---------------------------------------------------------------------------------
{
 "specific1" "arg1" // The first descriptors (usually classname)
 "specific2" "arg2" // The second
 ... // Etc...

 {
 <INSERT BRUSH INFO HERE> // for entities like doors/triggers/platforms/etc
 }
}

Note: The term model refers to a combination of a brush and an entity. One or more brushes are bound to an entity, which controls the behavior of the brushes. All brushes are contained within models.

The model numbers in the compiled BSP (*x) comes from the order in which the models are stored in the models structure. These numbers are originally derived from the order of the models in the source MAP file.

The worldspawn model is a bounding box that defines the extents of the whole world.

The models are defined by a bounding box of the max and min(x,y,z). Therefore they are always parallel to the horizontal planes. This bounding box is simply used for speeding up collision detection and will not affect the movement of the models themselves.

2.2.6 All known entities (current for Shareware Quake 1.01):

air_bubbles                   : Rising bubbles

ambient_drip                  : Dripping sound
ambient_drone                 : Engine/machinery sound
ambient_comp_hum              : Computer background sounds
ambient_flouro_buzz           : Flourescent buzzing sound
ambient_light_buzz            : Buzzing sound from light
ambient_suck_wind             : Wind sound
ambient_swamp1                : Frogs croaking
ambient_swamp2                : Slightly different sounding frogs croaking
ambient_thunder               : Thunder sound

event_lightning               : Lightning (Used to kill Cthon, shareware boss)

func_door                     : Door
func_door_secret              : A door that is triggered to open
func_wall                     : A moving wall?
func_button                   : A button
func_train                    : A platform (moves along a "train")
func_plat                     : A lift/elevator
func_dm_only                  : A teleporter that only appears in deathmatch
func_illusionary              : Creates brush that appears solid, but isn't.

info_null                     : Used as a placeholder (removes itself)
info_notnull                  : Used as a placeholder (does not remove itself)
info_intermission             : Cameras positioning for intermission (?)
info_player_start             : Main player starting point (only one allowed)
info_player_deathmatch        : A deathmatch start (more than one allowed)
info_player_coop              : A coop player start (more than one allowed)
info_player_start2            : Return point from episode
info_teleport_destination     : Gives coords for a teleport destination using a targetname

All item_ tags may have a target tag.  It triggers the event when 
the item is picked up.

item_cells                    : Ammo for the Thunderbolt
item_rockets                  : Ammo for Rocket/Grenade Launcher
item_shells                   : Ammo for both Shotgun and SuperShotgun
item_spikes                   : Ammo for Perforator and Super Perforator
item_weapon                   : Generic weapon class
item_health                   : Medkit
item_artifact_envirosuit      : Environmental Protection Suit
item_artifact_super_damage    : Quad Damage
item_artifact_invulnerability : Pentagram of Protection
item_artifact_invisibility    : Ring of Shadows (Invisibility)
item_armorInv                 : Red armor
item_armor2                   : Yellow armor
item_armor1                   : Green armor
item_key1                     : Silver Key
item_key2                     : Gold Key
item_sigil                    : Sigil (a rune)

light                         : A projected light. No visible lightsource.
light_torch_small_walltorch   : Small wall torch (gives off light)
light_flame_large_yellow      : Large yellow fire (gives off light)
light_flame_small_yellow      : Small yellow fire (gives off light)
light_flame_small_white       : Small white fire  (gives off light)
light_fluoro                  : Fluorescent light? (Gives off light, humming sound?)
light_fluorospark             : Fluorescent light? (Gives off light, makes sparking sound)
light_globe                   : Light that appears as a globe sprite

monster_army                  : Grunt
monster_dog                   : Attack dog
monster_ogre                  : Ogre
monster_ogre_marksman         : Ogre (no different from monster_ogre)
monster_knight                : Knight
monster_zombie                : Zombie
monster_wizard                : Scragg (Wizard)
monster_demon1                : Fiend (Demon)
monster_shambler              : Shambler
monster_boss                  : Cthon (Boss of Shareware Quake)
monster_enforcer              : Enforcer
monster_hell_knight           : Hell Knight
monster_shalrath              : Shalrath
monster_tarbaby               : Slime
monster_fish                  : Fish
monster_oldone                : Shubb-Niggurath
                                       (requires a misc_teleportrain and a info_intermission)

misc_fireball                 : Small fireball (gives off light, harms player)
misc_explobox                 : Large Nuclear Container
misc_explobox2                : Small Nuclear Container
misc_teleporttrain            : Spiked ball needed to telefrag monster_oldone

path_corner                   : Used to define path of func_train platforms

trap_spikeshooter             : Shoots spikes (nails)
trap_shooter                  : Fires nails without needing to be triggered.

trigger_teleport              : Teleport (all trigger_ tags are triggered by walkover)
trigger_changelevel           : Changes to another level
trigger_setskill              : Changes skill level
trigger_counter               : Triggers action after it has been triggered count times.
trigger_once                  : Triggers action only once
trigger_multiple              : Triggers action (can be retriggered)
trigger_onlyregistered        : Triggers only if game is registered (registered == 1)
trigger_secret                : Triggers action and awards secret credit.
trigger_monsterjump           : Causes triggering monster to jump in a direction
trigger_relay                 : Allows delayed/multiple actions from one trigger 
trigger_push                  : Pushes a player in a direction (like a windtunnel)
trigger_hurt                  : Hurts whatever touches the trigger

weapon_supershotgun           : Super Shotgun
weapon_nailgun                : Nailgun
weapon_supernailgun           : Super Nailgun
weapon_grenadelauncher        : Grenade Launcher
weapon_rocketlauncher         : Rocket Launcher
weapon_lightning              : Lightning Gun

The use of these entities will be discussed in other chapters.


Portions Copyright ©1996-97 Niklata and Thomas Winzig.