Archive for the ‘JAVASCRIPT’ Category

Tuesday, December 3rd, 2013

There are tons of javascript engines out there that are partial or full game engines for javascript and html.  Choosing one is quite difficult so Breakouts is there to help you compare with a common game ‘Breakout’ across all your favorites and some you might not know.

Feature Comparison

Current Breakouts

Monday, October 11th, 2010

Pretty promising project over at PhobosLab of the Impact Game Engine running on the iOS platform using the JavaScriptCore Framework. The best part is it has all Canvas calls passed into run on OpenGL ES thus the speedy demo.

Biolab Disaster on the iPhone 3GS from Dominic Szablewski on Vimeo.

The game is running in its own process and is not using the iPhone’s browser at all. Instead, it’s just using the JavaScriptCore Framework to run the game. All the necessary calls to the Canvas API have been reimplemented with OpenGL-ES and the touch input is passed over to JavaScript to be evaluated by the engine. I of course had to make some changes to the engine, but the game source code is exactly the same as for the web version.

This would probably never fly on the App Store because it executes code or interprets it but is a very nice experiment. More discussion at Hacker News..

Sunday, April 25th, 2010

A new Javascript 3D Engine that can render to Canvas and SVG has been released by mr. doob.

Mr. doob is a well known Flash developer that has added many great experiments and cool contributions without being stuck to one technology, making some great interactive projects in javascript, chrome experiments and html5 (canvas/svg) in addition to the work in Flash with toolkits like Papervision 3D.  Recently the Harmony html5/javascript sketching project generated lots of interest for an html5 sketching app.

Three.js is great because it is a 3d engine built with renderers in SVG and Canvas makes to a really good base for modular, cross platform 3d engine right now (as soon as IE9 joins the party). For a while a good javascript rendering library will need to support multiple renderers for browser differences in performance and supported dependencies like canvas, svg and webgl. Three.js has that reality as part of the design.

Currently the engine only supports particles and triangles/quads with flat colors. The aim is to keep the code as simple and modular as possible.

At the moment the engine can render using <canvas> and <svg>. WebGL rendering would come at a later stage but feel free to fork the project and have a go.

Although this allows 3D for iPhoneOS and Android platforms the performance on these devices is not too good.

Sample Code:

var camera, scene, renderer;

    setInterval(loop, 1000 / 60);

    function init()
        camera = new Camera(0, 0, 1000);

        scene = new Scene();

        renderer = new CanvasRenderer();
        renderer.setSize(window.innerWidth, window.innerHeight);

        for (var i = 0; i < 1000; i++)
            var particle = new Particle( new ColorMaterial(Math.random() * 0x808008 + 0x808080, 1) );
            particle.size = Math.random() * 10 + 5;
            particle.position.x = Math.random() * 2000 - 1000;
            particle.position.y = Math.random() * 2000 - 1000;
            particle.position.z = Math.random() * 2000 - 1000;
            scene.add( particle );


    function loop()
        renderer.render(scene, camera);

Sunday, April 11th, 2010

iTween is a tweening kit for Unity that is in the same style as TweenLite, Tweener and others in the tween format that is common for flash tween libraries in Actionscript 3. This library is available in javascript and C# for Unity 3d Projects and is quite fast and solid.

iTween is a simple one file drop in for some great scripted animation and easing that is very reminiscent of Flash using Penner equations and common libraries so it is easy to get started. It works for web player, desktop and iPhone Unity (however long that lasts).

Some sample code looks like this:

private GameObject go;
private GameObject cam;

void Awake()
    go = gameObject;
    cam = Camera.main.gameObject;

private void Start()
    iTween.rotateFrom(go, 1.5f, 0, null, 90, null, iTween.EasingType.easeInExpo);
    iTween.moveFrom(go, 1.5f, 0, null, 3.5f, null, iTween.EasingType.easeInExpo);
    iTween.colorTo(go, .3f, 1.5f, 3, .5f, 1.2f);
    iTween.shake(cam, .8f, 1.5f, null, .3f, null);
    iTween.scaleTo(go, 2, 2.3f, null, 2, null);
    iTween.rotateBy(go, null, 4.3f, .5f, null, null);
    iTween.moveTo(go, null, 4.6f, null, 1.2f, null);
    iTween.moveTo(go, null, 5.8f, null, 0, null, iTween.EasingType.easeInExpo);
    iTween.shake(cam, .8f, 6.8f, null, .3f, null);
    iTween.colorTo(go, .5f, 7.6f, .165f, .498f, .729f);
    iTween.scaleTo(go, null, 7.6f, null, 1, null);
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.

Thursday, July 16th, 2009

Haxe Sandy is a version of Sandy that can export to an experimental Javascript 3D engine taking advantage of the <canvas> element. There are some great demos that run smoothly in canvas capable browsers and very smooth in Chrome.

Demos of Haxe Sandy:

Sandy was actually the first open source 3d engine in flash, maybe this will be a trend building in haXe for export to flash and javascript?  It certainly looks like a great start and would make a very nice platform for 3d on the web allowing Sandy or other flash libraries to run in Flash and Javascript by writing in an abstraction platform like haXe. Other libraries like Motor2, Physaxe, haxe3D, PureMVC and more have haXe versions. Still very experimental but a possible need when Flash and canvas are both in the market in the future.  Right now it is still all Flash.

[ via Matthew Casperson at ]

Sunday, June 21st, 2009

This is a very cool project called V8-GL.  It is an OpenGL engine with 80% of the API converted to run on the V8 Javascript engine, the same engine that runs Google Chrome.

This is exciting as more productive languages like Javascript get speed boosts from engines like V8 and are capable of manipulating more complex systems like OpenGL.  Google is also pursing this in the browser with O3D with javascript manipulation of hardware rendering.  Also, a Google funded project called Unladen Swallow is converting Python to the LLVM virtual machine, so that it can have increasing speeds to compete with gcc speeds.

Making things easier to produce and control with more simplified and minimal languages like Javascript, Python and Actionscript etc that control more complex systems, that typically you would need to invest more time in such as a platform on C++ is the goal. V8-GL has this goal in mind.

V8-GL from the author states:

V8-GL intends to provide a high-level JavaScript API for creating 2D/3D hardware accelerated desktop graphics.

In other words, you can hack some JavaScript code that opens a desktop window and renders some 3D hardware accelerated graphics. Bindings are made using the V8 JavaScript engine.

Tuesday, April 21st, 2009

Google has a few things going for 3d in the browser, not just 3d but hardware rendering in the browser.  They previously had native client which allows you to run code via a plugin proxy with a sample running Quake.  They also had Lively which was a virtual world plugin that was shut down a few month after it started.

Now they are also making and releasing an O3D plugin that looks to be another way to do web 3d scenes and games although it is a very early stage. They appear to want to have an open discussion about how best to add hardware rendering to the web.  Their approach uses a javascript api to control the browser plugin and the O3D control is essentially just a renderer.

This won’t change anything now as Unity3D, Flash 3D pseudo engines, even Director 3D still are the top choices for games, apps, and interactives that need effects and possibly hardware rendering. But it is interesting that Google is essentially re-entering this debate after ditching on Lively and they must see some benefit to having a discussion about 3d on the web and 3d standards in general.  I know they have lots of models and tools with SketchUp and Google 3D warehouse so who knows maybe they will take it over by being standards, open and information based.

What is O3D?

O3D is an open-source web API for creating rich, interactive 3D applications in the browser. This API is shared at an early stage as part of a conversation with the broader developer community about establishing an open web standard for 3D graphics.

Get involved

One thing is for sure, 3d development is still old school proprietary lock in in most cases.  Working with 3d and tools like Maya, 3dsmax and others they have always been very non standard.  From file formats to interfaces to even basic movements, all different.  The general maths of 3d are the same and so should 3d pipelines.  Formats like COLLADA are nice because they are starting to open up 3d pipelines and content creation but COLLADA still has many porting issues.  FBX file format is another that is really useful and common making pipelines in Unity 3D, for instance, very nice. But it is owned and run by Autodesk who owns all the 3d apps (Maya, 3dsmax, SGI) and I am a bit leary of that method.  But in the end 3d pipelines and rendering will be somewhat standardized and maybe the web will be hardware rendered one day.  In most cases it is not needed, but for gaming, immersion, demos and other entertainment it could benefit heavily from a more standardized 3d pipeline and methods.

Thursday, April 9th, 2009

Well it appears ES4 path is dead officially and a new standard has been published replacing it, the ECMAScript Fifth Edition announced in Geneva, Switzerland and will be in place as fully tested and approved by all involved by the end of 2009. ES5 was previously known as ECMAScript 3.1 or an iteration of the ES3 standard that is what most JavaScript is based on in all browsers, and was previously competing with the ES4 newer standard that changed Javascript quite a bit but in many areas much better, in some areas it was bloated.

This revision of ECMA-262 will be known as ECMAScript, Fifth Edition. It was previously developed under the working name ECMAScript 3.1, which will no longer be used. ECMAScript is the scripting language that is used to create web pages with dynamic behavior. ECMAScript, which is more commonly known by the name JavaScript™, is an essential component of every web browser and the ECMAScript standard is one of the core standards that enable the existence of interoperable web applications on the World Wide Web.

ECMAScript Fifth Edition (ES5) was strongly guided by Crockford and Microsoft, which is different than the push for ES4 which is what ActionScript 3 is based on and was supported by Adobe and Mozilla.

However it seems everyone is happy and everyone is supporting this version to get things moving if you go by the ECMA Org quotes:

Industry Reaction

Brendan Eich, Mozilla CTO and creator of the JavaScript language, said “The Fifth Edition of ECMAScript makes real improvements based on browser innovation and collaboration in Ecma, which provides a solid foundation for further work in future editions.” Microsoft’s ECMAScript architect, Allen Wirfs-Brock, commented “We expect the Fifth Edition to benefit all web developers by helping improve browser interoperability and making enhanced scripting features broadly available.”


I still have to read further into the ECMAScript 5 specification which was published, but there are some new interesting things.

One nice feature is the JSON object.  Right now you have to eval to use JSON in javascript in a browser but they now have JSON.parse(object) and JSON.stringify(object) which is standard and conveniently already wired into IE8 this way. This is based on the JSON2.js library by Douglas Crockford of Yahoo.

var jsObjString = "{\"memberNull\" : null, \"memberNum\" : 3, \"memberStr\" : \"StringJSON\", \"memberBool\" : true , \"memberObj\" : { \"mnum\" : 1, \"mbool\" : false}, \"memberX\" : {}, \"memberArray\" : [33, \"StringTst\",null,{}]";
var jsObjStringParsed = JSON.parse(jsObjString);
var jsObjStringBack = JSON.stringify(jsObjStringParsed);

Another feature is DOM prototypes which are useful and cool, which allow you to extend dom objects.

If you use javascript or are an actionscripter, not sure if Adobe will have ActionScript 4 go this way or if Alchemy has changed the flash player into a multi language VM now.  It will be fun to watch things progress but also if you are into javascript it seems this standard, ES5, will be it by the end of the year.  And probably since IE8 already supports it, in all new browser by then as well.  It will probably take 1-2 years before browser saturation makes this usable but if you are using standards that mimic this then there will be no change then, such as the JSON2.js library.

Thursday, February 19th, 2009

The guys over at Flashbang Studios, a web game development studio in phoenix, az, and some of the most visible developers in the Unity3d space with Blurst, released something that may interest both FlashDevelop users and Unity3d developers.

UnityDevelop was released by Flashbang Studios recently and it is a modded version of FlashDevelop (originally from SharpDevelop a really nice open source .NET and mono IDE) and it supports intellisense for Javascript or Unity3d’s use of Javascript which is called UnityScript much like ActionScript.  UnityScript can be a little more strict and has access to all of Unity3d’s API calls just like C# and Boo in the mono based virtual machine that Unity3d uses.

FlashDevelop, is by far the best Flash / Flex /haXe IDE in my opinion so it is really great to release this for Unity.  I hope one day I or someone has the time to port to Mono so it can be used on Macs even with the 140 pinvokes, it would be a good spread mechanism for mono.

With Unity3d coming to windows soon, UnityDevelop could be a good go to IDE for unity if you aren’t using solely C# with VS.NET. Currently this is based on FlashDevelop2 source code.

Video Overview of UnityDevelop

UnityDevelop Walkthrough from Flashbang Studios on Vimeo.


Thanks flashbang!