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 http://www.flashcomponents.net/component/flash_chat_bot.html
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:
http://en.wikipedia.org/wiki/AIML
http://www.alicebot.org/aiml.html
and some open source chatbots based on AIML:
http://sourceforge.net/projects/programe/(AIML chatterbot written in PHP and using MySQL.)
http://www.smart-page.net/blog/2009/10/16/flash-aiml-tts-chatbot-hal9000-using-php-and-festival/ (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
Adam:http://www.dudziak.com/talk.cgi
Alice:http://alice.pandorabots.com/
MegaHAL: http://megahal.alioth.debian.org/
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: http://www.jamiedurrant.com/flashbot.html .
What that flash file do is to replace the default html interface when using the AI chatbot at www.pandorabots.com.
Another Actionscript 3 Pandorabot Chat Class is here:
http://alicebot.blogspot.com/2008/05/pandorabots-has-xml-rpc-interface-that.html

Finally, some flash chatbots:
Crunchy: http://portfoliosites.com.au/billtest/chat/
by Billy T (nice UI !).
Square-bear: http://www.square-bear.co.uk/games/bearbot/chat.htm
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 ):http://www.strille.net/works/as3/raytracer/raytracer_f9.swf

2.Forrest Briggs’ Real Time Ray Tracer in AS3(simple but effective):http://www.laserpirate.com/as3raytracer/
source:http://www.laserpirate.com/as3raytracer/RayTracer.as

3.non real time ray-tracing in flash-mx(flash-6):
Strillehttp://www.strille.net/works/raytracer.swf
(more controls, you can add light source, sphere, set texture)
Ross Richardson
http://www.flashkit.com/movies/3D/Ray_Trac-Ross_Ric-9255/index.php (simple and open source)
Ross Richardson’s source:http://www.flashkit.com/downloads/movies/zip/9255/Ray%20Tracer%20v0.8.zip

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

demo:https://flaswf.googlecode.com/svn/trunk/flaswfblog/old_homepage/raytracersmall.swf

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
LINKS:
open source ray-tracing engine based on c++ http://www.devmaster.net/articles/raytracing_series/part1.php(C++source+toturial
The Basics of Raytracing
http://www.devmaster.net/articles/raytracing/
Another Raytracing experiment based on Forrest Briggs's work:
http://unitcu.be/?p=1
ASTrace Raytracing Library (Open Source, AS3)
http://experimentalized.com/astrace.html
http://experimentalized.blogspot.com/2010/10/astrace-pre-release.html

Wednesday, August 20, 2008

3d slice engine in AS3.0


会动的眼睛-3d切片眼睛(点击展开中文翻译)

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 http://www.arseiam.com/ .
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 http://www.arseiam.com/
and finally, link to the old book:
"Flash 3D Cheats Most Wanted"

Read the book online: http://flylib.com/books/en/1.226.1.1/1/

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.
Enjoy!
demo
source

Sponsors