Stephen Calender Programming Blog


Sprite versus MovieClip


Apr 12

Posted: under ActionScript 3.0 Benchmarks, Optimization.

SpriteVsMCGraph

For years I have heard horror stories about the bad performance of Flash’s MovieClip class, so much so that I have aggressively replaced as many objects as I can with Sprites. Obviously MoiveClip objects use a bit more memory, but how much more processing time do they take compared to Sprites? When exactly do they become expensive? Does it matter how you have your display list organized (according to Adobe, shallower is better; however, we do not have a cost comparison)? Surprising answers and discoveries are abound! MOAR!!!

Comments (0)

Faster Rectangle Class


Nov 15

Posted: under ActionScript 3.0, ActionScript 3.0 Benchmarks, Optimization.

“An underlying theme I have discovered with Flash is that you are often better off writing your own code than trusting Adobe’s classes and functions, data structures are no exception.” – taken from my flash particle system article

After the launch and first few patches of Lego Universe, work at NetDevil has calmed down enough that I have the time and energy to explore private projects again. The current project I am working on is large and it is still in the design, test, research phase since it needs to very optimized. I saw that I was going to be doing quite a few rectangle intersects and intersection operations (the function that determines whether two rectangles overlap and the function that returns the overlapping rectangle respectively) so I took a look at the speed of Flash’s native rectangle class. I clocked Flash’s intersects function speed at over 150 simple operations (adds, multiplies, and accessing class members all count as one simple operation from my benchmarking series). I thought to myself “I can do better than that” – I was right, and I managed to write a faster intersection function too (free code).

MOAR!!!

Comments (5)

Flash Particle System


May 01

Posted: under ActionScript 3.0, Optimization.



A particle system is the quintessential video game effect used for clouds, fog, mist, smoke, rain, snow, fire, explosions, dust, debris, sparks, magic, spray, splatter, and other phenomenon. They have been around since the early 1980s, William T. Reeves is the inventor, but its most notable debut to the public was when the group that eventually became Pixar (employed by Lucasfilm Ltd. at the time) used a particle system in Star Trek: The Wrath of Khan (1982) for the ‘genesis effect’. It is mystifying that such a classic creative tool is missing from Flash.

MOAR!!!

Comments (6)