With item stats out of the way, it’s time to start fleshing out item-related content. To that end progress is being made on three different fronts: Item art, weapon sounds, and weapon particle effects.
Procedural particle scripts are a great time-saving substitute for hand-drawn animations. They also lend a unique visual appeal to the otherwise minimalist-informative interface of a static grid-based world. All weapons will have their own particle effect, so you can pretty easily discern the type of weapon being fired (sound will also help in this regard) and we no longer require “X attacks Y” log messages--if you must have all the juicy details they’re still available via the separate and optional combat log.
When the old 7DRL version was born, it simply imported a large library of particle effects along with the X@COM engine. Due to time constraints all I could do was spend a few minutes recoloring a few of them, so in the end many weapons used similar effects. A few months back I took some time off coding to rewrite and expand that particle collection, giving it a greater variety of styles tailored to Cogmind. Because the final weapon list was not ready at the time, the designs carry generic labels--now it’s time to tweak the particles and assign them to specific weapons.
The current “official” set of generic particles so far contains:
- 7 ballistic projectiles
- 12 lasers
- 4 plasma blasts
- 5 rockets
- 7 special launchers
- 24 explosions
You can tell I’m fond of explosions ;)
These numbers indicate different “styles,” not an absolute number of effects, because a recolored variant of any given style can be created by adding a single line of script.
Here’s a composite screenshot showing a few different projectiles and explosions:
The animations look better in motion:
Like everything else Cogmind, the particles are controlled entirely via external text files like this one:
The result of the script highlighted above is this explosion:
Recoloring, or creating multiple variants of the same particle with slightly different behaviors, is simplified by templates. You can see them in the scripts above listed as red text containing the values to substitute. (Note: All those “TK”s are there because I haven’t yet associated them with any specific weapons.)
Just before the engine parses particle data, it checks for templates and automatically generates all applicable variants of each type of particle. Thus particle designs can be abstracted to their most general form (without specifying color, for example) for maximum reusability and minimal copy-pasting.
With regard to weapons, in most cases templates are simply used for recoloring particles. Templates are technically capable of substituting any kind of parameter--other behavioral adjustments such as particle speed and lifetime are more often used for creating multiple variants of interface animations.
From an implementation perspective, the coolest new feature of the Cogmind particle engine is that it can be dynamically loaded! This is a huge time saver. All particle data can be reloaded at the press of a button while the game is running, meaning we can tweak and edit particles in the text files and see the results immediately in game.
A lot of interdependent factors determine what a particle effect looks like, so creating/changing one can take a few tries. Having to make a best guess and restart the game with every tweak was getting really, really annoying, not to mention slow.