Entities are the second major component of Quake MAP files. 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 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 BSP, you add entities with a dedicated Entities window:
Select the entity you want from the pull down menu at the top. Right below it is a brief description of what that entity is. Make sure to scroll down in that window, because it will have more info than is immediately visible (note to Yahn: make that window larger and resizable). Complex entities with multiple spawnflags will list all of the keys and the values that can be entered. See more below in the section on Spawnflags.
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.
Right below the Entity description are the Not In Spawnflags, listed as a bunch of checkboxes. As the above picture shows, the Not in Easy, Not in Normal, etc. flags are there on the far right.
Below the spawnflags check boxes is a window that provides information on the Entity, not the least of which is the X/Y/Z position of the entity. This will be a huge help when you're dealing with items that fell out.
Attached entity brushes can have an "origin" tag. It can be used to offset where they appear in the level.
For the rest of the document, when I give you frameworks for a structure, the individual entries can be in any order, and lots are optional. I try to mark if an entry is optional, although this has not yet been rigorously tested.
In a "" block, your choices for that block are delimited by commas.
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).
Vertex manipulation aside, the handling of spawnflags is one of the biggest differentiators of BSP from Worldcraft. Spawnflags are set through the "Key" and "Value" entry bars in the Entity window. In Worldcraft, spawnflags are set through SmartEdit. In BSP, they are set through "Key" and "Value", and the values you enter are the basic MAP codes.
For example, a crucified Zombie. In Worlcraft, you set it in the Flags menu item under Properties. Like so:
In BSP, you type "crucified" in the "Key" window. Note the help listed right below the monster_zombie flag in the pull down menu, and that I've entered the Key.
At the bottom left of the window is the direction setting. BSP sets the direction that player starts, teleport locations, and monsters will face using 360 degrees of rotation to determine which way the entity faces. The directions are determined by the overhead view, in the X/Y window. The four main directions are:
0 - Right 90 - North 180 - Left 270 - South
There are also directions for northeast, northwest, southeast and southwest. For doors, click on "Up" and "Dn" to make the door go up or down. These spawnflags are set as -1 (up) or -2 (down) in Worldcraft and some other editors.
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)
Once you've decided on the spawnflags for your entity, click on "Make Entity."
The "Key" entry is for additional spawnflags. If you don't see a "Value" entry line, there are no additional spawnflags for that particular entities.
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.
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 settings have to be declared in BSP through the Entities window. When you select an entities and bring up the Entities window, you can make any one of a number of changes for 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.
For health items, the direction is not important. In BSP, the default for health items is normal, ie. 25 HP. Checking "rotten" makes it 15 HP (and if you scroll down in the info box you'll see it), and "megahealth" makes it 100 HP. The four checkboxes, as I said, are to make the health item not available on a certain skill level.
A trick: Add two health items in the same area. For the 25 HP one, select "!Hard." For the second health item, select "Rotten" and "!Easy" and "!Normal." This way, Easy and Normal gives the player a 25 HP health. Hard gives them only 15 HP.
-------------------------------------------------------------------------------- "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.
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 than 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.