Archive for the ‘LIBRARIES’ Category

Saturday, August 8th, 2009

So many cool and useful technologies are unveiled at SIGGRAPH every year, this year at SIGGRAPH 2009 was no different.  Khronos Group, behind the new guidance of OpenGL, OpenGL ES, OpenCL, OpenVG, COLLADA etc, came another big announcement about hardware rendering within the browser.  WebGL is now an official standard being developed at Khronos Group to bring javascript control of OpenGL to browsers… Wow!

Ok so this was officially announced at the GDC in March but limited information, but now it has been slated for an official public standard in early 2010. Shortly after the announcement at the GDC we saw Google o3D appear doing exactly that, controlling OpenGL through Javascript in the browser but it was still largely software/harward hybrid rendered. Google, Mozilla, Opera are part of the companies supporting WebGL which is great for browser support, also NVIDIA, AMD and Ericsson are in on it.

Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet

JavaScript Binding to OpenGL ES 2.0 for Rich 3D Web Graphics without Browser Plugins;
Wide industry Support from Major Browser Vendors including Google, Mozilla and Opera; Specification will be Available Royalty-free to all Developers

4th August, 2009 – New Orleans, SIGGRAPH 2009 – The Khronos™ Group, today announced more details on its new WebGL™ working group for enabling hardware-accelerated 3D graphics in Web pages without the need for browser plug-ins.  First announced at the Game Developers Conference in March of 2009, the WebGL working group includes many industry leaders such as AMD, Ericsson, Google, Mozilla, NVIDIA and Opera.  The WebGL working group is defining a JavaScript binding to OpenGL® ES 2.0 to enable rich 3D graphics within a browser on any platform supporting the OpenGL or OpenGL ES graphics standards.  The working group is developing the specification to provide content portability across diverse browsers and platforms, including the capability of portable, secure shader programs.  WebGL will be a royalty-free standard developed under the proven Khronos development process, with the target of a first public release in first half of 2010. Khronos warmly welcomes any interested company to become a member and participate in the development of the WebGL specification.

Google released O3D this year and there are great strides in 3d within the browser from game engine wrapper technologies such as instant action technology, gaim theory engine (now owned by id Software and runs Quake  Live, hardware rendered Unity 3D (and Torque 3D coming soon), and Flash software rendered  3d engines Papervision 3D, Away 3D, Sandy (Sandy also released a haXe version that exports a javascript version) and others.  But it looks like the movement is to bring OpenGL to the web as a standard under the name WebGL, this would be great!  There would still be lots of times where plugins are better now and in the near future but the path is a good one. Having a software/hardware rendering hybrid like Google O3D for broad video card support (some of the painful older intel cards), or using a plugin like Unity3D, Torque 3D or wrapper technology for bigger engines is a good idea for the time being. But the future is grand in this area.

I think that Google O3D and OpenGL ES success on iPhone games probably combined to get this in motion.  OpenGL and very basic video cards are now standard in most machines out there.  Unity3D actually published hardware statistics on casual gamers (web-based games) ever so kindly and shows that even though there are some older Intel cards out there, for the most part machines nowadays have a video card capable of supporting at least low-poly 3d and hardware supported 2d rendering in real-time for games, user interfaces and more.

This is exciting news, it appears the movement of the web gaming market is getting much more capable and is accelerating the innovation of hardware accelerating the web.

Friday, June 19th, 2009

haXe is an interesting programming language that allows abstracting the source from platform target.  It outputs for targets such as Actionscript and Javascript from haxe language source. But, haXe can also output to native code to run on Windows, Mac OSX, and Linux.

Well because of this it is possible to run haXe on the iPhone. The gamehaXe site has found a way to get haXe to compile to iPhone via hxcpp which creates a C++ output from haXe code very similar to Actionscript 3.

I am a bit late to the party but this is great news. It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.

This project is one to watch and participate in.  Native compilation to the iPhone from haXe is a more simplified code to write in while providing lower level performance which is needed on mobile devices, as processors, cache and ram are much lower than desktop and below what is capable of running the Flash AVM2 currently.

If you have more interest in haXe there are some other great demos on as3/haXe at the game haXe site. Also, Tony at touchmypixel.com has posted some very useful information to help you get started with hxcpp.

The hxcpp project is a newer output target along with a java one but this could be interesting if actionscript like code and many libraries like Physaxe or AS3 libraries could be ported to haXe to output to the iPhone.

Monday, May 18th, 2009

pyamf is pretty sweet for Flash remoting with Pythonic server side, but now we have two nicely done and integrated remoting kits for python on the server side.

amfast is a new remoting library  that looks to be as sweet as pyamf (where sweet == fast and useful).  I am checking out amfast now but the speed boost alone might be worth it.  For instance, working with real-time games, when you need static content you need to grab that quickly sometimes via a content service.  The faster that link the better. It also has Twisted integration which is great for networking and SQLAlchemy integration which is in my opinion the best ORM for python (pyamf has twisted, django, pylons, sqlalchemy as well)

amfast is well documented and has some great examples.  If you have the Python addiction, check it.

Description

  • AmFast is a Flash remoting framework for Python.
  • AmFast can use AMF to communicate between Python and Flash, Flex, and any other system that supports AMF.
  • AMF is a binary object serialization protocol used by Actionscript based applications.

Server Features

  • Support for NetConnection and RemoteObject RPC.
  • Support for Producer/Consumer ‘push’ messaging with HTTP polling, HTTP long-polling, and real-time HTTP streaming channels.
  • Support for authentication with NetConnection and RemoteObject.
  • Flexible Target mapping system to map message destinations to invokable Target objects.
  • Support for ChannelSets with multiple Channels to expose resources in different ways.
  • Built in Channels for CherryPy, Twisted Web, and plain WSGI.
  • Support for configurable Endpoints. Use AmFast’s built-in AMF encoder/decoder C-extension, or use an external AMF encoder/decoder, such as PyAmf for a pure-Python implementation.

AMF Encoder/Decoder Features

  • AMF0/AMF3 encoder/decoder written in C as a Python extension for speed.
  • More than 10x faster than the PyAmf encoder/decoder (even when using PyAmf’s optional C-extension).
  • Map custom classes with ClassDef objects for complete control over serialization/de-serialization.
  • Full support for IExternalizable objects.
  • Data persistence with SqlAlchemy including remotely-loadable lazy-loaded attributes.
  • Actionscript code generation from ClassDef objects.
Thursday, April 30th, 2009

Yogurt3D flash based 3d engine appeared recently and is another flash based 3d engine which is based on OpenGL called SwiftGL and is stated as open source.

The site mentions that OpenGL source can be converted to run in the engine.  You can do this now with Alchemy although it is in very early stages.  It is not clear if it is an automatic conversion or if it simply means it is similar in syntax and method signatures, objects etc.

I definitely will be watching and see how it progresses, there isn’t much other than a single post about the engine so far and no info on the api or sample code.  Looking forward to seeing more, the z-sorting is quite nice.  Doesn’t appear like collisions are there yet but it has a nice look.

Sometimes excellent toolkits come out of the blue like this such as Ffilmation (isometric flash engine) or Alternativa (flash 3d engine flash 10 focused) so you never know.

Monday, March 16th, 2009

Libspark from Japan is a treasure trove of great flash advancements, they seem to realize the great things that can come from porting in existing solid libraries from C/C++ etc into flash and have been scoring lately including augmented reality in flash porting the ARToolkit to FLARToolkit.  Recently a port of openCV for as3 called Marilena was found and it is for object detection and decent facial recognition (it is a computer vision library from intel) considering the processing power needed to do this.

Face Detection: Here is the sample included with Marilena showing facial detection on an image.

marilena1

Lots of recent action has blown up on this front from Mr doob, quasimondo (optimizing the Marilena classes for better performance) and Boffwswana. Also there is a kit called deface by sshipman that is the first foray into this a year ago doing similar things but it was just a bit before it’s time and a bit slow in previous versions of flash, it performs decent now in this sample. Flash 10 performance of the AVM2 and future directions with Alchemy will lead to more interesting stuff just like this.

Mr. doob head tracking sample, be sure to check lots of other examples there

mrdoob_facedriven3d

Boffswana example of head tracking Johnny Lee Wii style with only a webcam and flash, no wiimote needed since it uses facial detection to check where you are and how close you are in the screen and then moves accordingly.

bofswana

This is stemming from the recent explosion of the FLARToolkit and augmented reality in flash as well as the gimmicks used by Nintendo with the wii and Johnny Lee’s great head tracking advancements. Porting great libraries to flash seems to be the phase we are entering now judging by the recent excitement around Adobe Alchemy and the LLVM along with the lead from the libspark.org contributors. We have also seen this heavily last year in ports of Box2D for 2d physics and other toolkits using established working code and porting that to flash now that is is mostly capable of handling the performance.

OpenCV (Open Computer Vision Library by Intel) is quite a powerful platform that allows you to do all this and now it is available in flash. There are other great libraries for nearly all platforms now. I have done some previous work with Aforge which is also a port of OpenCV mainly for motion detection. This was always around but not until the recent performance updates and the innovation that has come with Alchemy and the thinking that goes along with that (porting in libraries to flash from C/C++ etc), has allowed this to flourish in flash and thus the web.

The amazing new things we can do with flash by porting in existing libraries is only going to get more intense as alchemy and flash 10 are even more mainstream.  It is almost as if Flash will eventually just become a web renderer and simplified front end to many great toolkits that exist in more native environments like C/C++ but with the speed and distribution access of the web with Flash.  Exciting times ahead.

Friday, March 13th, 2009

Polygonal labs, maker of some of the best demos, information and tools for AS3 since inception updated the killer AS3 Data Structures for Game Developers and ported it to haXe.

Of course along the way making many improvements and showing great information on how and why the haXe version is faster which mainly boils down to a more strict virtual machine but flexible still with generics.

haXe is fast because it is a very highly optimized virtual machine language with compiler (and could be called a virtual machine to target other VMs similar to LLVM with the ability to target the Neko VM, AVM2 or Javascript, it is more than just a language) by Nicolas Cannasse that may one day overtake directly coding for the AVM2 or maybe we will even see haXe have more influence on flash soon for performance gains.  Some of the Alchemy LLVM virtual machine work is similar in nature to what haXe does and helps the language become an abstraction and translates into highly optimized code from very powerful and productive language syntax.

Anyways, I ramble, be sure to check out Data Structures for Game Developers by Polygonal Labs now ported for haXe as hx3ds if you are doing any sort of work in AS3 or haXe for AS3 it will be worth your while and provide a very common and useful data structures capabilities into your production that is highly optimized from one of the best AS3 developers.

As the name suggests, hx3ds is a port of as3ds for haXe and is now available at lib.haxe.org. hx3ds only supports the flash player 10 target, as it makes extensive use of the Vector class. If you need data structures that compile across all platforms, take a look at colhx instead.

Here’s a list of new features:

  • orders of magnitude faster
  • collections now support clone() and shuffle() operations
  • object pooling framework
  • revised graph, tree and linked list classes
  • memory manager for the virtual memory API (more on this soon)

The Structures Included

Multi-Dimensional Arrays

The library contains a two-dimensional and three-dimensional array. They are both implemented by a single linear array rather than nested arrays. This is the fastest method in flash to simulate multi-dimensional arrays and outperforms the nested array method because multiple array lookups are slower compared to one lookup combined with a simple arithmetic expression (which you can also often precompute in the outer loop). The most obvious application would be a tilemap in 2d or a layered tilemap in 3d.

Queue

This is also called a FIFO structure (First In – First Out). The queue comes in two variations, which have the same methods, but differ in their implementations: There is the arrayed queue, which obviously uses an array internally, and the linked queue, which is build upon a linked list. They are both very similar, except that the arrayed version has a fixed size and is faster.
A common application would be a command queue – imagine you have a unit in a strategy game and apply many commands which the unit should follow. All commands are enqueued and afterwards dequeued and processed in order.

Stack

Also commonly know as a FILO structure (First In – Last Out). Like the queue, this comes in two flavors: arrayed and linked. A stack is often not used directly, but a very important concept in programming. Please note, that a queue and a stack are not real structures, because they just define how data is accessed rather then stored.

Tree

A node-based structure. Every tree starts from a single node, called the root node. The root node can contain any number of child nodes, and every child node can again contain children. A tree node with no children is called a leaf node. In fact if you draw the nodes of a tree it looking like a real tree with branches. The AS3 display architecture is also a tree structure, so you could use this to manage your display objects and update them by traversing through the tree. Also, this is useful for decision trees, BVHs, storing a plot line or storing data recursively by applying the composite pattern.

Binary Tree

This is just a specialized kind of tree where each node is only allowed to have up to two children, called the left and right node. Binary trees are very often used for parsing input data, for example arithmetic expressions or when building a scripting system.

Binary Search Tree (BST) and Hash Table

Both structures store data that can be retrieved quickly by using a key. The method however differers greatly: The BST uses a recursive approach to split up large amounts of data into smaller sets. A hash table stores sparse key-based data using a hash-key in a small amount of space.

Linked Lists

A linked list is similar to an array. The main difference is that in an array, each cell contains just the data and is accessed by an index. A linked list consists of several node objects, which in addition to storing the data, manage a reference to the next node (singly linked) or to the next and previous node (doubly linked) in the list. Think of it as a more natural approach to work with sequential data.
Other benefits are that you can insert and remove data quickly by just calling the appropriate method on the node itself – you don’t have to manage array indexes. Also in AS3 object access is faster than array access, so it competes very well in terms of performance when iterating over the list.

Heap and Priority Queue

A Heap is a special kind of binary tree in which every node is bigger than its child nodes. Whatever you throw into a heap, it’s automatically sorted so the item with the ‘most significant’ value (depending on the comparison function) is always the front item. A priority queue is build upon the heap structure, and can manage prioritized data – which can be used in limitless ways.

Graph

A graph is a loose node-based structure. Nodes are connected with arcs, and every node can point to any other node. They can also point to each other creating a bi-directional connection. It is essential for path finding, AI, soft-body dynamics with mass-springs systems and a lot more.

Bit Vector

A bit vector is some kind of array in which you can store boolean values (true/false – 1/0) as close as possible without wasting memory. I currently can’t think of a reasonable application, because usually you should have enough memory – but it’s nice to have because it shows basic bit masking operations.

Saturday, February 28th, 2009

Alchemy is going to shake things up a bit.  As witnessed before from Quake running in flash and now ODE compiled to run in flash using Alchemy (LLVM based). It is an early test but shows what could be possible.

Mihai Pricope has a post with sources on how he got the ODE (Open Dynamics Engine) a great open source physics engine for 3D, running on the AVM2 Flash Player virtual machine.

I’ve took Alchemy for a test and decided to compile ODE (Open Dynamic Engine). Just to add yet another physics engine to the Flash World. It was a hell of a ride but I finally got to produce some bouncing balls :). For a still unknown reason some as 3d libraries have been very slow to render 6 translucent walls and 2 balls. Papervision3D seems to move quite decent.

You can download the ode sources from here. To recompile them do (you need to have the Alchemy environment turned on):

Flash 10 will become mainstream shortly and with that the possibilities of using Alchemy in your projects is becoming a reality for production.  But what specifically can you do with Alchemy, a project that helps to compile C/C++ code into AVM2 capable files?

Alchemy described from Adobe:

With Alchemy, Web application developers can now reuse hundreds of millions of lines of existing open source C and C++ client or server-side code on the Flash Platform.  Alchemy brings the power of high performance C and C++ libraries to Web applications with minimal degradation on AVM2.  The C/C++ code is compiled to ActionScript 3.0 as a SWF or SWC that runs on Adobe Flash Player 10 or Adobe AIR 1.5.

Alchemy is based on the LLVM Low Level Virtual Machine that allows new levels of code translation.  Maybe this can lead to more effective and performing code to run on the iPhone with flash player 10. Or some type of system that allows flash developers to code in AS3 or take projects and get them ready to run on the iPhone much like some of the Java to Cocoa compilation systems and Unity3D using mono to compile down to iPhone capable code.

Wednesday, February 18th, 2009

Looks like it is a javascript day here at *drawlogic.  Here is an interesting example with some demos of a javascript and canvas based pseudo 3d engine. Anything this cool you know it has to be from Japan.
Also of note, it has been rumored that Silverlight 3 will have fully hardware accelerated 3d and canvas and javascript engines are getting much faster with great demos like this.  Adobe needs to leap into hardware acceleration for flash on a broader scale soon.

But I digress, this demo it appears, was inspired by Papervision3D due to the naming and the javascript reference of “parpevision.js“.  I wasn’t able to find much more information about this but it is very well done and this example even shows some environment mapping. It is not close to flash pseudo-3d engines like Papervision3D yet but at the rate of javascript engine development lately this could rival flash AVM2 in the next couple of years.

Demos

Code

Here is the code for the parpevision.js file and the mini engine, it is an MIT license. (more…)

Wednesday, February 18th, 2009

Box2D is responsible for inspiring many 2d physics engines including Motor2, Box2DFlashAS3 and others.  Box2D the original toolkit is a solid c++ physics engine that has many great examples and features including real collision.

Now it has inspired a pure Javascript version of Box2D called Box2Djs to (using prototype dependency) to implement many of the same demos using the same functionality.  So it appears Box2D if you want to find a baseline standard physics kit for 2D, it now has versions in many languages that might allow you to have 2d physics capabilities across many platforms.

Box2DJS is a JavaScript port of Box2D Physics Engine. To tell the truth, this is converted from Box2DFlashAS3_1.4.3.1 in an automatic manner. (The reason why not Box2DFlashAS3_2.0.0 based is simply because I overlooked the renewal.)

Dependencies

  • prototype.js
  • IECanvas (when you use a canvas tag to display the result of your physics simulation)

Links

How to use

  1. Download a zip file and extract it.
  2. Copy js/ and lib/ directories from the extracted directory to your app directory.
  3. Copy script tags in the header part of index.html in the extacted directory to your html file where you want to simulate physics.

    Because this library does not have a lazy-loading system now, you should load all classes before starting your simulation. To make things worse, each library has a bit complicated dependency each other so that loading libraries in wrong order may cause a fatal error. To avoid such a trouble, it is strongly recommended to copy the header part of this file or `index.html’ including the downloaded zip file.

  4. Utilizing Box2D APIs, simulate the newton world as you like.

    The Box2DJS APIs are completely same as those of Box2DFlashAS3. Please refer information about it.

Also the speed of your javascript engine makes a big difference just like the AS2 AVM1 to the AS3 AVM2 virtual machines.  Chrome is much faster than FF3.

Video of Box2DJS in Chrome

Video of Box2DJS in FF3

Tuesday, December 30th, 2008

SWFAddress 2.2 has been released.  SWFAddress is pretty much THE solution for deep linking in flash and works greatly in combo with THE embedding solution into (X)HTML/Javascript for flash SWFObject.

The new SWFAddress has just arrived after seven months of active development, various contributions and lots of positive feedback from the community. The list of changes includes the following:

  • Refactored JavaScript implementation
  • New SWFAddress.swc AS3 component
  • New CS4 based Splash screen sample
  • New Digg API sample
  • New up() method for easier deep linking path navigation
  • New XSS protection that doesn’t affect special characters
  • Support for Internet Explorer 8
  • Support for custom HTTP status messages in the SEO sample
  • Improved title handling
  • Improved unload event handling for IE
  • Updated Rails sample
  • Fixed getBaseURL() for AS3
  • Fixed Safari 2.0-2.0.3 support
  • Build-in fix for the Firefox 3/Mac OSX blinking effect
  • Additional onLoad fix for application/xml content type
  • Fixed optional options parameter for the popup method
  • Cross platform build script
  • Various optimizations

I believe that this new version is pretty stable and won’t require an update soon. There are two known Safari bugs (19202 and 20355) that currently affect the project and we can only hope that they will make it’s way into the next major release of the browser.

SWFAddress has grown significantly in the last two years and it’s very likely that we’re going to provide a lite version for users who need just the basic functionality. Very soon the same API will become available for Silverlight and we’re also scheduling the development of a jQuery plugin.