Sunday, March 23, 2008
Particle Engine - first attempt
So, time wen't by, and friends/family/kids/work came in the way of finishing the particle engine (read: I prioritized real life over this blog, so sue me ;) )
First attempt contains a rather "amputated" version of a linked list which doesn't implement any search functions or other methods normaly implemented, for the sake of "pretty design" I could of course write these methods, but it would be a waste of time.
My main focus from here on is to optimize the engine, currently I've spottede a few design flaws that could be different, and I've got a few idea's for futher optimizing.
Click here to download the source
Stay tuned ...
First attempt contains a rather "amputated" version of a linked list which doesn't implement any search functions or other methods normaly implemented, for the sake of "pretty design" I could of course write these methods, but it would be a waste of time.
My main focus from here on is to optimize the engine, currently I've spottede a few design flaws that could be different, and I've got a few idea's for futher optimizing.
Click here to download the source
Stay tuned ...
Labels:
Data structures,
effect,
Particle engine
Thursday, March 13, 2008
Particle Engine.. theory behind it..
A particle engine, as explained in a latter post, is basically just a class/engine that can managed a large number of sprites with different alpha values.
Imagine having to control 100-150 sprites fading from 1 to 0 in alpha while moving in different directions in a normal Actionscript function...
A way to solve this is to create a generic Particle class that manages the life (and death) of each particle and does so in a way that you only once call the "AddParticle" method and from there on doesn't worry about it anymore.
First issue that arose while developing the 0.1 version of the engine was ActionScript 3.0 lack of a fast Array class for storing the particles. After googling around a bit I stumble across this project evolving around generic Game development datastructures in ActionScript 3.0
http://lab.polygonal.de/ds/
The obvious candidate for our particle engine is the "Linked list" structure... the internal Update() method in our engine class will iterate through our particles 1 at a time, but it will also need to be able to remove a given particle in the middle of our list .. so using a normal Array class would create an enormous overhead when splitting and joining the Array's after deletion.
So tonight I'll be written my own implementation of the classic Linked list structure in ActionScript 3.0 and hopefully completing the first 0.1 release of the particle engine within this week.
Imagine having to control 100-150 sprites fading from 1 to 0 in alpha while moving in different directions in a normal Actionscript function...
A way to solve this is to create a generic Particle class that manages the life (and death) of each particle and does so in a way that you only once call the "AddParticle" method and from there on doesn't worry about it anymore.
First issue that arose while developing the 0.1 version of the engine was ActionScript 3.0 lack of a fast Array class for storing the particles. After googling around a bit I stumble across this project evolving around generic Game development datastructures in ActionScript 3.0
http://lab.polygonal.de/ds/
The obvious candidate for our particle engine is the "Linked list" structure... the internal Update() method in our engine class will iterate through our particles 1 at a time, but it will also need to be able to remove a given particle in the middle of our list .. so using a normal Array class would create an enormous overhead when splitting and joining the Array's after deletion.
So tonight I'll be written my own implementation of the classic Linked list structure in ActionScript 3.0 and hopefully completing the first 0.1 release of the particle engine within this week.
Tuesday, March 11, 2008
It's all just a smoke screen !
A few months ago I was given a challenge by one of our designers. They wanted a trail of smoke rising slowly from a pie as a part of a design on a customers site.
Click here to see my first draft
Needless to say it sounded like a fun little job, since it was basicly a particle engine with a few tweaks.
What is a particle engine you might ask, well the short and easy way to explain it would be that it's a engine/coding class that can keep track of multiple sprites with fading alpha values.
The sprites used can be anything from crude solid boxes to circles with higher intesity in the center.
Over the next few posts I'll be building a standard particle engine that can be tweaked into pretty much any 2d job. (3d particles is a whole other ballgame)
- Kenneth C
Click here to see my first draft
Needless to say it sounded like a fun little job, since it was basicly a particle engine with a few tweaks.
What is a particle engine you might ask, well the short and easy way to explain it would be that it's a engine/coding class that can keep track of multiple sprites with fading alpha values.
The sprites used can be anything from crude solid boxes to circles with higher intesity in the center.
Over the next few posts I'll be building a standard particle engine that can be tweaked into pretty much any 2d job. (3d particles is a whole other ballgame)
- Kenneth C
Sunday, March 9, 2008
A small starfield with a bluring effect..

Granted, the code is not optimized, pretty or in anyother way OO as it should be, but it works. which was the most important thing for me at the time.
For those interested, it's a pretty simple algorithme, a "star" starts it's life in a random postion between -10 and 10 on both the x and y axis, and the cordinate space moves it's 0,0 to the center of the screen,done by adding 1/2 of the screen width,height to the stars upon rendering.
Moving the stars is done by multiplying a randomly assigned acceleration value. so the farther the star get's away from the center, the faster it gets.
It sounds advance, and confusing, but is pretty simple.
Also I added a small pixel based blur effect using the Red component, but afterwards I've learned that flash has it's own filters. I'll have to look into that some day.
Click here to download the swf,fla and as files
It was also written in the rubbish flash cs 3 IDE .. which held me back in a big way.- Kenneth C
First post..
Who am I, and why am I doing this?
Im a 28 years old developer working mainly with c# in a Microsoft based enviroment in a Danish webcompany, and until a few months ago, my only experience in flash was when our webdesigner asked for help with basic coding syntax in actionscript 2.0.
But, then came the day when he threw a book called "professional action script 3.0" at me, and I started reading it. Big surprise... using Flex builder 2/3, it was possible for me to avoid the flash cs program, and actually write code using a "real" IDE.... So the spark was lit..
Historicly I've got over 9 years of professional experience, and on top of that, I've worked with anything from the c64, loads of Amiga models and even console homebrew.
In my younger days I was part of a phenomon known as "the demoscene" where I've aquired a lot of development techniques, especially on underpowered platforms.
Languages include Arexx,Rexx,C#,VB,680x0 Assembly,Risc Assembly,C/C++,Shell scripting,Perl and others.
Purpose of this blog?
Share my experiences with various parts of flash, and some code snippets that i've developed to solved various challenges... or perhaps just written for fun.
- Kenneth C
Im a 28 years old developer working mainly with c# in a Microsoft based enviroment in a Danish webcompany, and until a few months ago, my only experience in flash was when our webdesigner asked for help with basic coding syntax in actionscript 2.0.
But, then came the day when he threw a book called "professional action script 3.0" at me, and I started reading it. Big surprise... using Flex builder 2/3, it was possible for me to avoid the flash cs program, and actually write code using a "real" IDE.... So the spark was lit..
Historicly I've got over 9 years of professional experience, and on top of that, I've worked with anything from the c64, loads of Amiga models and even console homebrew.
In my younger days I was part of a phenomon known as "the demoscene" where I've aquired a lot of development techniques, especially on underpowered platforms.
Languages include Arexx,Rexx,C#,VB,680x0 Assembly,Risc Assembly,C/C++,Shell scripting,Perl and others.
Purpose of this blog?
Share my experiences with various parts of flash, and some code snippets that i've developed to solved various challenges... or perhaps just written for fun.
- Kenneth C
Subscribe to:
Posts (Atom)