Over Christmas I've had the opportunity to play with a few of my favourite API's, Flash Media Interactive Server, Papervision3D 2.0 et al. A lot of my experiments have been done in one class, trying to navigate my way around new tools and concepts. However this is not the way I like to work. The thought has been gnawing at my soul as to how these experiments would work if developed in a structured manner with a design pattern. What sort of problems would I face? Would there be scope issues? Would somethings just not work? To answer these questions, I developed a simple mp3 playlist which streams the songs from Flash Media Interactive Server. I have added to this a visualizer made with Papervision3D. To make it scalable and to allow me test a variety of iterations of my code I have chosen to base the application architecture on the Strategy pattern. Thus each view is a different strategy made of an MXML/AS3 control that implements a View interface. Thus to change the iteration of my display all I need do is implement a new Strategy. I do love patterns. I like the results and more the point it confirms that I can develop with these API's in the manner I prefer to work.
*An interesting point to note was the effect the wmode attribute had on publishing the swf. In some instances wmode will affect the display and performance of the swf. In this case it made all the animation respond only to Mouse actions. Removing the wmode gave me back my intended behaviours. Using these APIs though unfortunately create huge files and can be very CPU intensive so limitations have to be place on what effects can be used and so on. None the less it is gratifying.
The ParticleField class is one of my favourite Papervision 2.0 classes. To use it first you set up an instance of the ParticleMaterial class. Then you set up an instance of the ParticleField class and pass the ParticleMaterial as an argument of the ParticleField constructor. Add it to your Scene3D and render. Voila, particles floating in space, as many as you want.
Now here is the problem, both Effects and GreatWhite libraries of the PV3D package offer this class but, the implementation for each version varies because the constructors are slightly different:
_pm = new ParticleMaterial(0x00f000, 1);
//Great White: _pf = new ParticleField(_pm, 4000// number of particles, 800//Field width, 100//Field height, 800//Field depth);
//Effects _pf = new ParticleField(_pm, 4000// number of particles, null//alternative container 800//Field width, 100//Field height, 800//Field depth);
The Effects version gives you the option to place the ParticleField in a separate container and implement vatious bitmap filters and effects on it via an EffectsLayer or a BitmapEffects layer.
With great sadness, I discovered that the VideoStreamMaterial delivered with the new Papervision3D package (GreatWhite) does not work. All you get is a black screen. A Papervision spokesman informed me that the new security package for the Adobe player willl not allow the hack which allowed access to RTMP streams to be accessed by bitmapdata. This is really sad as it means that the possibilities of creating effects on video streams just went out the window, or at least reduced considerably. I am now waiting for my chat cube to stop working. Very unfortunate
In a final match up of the usual suspects, the K-1 Grand Finals kicked off once again Semmy Shilt was victorious beating Peter Aerts in the final. The Lumberjack suffering a ruptured knee in a bad slip. As with all Semmy Shilt fights - not exciting at all. The fellow is just too large. Nonetheless there were some very good fights one of them being the Remy Bonjasky/Badr Hari match. These are 2 very technical Muay Thai fighters I greatly admire. Badr Hari has bulked up quite a bit but, it does not seem to have short changed him in the kicking department. He is still lightening quick. His punching has improved a lot and in my view I feel he should have won the fight. Make up your own mind from the video above
Papervision3D version 2.0 Alpha is now on general release. No doubt the result of months of hard work by the Papervision3D team. The latest build of the library is at the usual Googlecode SVN repository. There are a significant number of changes with this Alpha release. Notable are the 2 new library folders, GreatWhite and Effects, which replace the old Phunky, Ascollada, Timk_Frustum et al and a new class structure throughout the PV3D library. An example of this structural change is demonstrated by the new package location of the MaterialsList class which, is now in a "utils" folder, a sub-package of the materials package. The new features include Faster and improved performance, ShadeMaterials, Shaders, ASCollada (animation support), Frustrum Culling, Multiple Viewports, Render to Scene and more. The feature list will increase as more features are added.
The work flow has changed. In order to render you may need to deploy instances of the AnimationEngine, BasicRenderEngine and Viewport3D classes. Visualization is done via the Viewport3D class, and the BasicRenderEngine allows you reference the scene to be rendered and the camera view to be used. Having said that you now have multiple Viewports.
This is the new workflow:
var viewport:Viewport3D = new Viewport3D(0, 0, true, false);
addChild(viewport);
var renderer:BasicRenderEngine = new BasicRenderEngine();
var scene:Scene3D = new Scene3D();
var camera:Camera3D = new Camera3D();
For rendering:
renderer.renderScene(scene, camera, viewport);
***A note of warning, if you do not want to spend the whole day trying to sort out broken class paths with your perfectly working applications DO NOT UPDATE your current PV3D library via SVN. Create a new folder for this version of PV3D and start afresh. Enjoy!!
It really has been a long time since any boxing match generated so much interest. Pretty Boy Floyd Mayweather "The Master of Disaster", versus Ricky "The Hitman" Hatton. I've been a fan of FM for a long time and based on the list of people he's opened cans of "Whupass" for I just could not see how Hatton could do it. Brash though Mayweather may be, the Mayweather system of boxing needs to be seen to be believed. It is sheer brilliance. Well, its the morning after and yes, technique overcame heart, usually the case when the technique also has heart. To get an impression of what Floyd Mayweather is capable of, take a look at this: Floyd Mayweather in training
Continuing with my experiments using the bitmapdata class to animate textures for papervision 3d primitives in this case a modified cube. I'm also experimenting with dispatching events from the cubes. I've been very excited about the possibilities for the Bitmap and Bitmapdata classes, there seems to be so much scope for creativity.
Nothing is move disheartening to an interactive developer than videos sputtering and dropping packets. Its just plain embarrassing, especially when you're presenting to management or a client, all you get for your efforts are raised eyebrows, polite coughs, pursed lips and all that.... The problem of stuttering video in RTMP socket servers, viz, Flash Media Server and Red 5 can be solved either on the client or server. This embarrassing problem is usually the result of insufficient data buffering or insufficient bandwidth.
Stream Buffering: In Actionscript 2.0, the NetStream.setBufferingTime(t:Number) should solve the problem, in Actionscript 3.0, the NetStream.bufferTime achieves the same. I found this approach especially useful when dealing with the problem of stuttering streams from a Red5 server set up. Rupert Bear was stream optimized on Red5.
AS2
_nc:NetConnection = new NetConnection(); _nc.connect("rtmp://aYo1/streamingHeadache"); _ns:NetStream = new NetStream(_nc); _ns.setBufferTime(5); _ns.play("video1");
AS3
_nc:NetConnection = new NetConnection(); _nc.connect("rtmp://aYo1/streamingHeadache"); _ns:NetStream = new NetStream(_nc); _ns.bufferTime = 5; _ns.play("video1");