Recapped
Variables
Data Types
Conditionals
We also recapped positioning, animation and collision.
In the first half of todays lesson, we recapped the following concepts:
- Arrays
- Functions
Presumably, the above was to prepare us for our next and final feat! Seb was about to teach us how to create a particle system.
The term particle system refers to a computer graphics technique to simulate certain fuzzy phenomena, which are otherwise very hard to reproduce with conventional rendering techniques. Examples of such phenomena which are commonly replicated using particle systems include fire, explosions, smoke, ... etc.Source: http://en.wikipedia.org/wiki/Particle_system
Having spoken to Seb between lessons, I already knew that he considered what we were about to do, the litmus test of programming languages! Writing a particle system in any langauge requires the use of fundamental programming concepts, and, more notably, the use of objects!
Result
In the following example, the partical emitter is set to be relative to the mouse position. Each partical is an object, so it's crafted from a partical class. The partical class allows us to set up our partical system; we can change how each partical looks and how it behaves. The behaviour is defined through physical properties, specifically velocity, gravity and friction. I shan't go into programmatic detail as the examples would be complex and ruined by the formatting on my blog.
Seb, for the first time, spoke about performance in this session. This requires some understanding of how a computer program operates on a hardware level. With our partical emitter, each partical we create is allocated space in the R.A.M. (Random Access Memory), and as we're creating tens to hundreds every so frame, the possibility of hogging system resources is high! To deal with this, we must ensure that once a partical object cannot be seen it's destroyed or recycled.