Post news RSS ASCII Particle Effects

Creating a vast range of procedural ASCII particle effects for the many weapons in Cogmind.

Posted by on

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:

A missile, explosion, plasma, and EMP blast.

The animations look better in motion:

Minigun, followed by cannons and lasers.

Lasers, plasma, and flamer.

Rockets/launchers and explosions/EMP.

Like everything else Cogmind, the particles are controlled entirely via external text files like this one:

The highlighted area is a script defining a single incendiary explosion. (click for full size)

The result of the script highlighted above is this explosion:

The base color of the explosion can be anything, as set in a single script variable.


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.


Love the emp!

Reply Good karma Bad karma+4 votes
Kyzrati Author

This seems to be a favorite type of effect everywhere I show it, perhaps because it's the ASCII-est of them all ;). All the EM/EMP weapons use actual glyphs.

Reply Good karma+3 votes

Also love the missiles.

And the lasers are pretty cool. How do they look when they're off the cardinal axes?

Reply Good karma Bad karma+2 votes
Kyzrati Author

They're not too bad, since they're shaded based on distance passed through each individual space. Some of the in-game gifs seen on the site include diagonal laser shots.

Reply Good karma+1 vote

So far always very interesting to see all your work. Great job !

Reply Good karma Bad karma+1 vote
Kyzrati Author

Thanks! Can't wait to put this stuff in videos so you can *hear* it too ;)

Reply Good karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.