Quake DeveLS - Temporary Entities

Tutorial: ViDMaSTeR
Information: WolfWings, ShockMan, and Nightbringer
Difficulty:
Relatively Easy

Temporary Entity Packet Formats:

1) {Byte count, Position origin, Dir direction, Byte color}
          - Spawns {count} particles at {origin} of {color} moving in {direction}

TE_LASER_SPARKS - Particles obey gravity
TE_WELDING_SPARKS - Particles obey gravity, flash of light at {origin}
TE_SPLASH - Randomly shaded shower of particles
0 - SPLASH_UNKNOWN
1 - SPLASH_SPARKS
2 - SPLASH_BLUE_WATER
3 - SPLASH_BROWN_WATER
4 - SPLASH_SLIME
5 - SPLASH_LAVA
6 - SPLASH_BLOOD
All others are grey.

To set the color to whatever you want, set  the color to 0x000000pp where pp is the index number in the palette in hexadecimal value... ie.from 00 to ff.

Hexadecimal explaination:

0-9 is 0 to 9. a = 10, b = 11, c = 12, d = 13, e = 14, f = 15. So if you want for example 126 you take 126/16=7.875. That makes the first number 7 and the second will be whats left (126 - 7*16 = 14). And since 14 is equal to e the final value will be 7e.

2) {Short self-g_edicts, Position start, Position end}
          - Creates a string of models

TE_GRAPPLE_CABLE - The CTF grappling hook cable. Uses the model in models/ctf/segment/tris.md2
TE_MEDIC_CABLE_ATTACK - The medic's cable. Uses /models/monsters/parasite/segment/tris.md2 as it's model.
TE_PARASITE_ATTACK - The parasite's tentacle. Uses /models/monsters/parasite/segment/tris.md2 as it's model.

3) {Position start, Position end}
          - Spawns a trail from {start} to {end}

TE_BFG_LASER - Spawns a green laser
TE_BUBBLETRAIL - Spawns a trail of bubbles
TE_PLASMATRAIL - Spawns random green arcs
TE_RAILTRAIN - Spawns a blue spiral trail filled with white smoke

4) {Position origin, Dir direction}
          - Spawns at {origin} and moving towards {direction}

TE_BLASTER - Spawns a blaster splash
TE_BLOOD - Spawns a spurt of red blood
TE_BULLET_SPARKS - Same as TE_SPARKS, with a bullet puff and richochet sound
TE_GREENBLOOD - Spawns a spurt of green blood
TE_GUNSHOT - Spawns a grey splash of particles, with a bullet puff
TE_SCREEN_SPARKS - Spawns a large green/white splash
TE_SHIELD_SPARKS - Spawns a large blue/violet splash
TE_SHOTGUN - Spawns a small grey splash of particles, with a bullet puff
TE_SPARKS - Spawns a red/gold splash of particles

5) {Position origin}
          - Spawns at {origin}

TE_BFG_BIGEXPLOSION - Spawns a BFG particle explosion
TE_BFG_EXPLOSION - Spawns a BFG explosion sprite
TE_BOSSTPORT - Spawns a mushroom-cloud particle effect
TE_EXPLOSION1 - Spawns a mid-air-style explosion
TE_EXPLOSION2 - Spawns a nuclear-style explosion
TE_GRENADE_EXPLOSION - Spawns a grenade explosion
TE_GRENADE_EXPLOSION_WATER - Spawns an underwater grenade explosion
TE_ROCKET_EXPLOSION - Spawns a rocket explosion
TE_ROCKET_EXPLOSION_WATER - Spawns an underwater rocket explosion

Note: The last four EXPLOSION entries overlap to some degree. TE_GRENADE_EXPLOSION is the same as TE_EXPLOSION2, TE_ROCKET_EXPLOSION is the same as TE_EXPLOSION1, and both of the EXPLOSION_WATER entries are the same, visually.

To send off a temporary entity: (where TE_* is the name, from the above list, of the temporary entity you want to spawn.)

gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_*);

Then, follow it with the listed series of gi.Write* commands for the last block of effects such as the explosions. Example:

gi.WritePosition(self->s.origin);

Entity Effects: (entity_state_t->effects)

Effects are things handled on the client side (lights, particles, frame animations) that happen constantly on the given entity.
An entity that has effects will be sent to the client even if it has a zero index model.

EF_ROTATE - rotate around Z axis
EF_GIB - red particle trail
EF_GREENGIB - greenish particle trail
EF_BLASTER - red light and yellow particle trail
EF_GRENADE - light greyish particle trail
EF_ROCKET - yellow light and yellow and grey particle trail
EF_BLASTER - yellowish particle trail
EF_HYPERBLASTER - long skinny yellowish lasers
EF_BFG - green light and swirling green particles, but not transparent unless RF_TRANSLUCENT is used
EF_COLOR_SHELL - enables RF_COLOR_* flags
EF_QUAD - blue shell around object
EF_PENT - red shell around object
EF_POWERSCREEN - green translucent hexagonal wall around object, vertically sized for player-sized model, bottom edge aligned with bottom edge of model
EF_FLIES - black particles swarm around
EF_TELEPORTER - yellow particle fountain
EF_FLAG1 - red particle fountain
EF_FLAG2 - blue particle fountain
EF_BOOMER - double orange particle trail and dull red light
EF_ANIM01 - every 5th server frame, toggle between model frames 0 and 1
EF_ANIM23 - every 5th server frame, toggle between model frames 2 and 3
EF_ANIM_ALL - every 5th server frame, increment model frame
EF_ANIM_ALLFAST - every server frame, increment model frame
The above two don't work with models, only sprites, as model's lack a maximum frame setting, and the server just runs off the end of the model's animations.

Entity Rendering Flags: (entity_state_t->renderfx flags)

RF_VIEWERMODEL - don't draw through eyes, only mirrors
RF_WEAPONMODEL - only draw through eyes, not mirrors
RF_DEPTHHACK - for view weapon Z crunching

The above three flags are used internally to take account of the various modelindex, gunindex, and similair model settings, so the user doesn't, for instance, see their own player model unless they look in a mirror.

RF_MINLIGHT - always have some light
RF_FULLBRIGHT - always draw full intensity
RF_TRANSLUCENT - translucent (33% or 66%? can't tell)
RF_FRAMELERP - enables translucent appearance, possibly enables other things? Need more research...
RF_BEAM - laser beam effect (a laser of color (skinnum) and width (frame) is draw from (old_origin) to (origin))
RF_GLOW - pulse lighting for bonus items
RF_SHELL_RED - Red shell added to object (You can combine color shells)
RF_SHELL_GREEN - Green shell added to object (You can combine color shells)
RF_SHELL_BLUE - Blue shell added to object (You can combine color shells)
RF_CUSTOMSKIN - skin is an index in image_precache

RF_CUSTOMSKIN (theoretically) allows for dynamically-generated skins on models in single-player games. In practice, it's far too much of a speed hit, and makes the server unstable. No use in network games, as there's no facility for transmitting the dynamically-generated skin. Also, due to it's obvious model-dependance, there's no general-purpose capability for this, except perhaps some sort of team-related usage. Never used to my knowledge in the Id 3.14 source code. I think they may have been thinking about making some sort of effect similair to the Goldeneye 007 one where the enemies get bloody wherever you shoot them.

ViDMaSTeR

This site, and all content and graphics displayed on it,
are Šopyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for their great help and support with hosting.
Best viewed with Netscape 4