Tuesday, June 28, 2011

Flash Image Atlas Animation System. Why?

This was suppose to be posted on Sunday, but with my mother going into the hospital, I kind of forgot about posting it. Sorry for the delay.

As part of my larger project, I have decided to develop my own animation system. As this larger project is currently being done in Flash, which is essentially an animation system with a powerful programming language tacked on to it, this may seem redundant. If I knew for sure that the project was going to be exclusively done in Flash, it would be. The truth is that I may end up having to port the game to other devices. While Flash is sort of runnable on portable devices, the performance currently isn't quite there. If, when my game is in a near finished state, the game runs fine on the target devices then there is no issue. However, this is not necessarily going to be the case so I have been looking into what would be involved in porting a game by creating a native version for certain devices.

OpenGL ES is pretty much the standard for all the devices I am thinking about targeting. While studying OpenGL one common optimization that comes highly recommended is to combine the textures that one is using into something called an image atlas. As it turns out, an image atlas is a more advanced version of image strips (aka sprite strips) and image grids (aka image sheets or sprite sheets). Image strips/sheets are what I was using for my Java games so I am well versed in the technique.

A lot of the artwork for my larger-scale game is bitmap graphics so  creating a library that allows for an image atlas to drive an animation would be convenient and make porting easier. Spending a development week or two to get this functionality is really not much of a loss while the benefits are potentially great. I define a development week to be 40 hours which is a typical work week in Canada. As my work on the large scale game is part time, it may take two or three weeks in real world time for a development week. I plan on porting it to HTML 5 and possibly other platforms. Not too long ago I created a simple image atlas class for my HTML 5 JavaScript graphics library so an HTML 5 port so the HTML 5 version should be fairly quick to develop. This will give me a common set of components that will make it much easier to switch between platforms. While I personally believe that Flash will be around for a while, having an easy path to other platforms doesn't hurt.

In fact, with Microsoft not supporting Web GL in IE 9, any web-based will have to use a plug-in such as the upcoming Flash 11 to support 3D graphics in a cross-platform way. While Microsoft is claiming security issues (WebGL is fundementally far more secure than Microsoft's Active X which is still in IE), I hear that in Windows 8 there will be browser support for accessing Direct X 11. Since Direct X is essentially a less-secure version of Open GL (what WebGL is based on) I am wondering what Microsoft's true motivations for not supporting WebGL are. Still, I see the future of 3D on the web being Flash. Ideally it will be a WebGL with fallback to Flash future but more likely it will be just Flash with paid iOS apps for Apple users. Thanks Microsoft.

No comments: