Archive for the ‘PROGRAMMING’ Category

Monday, November 22nd, 2010

WebSockets and many other great features are now available across the iOS devices that are updated to iOS 4.2.

You can test your devices for WebSocket support and I just tested iPad and iPhone/iPods on iOS 4.2 and it is a go.

The update also adds some other excellent Safari browser features including:

  • As mentioned, WebSocket support
  • Accelerometer support
  • Improved SVG and Canvas rendering
  • Better Ajax

The new Safari on iOS 4.2 makes the iOS platform the current best html5 mobile solution for interactive apps and games in the browser. This should add some fun in terms of interactive web, games and better web experiences for iOS users.

We hope they add in WebGL support soon, there was mention of WebGLRenderingContext but not supported in browser yet.

Wednesday, September 1st, 2010
Apple and other mobile platforms like Android might change the big three in gaming consoles faster than people think.  Gamasutra has an article about Apple’s assault on the gaming industry.
Besides recently becoming the most popular configuration in the entire iPod lineup, the iPod Touch “has become the most popular portable game player in the world,” Jobs chimed. “The iPod Touch outsells Nintendo and Sony portable game players combined. It has over 50 percent market share for both the U.S. and worldwide.”
Small caveat is that the DS still has the most units but that will only last for a month or two more:
  • DS = 125m
  • iOS devices = 120m
  • PSP = 62m
Game sales
  • DS = 718m games sold
  • PSP = 252m
  • iOS games = 1.5B games and entertainment
But as far as devices Apple will surpass Nintendo this quarter as Apple handily beats them each month currently.
I believe that the Apple TV is also a notch in the future to console gaming, replacing the console with a thin client that can be controlled by handheld devices such as iOS devices. This may or may not happen but I think it will and it may be an Apple TV feature in the next year or two.  The Apple TV is an iOS device.
However, as Mike Capps commented to Gamasutra in our interview immediately following the event, “Right now, I can display from my iPad to my Apple TV on a big screen TV. How far away are we from ,’That’s my game console, and it’s displaying wirelessly to my television set?’ It’s not far away.”
What will that mean? What form will it take? How soon will it come? All unanswerable. But Sony, Nintendo, and even Microsoft are all officially on notice as of today.

Do consoles anchored to a TV suddenly seem like the old way?

To the argument that the Appstore is full of bad games, it is, but it is also the secret to their success.  Apple built a platform and let indies in.  Apple was very critisized about their approval process but Playstation, XBOX, Nintendo Wii, Nintendo DS, Sony PSP all have more harsh approval processes and dont’ even let indies begin developing until they approve.  The result is higher quality games on the latter devices however it is the same problem the web brought.

I think that was Nintendo and Sony’s downfall in that they didn’t jump on the downloadable store AND allow indies in.  There are lots of fart apps that come with allowing almost everything but you also get stuff like Angry Birds, Monster Dash, Real Racing, 2XL, Gameloft etc.  I’d rather let everything in and let the charts decide what is best rather than it be a closed market to indies from even trying.  But that comes with lower quality games for the most part except those standouts that might have been rejected on Nintendo or Sony platforms. 99% of the Appstore is crap but 1% is awesome, that 1% might be bigger than the quality games that make it to the PSP or DS.

Friday, August 27th, 2010

Chromium is moving to GPU hardware accelerate rendering all types of web content as much as possibly with their latest efforts.

For some time now, there’s been a lot of work going on to overhaul Chromium’s graphics system. New APIs and markup like WebGL and 3D CSS transforms are a major motivation for this work, but it also lets Chromium begin to take advantage of the GPU to speed up its entire drawing model, including many common 2D operations such as compositing and image scaling. As a lot of that work has been landing in tip-of-tree Chromium lately, we figured it was time for a primer.

The primer they are looking at is not just rendering the content made in WebGL, CSS3 3d transformations and more but the entire final pass of the output.  This leads to some very interesting years ahead in browsers.  With Chromium, IE9, Firefox and Safari all now with aspects of hardware rendering and acceleration via the GPU, anyone not doing GPU acceleration is seemingly behind the curve that seemed to start in 2007ish to a culmination of today’s latest browsers.

After these layers are rendered, there’s still a crucial last step to blend them all onto a single page as quickly as possible. Performing this last step on the CPU would have erased most of the performance gains achieved by accelerating individual layers, so Chromium now composites layers on the GPU when run with the –enable-accelerated-compositing flag.

Web content will get really interesting over the next couple years.  Even basic computers now have a GPU and bottom of 32MB video memory.  Why aren’t we using those GPUs as much as possible for web content and web games. The time of software rendering might be coming to an end now that processors seem to have topped out and the bottom level computer is capable of handling a decent amount of video memory. It will be easier to justify useful graphics acceleration with a better user experience when we can take advantage of all the computer/device has to offer.

Saturday, August 21st, 2010

Here’s a look at another interesting flash player implementation by Joa Ebert using Java with OpenGL rendering support. It is at an early stage but has the right idea in hardware rendering to OpenGL which is easily cross platform and mobile capable with speed.


This project is pretty new but there is work to make it web browser capable either in a java applet or a plugin for IE/FF/WebKit/etc but there are also others that are out there using alternative renderers. Most of these are in early development with varying support and do not currently compare to Adobe’s Flash Player versions.  However the hardware rendering ones like JITB may beat it fairly quickly once all the other features are added.  Complete OpenGL based renderers like Unity or WebGL are fast and can run pretty heavy rendering because of hardware acceleration for all drawing and native support.

Other Flash Player implementations:

  • Lightspark
    • AS3 script via LLVM
    • Written in C++ (very portable for native)
    • OpenGL accelerated rendering
  • Smokescreen
    • runs in Javascript/Canvas/html5
    • limited support
  • Swfdec
    • Firefox plugin
    • Early development
  • Gnash
    • flash 7-9 support

Flash Players that use OpenGL as the renderer are nice because cross platform support is easier.  The reason why OpenGL is a great idea is it is so cross platform on desktop and on mobile, it is also coming soon in WebGL for the browser hopefully.

Versions of OpenGL and support

  • OpenGL ES
    • OpenGL ES 1.1 = OpenGL 1.5 and lower (fixed function)
      • Android
      • iOS devices 3rd gen and lessx
    • OpenGL ES 2.0 = OpenGL 2+ (current version 4.1 – shader capable).
      • iPhone (3GS or later), iPod Touch (3rd generation and later) and iPad
      • Android 2.2+
      • WebGL
  • OpenGL
    • Windows
    • OSX
    • Linux

There is still a clear open field for an open source player to match something like Moonlight for Silverlight or hardware rendered canvas. WebGL would be great to have in time if it gets support but it is also nice to have a compiled language in the content that works in the player faster than scripting but with the ease of scripting. Plugins are still very relevant if they can address that.


Saturday, July 24th, 2010

A sweet engine for getting started with Android game development is the andengine 2D OpenGL ES engine. This is very simple and compares with cocos2d-iphone for iOS development in 2D with OpenGL ES.  They both support a wide range of 2d techniques with an OpenGL renderer.  Some great videos are posted on the andengine google code page showing a box2D example, multiplayer example and more.

Mobile games are on slower hardware, similar to later 90′s computers so native is a great way to go for 3d and 2d game development because of this limitation at the current time and well into the next few years.  Take this time to learn you some native gamedev. andengine isn’t native directly as it is Java based but compiled with the Dalvik JIT virtual machine. Another way to go native on Android is the Android NDK which allows C and C++.

The engine also has extensions that can be easily added and some great ones exist already.

Wednesday, June 23rd, 2010

Wow. IE9 just set it in motion.

Canvas 2D is now really on the horizon for all browsers. IE9 preview now supports the <canvas> tag and all canvas element APIs and most Canvas 2D context APIs and attributes!

Features Available

  • Canvas
    • In the latest Platform Preview we support all Canvas element APIs and most Canvas 2D Context APIs and attributes.

Features Partially Implemented

  • Canvas
    • globalCompositeOperation
      • The latest Platform Preview does not include support for the globalCompositeOperation attribute.
    • DOM Exceptions
      • The latest Platform Preview does not include support for Canvas 2D Context DOM Exceptions.
    • drawFocusRing()
      • The latest Platform Preview does not include support for the drawFocusRing() Focus management API.

This is pretty amazing even though it has been hinted at by other news (previously from AMD).  Why should we care what Internet Explorer is up to?  Well the dream of standards across web browsers seems to be materializing for html5 and more importantly, canvas 2d.

Even with Silverlight Microsoft has decided to join the party and upgrade the web on some great standards to build even more innovative platforms on top of.  Some may see this as a death knell for Silverlight, Flash etc but I do not see it that way. I see <canvas> as a competing interactive technology but many times technologies bind together for a better experience, they also drive one another to innovate.

Much like Silverlight pushed Flash, and Silverlight was created because of Flash, those two technologies brought on canvas 2D and more graphical capabilities for the web in the interactive, game and application space.  As javascript execution has sped up so has the graphical capabilities of browsers now. What is not to like about that if you are an interactive developer?

Canvas, Flash, Silverlight are all for the most part still software/CPU accelerated. The question is who will start the hardware acceleration of canvas and competing technologies even further to bring us closer to OpenGL ES/WebGL in the browser?

Ars Technica states that IE9 will have hardware accelerated canvas in addition to SVG but that doesn’t seem to be officially stated anywhere by Microsoft yet that I can find.  AMD has hinted at it and previous news about SVG being hardware acclerated.  Time will tell and it will be a HUGE boost to the browsers that do, of course we need all of them to do it to be worthwhile for mainstream content.

Ars on the hardware accelerated canvas support:

What does come as a surprise is canvas support. Microsoft has been promoting Internet Explorer 9′s support of SVG, which provides vector graphics capabilities within the Web browser, but thus far has kept quiet when asked if it would support the canvas bitmap graphics specification. Not only is canvas being supported, it is also being hardware accelerated, continuing Microsoft’s efforts to give Web applications the ability to exploit the extensive hardware capabilities of modern PCs.

Of course we should tread carefully here, there is still a big chance that portions of the canvas 2d spec will not be implemented exactly the same or some browser may have missing features much like CSS and javascript evolution.  For instance the “most Canvas 2D Context APIs and attributes” is something I hope is addressed in the final IE9. If you are gonna spend the time implementing a standard, do it fully and right, don’t try to break it (an old Microsoft tactic). But this step was needed to again push interactive web technologies to more closely compete with desktop graphic technology which adds some really exciting times ahead.

Another golden ray of hope is ES5 support in IE9.  Again Wow!

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;

    init();
    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;
            particle.updateMatrix();
            scene.add( particle );
        }

        document.body.appendChild(renderer.viewport);
    }

    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);
}
Wednesday, December 9th, 2009

Google is pushing Web Sockets into Chrome based on the Web Socket standards being developed at all major engineering standards groups.  Web Socket is an interesting direction but it is great to couple that with O3G or WebGL for some multiplayer 3d game development with just a browser.

Starting in the Google Chrome developer channel release 4.0.249.0, Web Sockets are available and enabled by default. Web Sockets are “TCP for the Web,” a next-generation bidirectional communication technology for web applications being standardized in part of Web Applications 1.0. We’ve implemented this feature as described in our design docs for WebKit and Chromium.

Sample Code

if ("WebSocket" in window) {
  var ws = new WebSocket("ws://example.com/service");
  ws.onopen = function() {
    // Web Socket is connected. You can send data by send() method.
    ws.send("message to send"); ....
  };
  ws.onmessage = function (evt) { var received_msg = evt.data; ... };
  ws.onclose = function() { // websocket is closed. };
} else {
  // the browser doesn't support WebSocket.
}

Socket Advantage

Flash has long been the answer for sockets for web applications and once sockets were added to Flash it instantly became a better interactive and gaming platform for multi-user applications and multiplayer games. They started with XmlSocket then recently added Socket for raw binary data in as3.  Silverlight and Java also have this feature but having this in script is pretty significant because many applications could really use a browser supported bi-directional communication link.

What is Missing

The biggie missing from Flash, Silverlight, etc and Web Sockets is UDP and preferably RUDP or Reliable UDP which allows UDP datagrams to be sent back and forth either verified delivery or broadcast. Unity does support UDP.  The best socket layers are reliable UDP based because mixing TCP and UDP can lead to queuing and not all messages are critical so having just UDP isn’t enough, having TCP is too much.  Reliable UDP is the way to go but so far no web layers are doing it well except Unity on that one (you still have to make your own RUDP implementation – libraries like Raknet or enet in C/C++ give you this but you can’t use that in Unity client only on the server). (Edit: Flash does have RTMFP which is based on UDP and uses FMS for nat for p2p but it is still not a true low level UDP socket just yet as it supports more features. A low-level UDP socket would also be nice in flash.)

Web Communication Evolving

I am a big Flash fan and have been developing it since 1999 among other platforms, I have recently watched other technologies nearly match the features and some go beyond it.  The interesting thing about Web Sockets is that it does go after a core feature of flash; Canvas and WebGL or O3D also do. Flash still has the webcam, mic, sound mixers/tranform, and for now sockets which put it at an advantage in gaming and interactive. Flash used to  be the sole greatest video player but Silverlight is doing a pretty good job of that as well so that is still an advantage but others are entering including possibly browser support in html5. I still think it is the best video but they would need to keep innovating.

Another interesting point about this is XMLHttpRequest objects.  Originally “AJAX” was created by Microsoft for IE, pushing new features and innovating back when IE was a good browser and ahead in IE4. Mozilla and others adopted this feature (as well as editable text areas for html) because they were great features for web applications to evolve to.  now Google is pushing with Chrome and Web Sockets is the next step that should be in web browsers even if it is only TCP based for now.  This will add great capabilities and will probably be preferred over AJAX/XMLHttpRequest for really interactive and real-time tools/games should it take hold.  Ian Hickson is running the table on the standards with this effort and it is a good one to get behind.

Wednesday, December 2nd, 2009

If the question is if Unity can do interactives as smooth and stylish as Flash I think you may soon find out.  Carlos Ulloa of Papervision 3D fame has kicked it up a notch in Unity 3D with this interactive very reminiscent of the Ford Focus demo that helped bring in Papervision 3D for flash in style. Gotta say though a mini is much better than a Ford Focus.

Flash is still the leader in web interactives and even marketing interactive 3d, Unity largely replaced Director and tools like it and high-end hardware rendered required interactives and games. This interactive by HelloEnjoy has loads of polygons, unity physics system, lighting, environment mapping, showroom cameras, reflection, skid decals, highly detailed mesh and more.  Just take a peek inside the vehicle and at the rims for the detail that is impossible with the 2000 poly limit of Flash 3D software rendered engines.

Web interactives this heavy aren’t doable in a non hardware rendered player like Flash.  Unity is looking to pretty much own this level of quality in a browser.  I don’t think I have seen another interactive looking this good with Unity 3D.

Unity still is lacking many features that Flash has in support of making interactives for the web such as webcam support, mic support, better video support, better gui system, html support (although flash barely) and a larger install base but Unity could easily take the high-end advertising market in addition to owning highly immersive games that need hardware rendering which it is already doing for web gaming.  It is 2010 soon, most computers have a decent video card.  Put them to use!