Table of content

# Advanced Particle Effects Programming Tutorial

by Thomas Gisiger

Particles are one of my favorite effects: they are easy to use, there is virtually no limit to what you can do with them and they appear to work on almost all graphic cards (try this with materials and shaders!). They also complement the overall look of a game very nicely, just like quality lighting, models, textures, sound effects, etc. And this can be done with relatively little clicking and dragging actions of the mouse. This does not mean that nice particle effects do not require work on the part of the game designer. They do; it is just that particles effects are created and performed by mathematical equations which dictate where objects are to appear, how fast they are moving, what their color is, etc. This is the real challenge: how to formulate mathematically what you want to have on the screen.

There are a lot of good particle tutorials already written for 3DGS (= 3D GameStudio), (see the Conitec Web page, the magazine and the forum) and a very impressive software (Easy Particles 2 - my compliments to Timo Stark & Team) has been put for free download on the 3DGS Web page. However, I feel that these can only take you so far and if you wish to make truly unique and novel effects, then one has to go even further and get one's hands 'dirty' with maths.

In the following pages, I will introduce the reader to mathematical notions useful for making particle effects, as well as a few equations which I developed while preparing the Pyrotechno! fireworks demo. My goal is to help the reader understand how they work so that afterwards he/she can generalize and modify them further to solve his/her own problems. By reading codes presented on the forum, by Conitec and in the Acknex Magazine, I realized that there is no unique solution to a given problem. Therefore, it is possible that the solutions I propose here are not the best way to do things. However, I found them reliable and good enough for my needs. I hope you will too.

In the text, I tried to mix enough examples, pictures and code samples to avoid making the reader feel that he/she is reading a boring calculus textbook. No more than simple notions of calculus, vector algebra and trigonometry (which I quickly review in the text) are needed to understand the tutorial. I also arranged the material so that the more mathematically abstract stuff is at the end.

Note also that almost everything I say here for particles can be generalized to entities and cameras with few changes. This is therefore quite general knowledge which goes far beyond simple particle programming.

This tutorial is 'somewhat' long and, though presented as pedagogically as possible, some notions it contains might take some time to completely master. Expect to spend a good 40 hours to go through the material here. But after you're done, your games might never look the same... :-)

Let's start!

Next: Lesson 1. Getting started: the basics of particle programming