Create a DarkPlaces particle effect with effectinfo.txt

DarkPlaces tutorials KleskBY 0 7
Source: https://github.com/DarkPlacesEngine/DarkPlaces/blob/master/cl_particles.c

DarkPlaces can define particle effects in effectinfo.txt. Each effect line starts an emitter; the lines below it describe the particles that emitter produces. In this tutorial you will replace a gunshot impact with a broad burst of amber sparks and a textured puff of smoke. You can test the effect without compiling QuakeC.

1. Set up a small mod directory

You need DarkPlaces and a working Quake installation with its id1 game data. Create a directory beside id1, and put a plain-text file named effectinfo.txt at its root:

Quake/ ├─ id1/ │ └─ pak0.pak └─ particlelab/ └─ effectinfo.txt

Launch DarkPlaces with -game particlelab. The file may also live at the root of a PK3 inside particlelab, but a loose file is easier to edit while learning. Save it as text, not as effectinfo.txt.txt.

2. Add a spark emitter and a smoke emitter

Paste the following into particlelab/effectinfo.txt. The two blocks share the name TE_GUNSHOT, so DarkPlaces runs both when that effect is triggered. Lines beginning with // are comments.

// Bright, short-lived impact sparks effect TE_GUNSHOT type spark countabsolute 16 color 0xFF9B30 0xFFE6A0 size 1 2 alpha 180 220 320 time 0.6 0.9 originjitter 3 3 3 velocityjitter 160 160 140 gravity 0.5 stretchfactor 3 // A slower puff behind the sparks effect TE_GUNSHOT type smoke blend alpha countabsolute 2 color 0x777B80 0xBABEC3 tex 0 8 size 8 12 sizeincrease 5 alpha 110 145 110 time 0.8 1.2 originjitter 6 6 6 velocityjitter 28 28 20 velocityoffset 0 0 22

The first block uses the engine's spark type, which is stretched along its motion and uses additive blending. The second uses smoke textures and explicitly selects alpha blending for a quieter cloud. tex 0 8 selects one of the built-in smoke cells numbered 0 through 7: the upper bound is exclusive. The larger smoke size and wider spark velocity give the impact a stronger silhouette.

How one gunshot event runs two DarkPlaces particle emitters The TE_GUNSHOT game event connects to two effectinfo blocks with the same name. One emits short amber sparks; the other emits slower gray smoke. Both contribute to the final impact. One event, two emitters Repeated effect names build one layered impact. TE_GUNSHOT impact event Spark emitter 16 fast particles · warm colors · stretched trails Smoke emitter 2 textured particles · larger size · upward drift Both blocks are read from particlelab/effectinfo.txt when the mod is active.
Each effect TE_GUNSHOT block defines a separate emitter; both run for the same impact.

3. Test and reload it in game

Load a map and fire the shotgun into a nearby wall. The impact should show warm streaks and a little gray smoke. To change the effect without restarting, edit and save effectinfo.txt, open the DarkPlaces console, and run:

cl_particles_reloadeffects

Fire again to compare. You can also run which effectinfo.txt to see which file DarkPlaces reads. This matters if another game directory or PK3 supplies a copy.

Make the preview richer with a custom atlas

The cover image is an actual FTEQW screenshot from a test map with textured stone and warm lighting. Its larger, three-layer variant uses a custom particles/particlefont.tga adapted from the Libre-life project: cell 63 for spark heads, cells 48–55 for smoke, and cell 47 for a brief star-shaped core. That atlas is optional; the two-block example above uses stock textures and is the one to start with.

Download the compact particle atlas (ZIP, 69 KB). Extract it into your mod directory so the file is at particles/particlefont.tga. The archive includes its GPL-3.0 license. It replaces the particle atlas for the whole mod, so review your other particle effects before shipping it.

To build a similar variant in your own mod, provide an 8×8 particle atlas with the artwork in those cells, then change the spark block to tex 63 64 and the smoke block to tex 48 56. Add this third block for a short central flash:

effect TE_GUNSHOT type smoke blend add countabsolute 1 color 0xFFAD46 0xFFD487 tex 47 48 size 4 5 alpha 80 120 350 time 0.16 0.28 originjitter 1 1 1

Keep this layer short and faint: a large additive flash can wash out the sparks. The preview map also places the camera close to the impact. Distance and lighting change how large the same particle sizes look on screen.

Using the file in FTEQW

FTEQW has its own native particle format in particles/*.cfg. It can also import DarkPlaces effectinfo.txt through a compatibility path. With the same particlelab mod active, start FTEQW and enter this in its console before testing the shotgun impact:

r_particledesc effectinfo

Load a map and fire into a wall. FTE's importer is a compatibility feature, so compare the behavior rather than expecting an identical image in both engines. The DarkPlaces reload command above is specific to DarkPlaces; this FTE step selects the particle description to load.

For a mod-defined effect with a new name, FTE also recognizes the effectinfo. namespace. For example, an effect myimpact block can be requested from QuakeC as particleeffectnum("effectinfo.myimpact"). Precache custom effects during game initialization so clients know their names before the first event. The TE_GUNSHOT exercise needs no QuakeC because it replaces an existing effect name. If you later need FTE-only controls, use its native particle script format.

What the numbers control

SettingMeaning in this example
countabsoluteFixed particles per call, independent of cl_particles_quality. Use count if you want the engine's requested count and quality multiplier involved.
colorTwo hexadecimal RGB colors; each particle gets a color from that range.
size and sizeincreaseStarting size range in game units, then change in size per second.
alphaMinimum opacity, maximum opacity, then fade per second. Opacity uses 0–256, where 256 is fully opaque.
timeMinimum and maximum lifetime in seconds. A particle also disappears when its alpha reaches zero.
velocityjitter and velocityoffsetRandom motion on each axis, plus a fixed addition. The smoke's positive Z offset sends it upward.

Try changing just one value at a time. For example, double the spark velocityjitter to widen the burst, or lower the smoke's alpha fade from 260 to 180 to keep it visible longer. Reload, fire once, and compare.

Common problems and next steps

  • Nothing changes: confirm -game particlelab, run which effectinfo.txt, and check the console for a line-numbered parse error. Keep one setting per line with the exact number of values shown.
  • Particles are hidden: check cl_particles 1, cl_particles_quake 0, and the type switches cl_particles_sparks 1 and cl_particles_smoke 1.
  • The impact looks different from stock Quake: defining TE_GUNSHOT replaces DarkPlaces' built-in fallback for that effect, including its default particle mix. Remove or rename this definition to restore the fallback after reloading.
  • You need an effect only your mod can call: give it a unique name, then trigger that name from QuakeC with particleeffectnum and the particle-effect builtins. A name in the file alone does not make the engine emit it.

For one map only, DarkPlaces also loads maps/<mapname>_effectinfo.txt after the global file. Use the map name without the .bsp extension. Keep broad effects in the global file and map-specific changes in the map file.

Sources

This hands-on example was developed from the archived Blood Wiki effectinfo reference and checked against the current official DarkPlaces particle source and engine documentation. The FTE notes were checked against the supplied Quake technical knowledge base and FTE's extension definitions and particle script specification. Compatibility is not a guarantee of identical rendering.



Tags: DarkPlaces, FTEQW, effectinfo, particles, Quake modding

Comments


captcha


No comments yet. Be the first!
Owned by kleskby#1837
Close

You have no new notifications.

SHOUTBOX
Open chat to load…
Log in to chat