Archive for April, 2008

Thursday, April 24th, 2008

This is older, from january, somehow I missed it but… nitoyon has created an AS3 port of jQuery. jQuery is my favorite javascript tool besides javascript itself. Mootools, prototype, and others like mochikit are all great but jQuery was the first to do lambda chain decorating and others followed suit.

But having this power in as3 is a great thing! $ selectors, common access methods to properties, methods, etc. All good stuff. Again this shows the fun in as3 or ES4 based languages like Actionscript because people are porting all sorts of libraries to it. If this performs I may just start using it daily TODAY!

For instance setting the stage align for use in full screen:

$(stage).attr({scaleMode: "noScale", align: "TL"});

That is too fun… The only thing not cool about this is all the spam at nitoyon‘s blog : )

How about a functional Tweener call:

function animate(f:Boolean):void {
				// Select 'RoundRect' elements using CSS selector
				$("RoundRect:" + (f ? "odd" : "even"))
					.addTween({
						rotation: 90,
						scaleX: 0.5,
						scaleY: 0.5,
						time: 0.6,
						delay: 0.3,
						transition: "easeOutCubic"
					})
					.addTween({
						scaleX: 1,
						scaleY: 1,
						time: 0.5,
						delay: 0.9,
						transition: "easeOutElastic",
						onComplete: function():void {
							// restore the rotation and call again.
							this.rotation = 0;
							animate(!f);
						}
					});
			}
			animate(false);

Stuff to see and try

Tuesday, April 22nd, 2008

Thursday, April 17th, 2008

This will blow you away. Found first via mrdoob (with quantum rss reading capability, before the message is concieved mrdoob is there).

Alternativa Platform, previously Alternativa Game, launched their Alternativa Platform milestone 1 and really one demo would have been enough but there are some great demos there that literally put them what appears a couple laps up on the 3d FPS style engine in Flash.

The engine is highly optimized and smooth, heavy on the processor, but using the ‘t’ key you can see some nice revealing triangle rendering. Also, playing with the field of view adds for some nice game effects. (try jumping on the fans in the half-life like room in the first demo)

Check the textures

See the Matrix

Get superpowers

From Above, Isometric

Here is what is to come from the platform:

Congrats to the Russian based Alternativa Platform, the world is watching.

Thursday, April 17th, 2008

Box2dFlashAS3 has been updated to version 2.0 complete with ragdolls and Theo Jansen walkers ala APE fame.

Wednesday, April 16th, 2008

A great Action Message Format (AMF) remoting kit for server side for the pythonistas is pyAMF, they recently released PyAMF 0.3 and have a sample running up on Google App Engine. There is also a tutorial for getting PyAMF running on Google App Engine. Aral Balkan got this running as well.

Features of pyAMF currently:

More on the PyAMF library:

Wednesday, April 16th, 2008

I had to implement a get age method for something we were working on. I was surprised to not find an AS3 version easily, so busted one out. I thought maybe this would be in as3corelib but nope. So posting this in case anyone else is looking for a get age script in AS3. It was quick so any improvements just post them. It will be added to my utilities classes on google code soon it is in quick form so you can jsut plop in an .fla or a class.

The pseudo code is the same for getting age in any language. Get current date, get birthdate to compare. Subtract the current years from the birthday years, then subtract one more year if the day or month is less than today’s day and month.


function calculateAge(birthdate:Date):Number {
    var dtNow:Date = new Date();// gets current date
    var currentMonth:Number = dtNow.getMonth();
    var currentDay:Number = dtNow.getDay();
    var currentYear:Number = dtNow.getFullYear();

    var bdMonth:Number = birthdate.getMonth();
    var bdDay:Number = birthdate.getDay();
    var bdYear:Number = birthdate.getFullYear();

    // get the difference in years
    var years:Number = dtNow.getFullYear() - birthdate.getFullYear();
    // subtract another year if we're before the
    // birth day in the current year
    if (currentMonth < bdMonth || (currentMonth == bdMonth && currentDay < bdDay)) {
        years--;
    }
    return years;
}

function dateStringToObject(dateString):Date {
    var date_ar = dateString.split("/");
    return new Date(date_ar[2],date_ar[0] - 1,date_ar[1]);
}

var dateNow:Date = new Date();
var checkDate:String = "11/25/1976";
var dateBirthday:Date = dateStringToObject(checkDate);
trace("dateNow = "+dateNow);
trace("dateBirthday = "+dateBirthday);
trace("age = "+calculateAge(dateBirthday));

Tuesday, April 15th, 2008

Vladimir Slepnev, Moscow, Russia creates Photosynth in Flash called OpenPhotoVR.

It appears that the files are uploaded and attached manually. But it mimics Microsoft Photosynth pretty well. You have to give it time to load and prepare the views but it is probably under heavier traffic from reddit.

OpenPhotoVR.org is a pseudo-3D photo browser, a free analog to Microsoft Photosynth. Users create photo albums by uploading pictures and linking them together by hand.

Tuesday, April 15th, 2008

Mathieu Badimon released the sweet Five3D vector 3d engine recently. Zeh noted this (and has some experiments) but this is a tracking and howto blog and I like to keep a timeline of influential releases.

You might have seen the Mathieu Badimon labs previously with the very nice scroll handle and technique and ability to rotate and translate the vector objects in 3d space. Now you too can make interfaces with the same cool library.

The one thing I like about this vector engine is well first of all it is vector and secondly it is pretty fast and not too processor intensive, but looks killer.

Friday, April 11th, 2008

Jono is giving SWFZ to science and the open source devices.

The SWFZ engine is one Flash 3D engine that took a different approach. It is a bit early in its technique used but the author at custom:media Jono has decided to float the source code out there in ghost mode (no active development but not dead). It is just ready to branch and others to run with it. He is floating the source but I think in 1-2 years this will be the preferred method if processors and multicore parallel usage is optimized. We shall see.

The implementation method and difference with SWFZ engine in Flash for 3d is that is is a pixel based renderer or scanline. It is based on a really fun game engine called Irrlicht which has been pretty active for the last few years but is a C++ DirectX and OpenGL engine. Since SWFZ has to run in Flash and it is a pixel renderer/scanline it has some limitations currently in Flash. Games and renders have to be fast to pull this off and Flash is limited by the software renderer but as computers get multiple processors and flash player gets better at this then this will be a viable option (it is the same thing that limits Canvas based renderers right now). One main problem with this is you can’t go too full screen the biggest sizes that perform well are smaller windows 320×240 etc. But if the processors can handle it it is actually more efficient when it removes overlap, extra triangle drawing and painters algorithm like problems dont’ pop up (triangle overlap when on same plane). This method draws pixel by pixel but fast enough flash engines like Papervision, Sandy3D and Away3D draw overlaps due to the drawing technique, back to front.

But SWFZ still manages to pull off some amazing feats such as these demos

Quake Demo

Terrain Demo

Yoshis Hip Hop Couzin

Jono has put some great classes into SWFZ engine such as bsp parsers, quake md2 parsers, animated mesh, and lots of great examples in porting C++ Irrlicht to AS3. This was a very early example of how AS3 was fun for programmers to port stuff from C or C++ into Flash. AS3 is just fun. Also be sure to check the site for more samples like an FPS game, some basic ai etc.

Jono has been working on 3d in Flash for a while and actually this message is what shows the difference betweeen this approach and other flash engines the way Papervision, Sandy and Away3D (pv3d derivative) make 3d in flash fast enough (Painter’s Algorithm and drawing skewed movieclips and textures.

Demos

More about the Engine Some Notes

The SWFZ engine.

Overview:

SWFZ engine is the result of four years of me messing with 3D in Flash.

I was a complete newbie to 3D, so a lot of learning has happened to get to here.

If you’re interested in 3D engines check out the resource links at the bottom of the page:

The Demo:

Model

  • .md2 format from ID’s Quake2.
  • Uses frame based animation
  • Textured with jpeg
  • No lighting, No Gouraud Shading, just plain texture

Skybox

  • Textures are just jpegs.

Boxes

  • Rendering – Textured Gouraud , Textured Gouraud with Alpha, Textured Gouraud with Quick Alpha, Gouraud Shaded, and the large box is just Textured.
  • Star Texture – Targa (.tga) file format.

AS3 classes

  • 171 classes and interfaces

Scene

  • No lighting
  • No collision detection

SWFZ engine technology:

The demo only shows a small part of the capabilities of the engine. In the coming weeks I will get www.custommedia.co.nz up and running and start to post more info then.

Currently implement stuff:

New file formats supported

  • .tga – Targa Image
  • .bmp – Bitmap Image
  • .3ds – 3D Studio Max
  • .bsp – Quake3 levels
  • .md2 – Quake2 models
  • .obj – Wavefront 3d object (static)
  • .zip – Read from a zip archive (all in Flash, no server side scripts)

3D Rendering

  • mipmaps
  • perspective correct texturing + affine texturing
  • Flat shading
  • Gouraud
  • Textured Gouraud
  • Textured Flat
  • Textured Two Layers
  • Gouraud Alpha
  • Textured Flat Alpha
  • Textured Gouraud Alpha

3D Scene

  • Billboards
  • Parent, Child scene nodes
  • OctTree
  • Skybox
  • Static Meshes
  • Animated Meshes
  • Basic collision detection
  • Scene node animators

If any code is useful to you maybe drop him a donation or what would be nice if this was all setup at google code and used to be integrated into other engines. Irrlicht ports are fun and there is a future in this method when processors catch up I think.

Friday, April 11th, 2008

Good news, I meant to post this a few days ago last weekend Tim Knip added 3DS parsing support to Papervision3D. Here is the thread with the quick howto.

Thread in nabble

Added a simple 3DS parser to the Great White trunk.
=> org.papervision3d.objects.parsers.Max3DS

…USAGE:


// where to find textures
var textureDir:String = "./images/";  // use a trailing slash!

// optional materialsList
var materials:MaterialsList = new MaterialsList();

// the 3DS file
var fileName:String = "[path-to-3ds-file]";

// load it!
_3ds.load(fileName, materials, textureDir);

// add to scene
scene.addChild(_3ds);

Also, one other golden nugget is Den Ivanov’s newest demo with Papervision portals! This is a very smooth demo, be sure to enter into the portals to see the seasons change.

Also here is a  non papervision 3ds parser.