Saturday, August 30, 2008

My chatbot in Flash

flash as3.0 聊天机器人(点击展开中文翻译)

I was inspired by an interesting chatbot flash made by Chad Adams.
I can't fully understand his original class in flash mx, so just write one myself.
It costs me some time because I have to write the code while searching and learning what I need about XML.
I am not good at using action script to deal with XML and strings.
So no doubt the class can be improved.

Don't laugh at my bot, after all its brain only weighs 2 KB!
My chatbot source is Here: flash_chatbot_v1.0.rar
Chad Adams's original code is available at
All in all, this is one simple experiment. All it can do is to search the XML data (by Chad) to find answers according to some word you typed in and display the answers.

To extend my chatbot and make it more "clever", you can replace "brain.xml" with more complicated things such as "Artificial Intelligence Markup Language" and try to parser them:
and some open source chatbots based on AIML: chatterbot written in PHP and using MySQL.) (Flash AIML TTS Chatbot – ‘HAL9000′ using PHP and Festival)

By the way, if you are interested in chatbot, here are some links:
Some powerful chatbots are
they can say more and answer more questions.

Jamie Durrant offers us a tutorial about how to write a chatbot using what ALICE (above) knows(as2.0 or lower) with code here: .
What that flash file do is to replace the default html interface when using the AI chatbot at
Another Actionscript 3 Pandorabot Chat Class is here:

Finally, some flash chatbots:
by Billy T (nice UI !).
by Steve Worswick.

Monday, August 25, 2008

ray tracing in AS3.0

Flash 3D中最强的光影效果-光线追踪(点击展开中文翻译)

Recently I trying ray tracing in action script. Some ray tracer in flash I know is :
1.Strille’s raytracer_f9(nice effect, source not available ):

2.Forrest Briggs’ Real Time Ray Tracer in AS3(simple but effective):

3.non real time ray-tracing in flash-mx(flash-6):
(more controls, you can add light source, sphere, set texture)
Ross Richardson (simple and open source)
Ross Richardson’s source:

I rewrite Forrest Briggs’s source and add some controls(arrow &space&shift key to move the camera)and fake textures.


I also write one using the new Vector3D class for flash 10,but speed down to 3~5 fps! By the way, all above is mostly about Ray-tracing spheres so I also write one Ray-tracing triangle using Barycentric coordinate.

ray-tracing triangles
ray-tracing bump mapping
open source ray-tracing engine based on c++
The Basics of Raytracing
Another Raytracing experiment based on Forrest Briggs's work:
ASTrace Raytracing Library (Open Source, AS3)

Wednesday, August 20, 2008

3d slice engine in AS3.0


Ant Eden designed the 3D slice engine long ago, which extends the concept by rotating and scaling the slices in flash mx.

It's a pity I got to know that wonderful engine only about one year ago.
I'm sorry to found that not many people are talking about 3d slice nowadays.
"We already have more powerful 3d engine why waste time on those out-of-data & less effective stuffs?"

But it's really powerful when you want to make a 2D image looks like 3D.
Check the work in .
I'm sure no other flash 3d engine can make those works in such an easy way.

I really like this simple and useful tools,It's easy to understand and use. So if you want to make an eye that can move, create a face looks like 3D without 3D modeling, or if you don't want to use some 3D engine too complicated for your to understand, I recommend you to try it.

Good things should never die, so here is one example in AS3.0. I rewrite the original mx code, please don't fool me for my dirty code.

My 3d slice eye in AS3.0, source here or you may want to check the result first.

If you know nothing about 3D slice. Here is a simple tutorial by Ant Eden.
you can still find the source code of the book
'Flash 3D Cheats Most Wanted'(flash mx)
here , include source files of most flash related to 3D slice engine you see in
and finally, link to the old book:
"Flash 3D Cheats Most Wanted"

Read the book online:

Friday, August 1, 2008

Rpixel3d release -another way to 3D!

This is something I wanted to do since 2005, but started and finished half an year ago.This is an final vision because I won't have time to do with it any more.

I am sorry that this work is not effective at all, be careful of your CPU if your use a larger picture! We all know that 3d for pixels can't be used for real time 3d textures now. However, I do like its simplicity. You can use it for small pictures or in pre-rendered 3D movies if you like.Maybe you will write an flash-10 vision, use the new Vector3D class instead of Robert Penner's old one, to test the speed.

The difference:
Rpixel3d:Map every texel to a pixel.(SLOW)
Real3d:Map every pixel to a texel.(FAST)

The only useful thing here is how to fix fishbowl distortion.If you only use BitmapData setpixel() to draw 3D transform, there will be annoying gaps between pixels.The trick is to use a Shape and drawRect() or lineTo() and then a Bitmap to draw() that Shape back.