Tuesday, December 11, 2007

Flash is slow, notoriously slow

I implemented merge sort in flash, and then compare it to others.

Action: sorting 5000 random numbers in an array

Merge sort - 3.4 seconds
Flash's built-in sort - 0.15 second
Bubble sort - 38.5 seconds (yeah, don't use bubble sort! It's way too slow!)

Merge sort is one of the fastest (others are quicksort, heap sort, ...etc) sorting algorithms (speed = n log n), and yet, compared to the built-in sorting method, it is 20 times slower.


Also, Flash is bad at math.

It takes about a minute to render an image of the Mandelbrot set in Flash.

I use almost the same method, but coded in Paint.NET's codelab, it produces an image 100 times the size, 10000 times more detail, lots of coloring calculation, and with half the time.

Recently, working on a flash 3D engine project, Flash slows down just by doing a few (maybe 20~30) trigonometry calculations (sin/cos only).

It's a real frustration.

*hopes to upgrade to Flash CS3 soon*

Wednesday, December 5, 2007

Age of Wars

http://www.maxgames.com/play/age-of-war.html

Very nicely done game indeed.
At the beginning, it might be hard, but it isn't really.
The last level can be won by only ion-rays.

A guide to beat impossible:
1. wait for enemy to line up and then use special
2. build an egg-automatic
3. keep sending in club-mans so that the enemy doesn't hit base
4. build more egg-automatics as soon as you have enough money (be sure to leave enough for club-mans)
5. DO NOT evolve until the first tank appears. Keep sending in club-mans as fast as you can
6. when the first tank appears evolve to future age and buy