Flash, HTML5, WebGL and Unity

I’m a bit late to the party here, but the internet has been buzzing a lot lately with the ‘news’ that Adobe has killed Flash. Well, not quite.

First off let’s put this into perspective. They’ve killed Flash Mobile, more specifically the plug-in that comes with mobile phones in their browser. Does this mean Flash on mobile and tablet platforms is completely dead and gone? No, in fact the majority of Flash experiences on mobile and desktop will likely move to AIR.

Can AIR3 save Flash?

Android phones can still use AIR, as will the RIM Playbook (ha ha.) iOS apps built with Flash are built in a different way, essentially having a version of AIR compiled into them – and iOS never permitted in-browser Flash – so it’s completely irrelevant to that platform anyway.

Matter of fact I would say this announcement is a good thing. First of all, Android and Playbook will still get Flash Player 11, which is way advanced for a browser plug-in for your phone. Still I think the Flash pipeline is starting to breach into some really cool territory, with fully fledged 3D hardware acceleration and the ability to finally produce fully native apps (see Captive AIR Runtimes and other AIR3 features.)

At least for the immediate future, AIR3 is a great step forward for game devs in Flash because it gives them a way to get their awesome experiences out to the world with minimal fuss.

Still, stigma is a big thing on the web. HTML5 is the future, primarily because the number is higher than HTML4. It has exciting things available like Canvas and WebGL which mean Flash will soon be redundant. Well. Someday.

HTML - The Future.. sort of

See, we’re not quite there yet. For games, HTML5 relies heavily on WebGL to deliver good performance. The Canvas element (while cool) isn’t really up to speed in the performance arena. You can also resort to moving images around the screen with JavaScript and CSS, which is kind of a nasty hack in my opinion. But WebGL can do some really cool stuff!

WebGL Demo

Awesome WebGL Water FX

Hopefully you can see that properly, it’s a really cool rippling water demo in WebGL (see preview image at right.) If you can’t – well – WebGL isn’t available to everyone for a few reasons. One would be that not all platforms and browsers support it. On one particularly important platform, it’s proprietary and only available to advertisers. Actually one other browser manufacturer that makes up fully 40% of the browsing world has no plans whatsoever to support it.

There’s a number of other issues – incomplete HTML5 implementations aside, we’re plagued with other problems like people who don’t or can’t upgrade their browserperformance and inconsistent behaviour (see above.) But we’re getting there. Still, it’s hard to understand why we’re accepting these drawbacks now when we have a plug-in (Flash) that all but eliminates these problems.

OK. So the word “Flash” isn’t sexy anymore in the tech world, especially not in the web world. More and more we’re seeing developers jump ship before the spectre of Steve Jobs crushes Flash for good. Personally I feel the jump to another platform is premature – especially HTML5 – but it seems to be raising awareness of another not-so-new contender in the web games arena, Unity.

Unity 3D - Powerful, Easy, Awesome.

Briefly stated Unity has some advantages over WebGL for game development that may allow it to really shine right now. For one, it performs consistently and quickly across all platforms. You’re not restricted to the browser – you can publish native apps for just about any platform, including all the popular consoles. It is a game engine and editor first – not simply a graphics library – so it can really help companies and developers play with ideas and publish something quickly. It does 2D handily as well as 3D, so it’s worth anyone’s time really.

There’s a couple caveats to this post I’ve written. Probably the biggest one is that yes, HTML5 really is the future. For web browsing. That’s important – just as important as it was to move on from frame-based websites and table layouts to HTML4. It’s a good thing we’re moving on. It really is. There are also tools emerging which will make game creation for HTML5 less painful – Stencyl (not yet but soon,) Construct, GameSalad and others are all great programs to keep your eye on if you’re someone curious about game development and the fantastic new world of compliant browsers. Flash is also really good if you’re exporting native apps – nobody has to know that you bundled AIR in there and you can certainly make excellent experiences with it. Plus Flash already has some support for HTML5 and you can expect them to build upon that in the future. The bottom line is that Flash has a great pipeline for animation into code and you can still make incredible experiences with it. If you’re concerned about what is industry sexy though, it may pay to learn a new trick or two!

Posted in Industry News, Technical | Tagged , , , , , | Comments Off

Separating Axis Theorem

The Separating Axis Theorem (SAT) is a staple of pretty much any physics engine in video games these days. Unfortunately so many sites breeze over it with a poor explanation and bunch of ambiguous code.

This morning I set out to write up my own collision detection for convex polygons rather than relying on others’ premade packages. I think everyone has read the amazing metanet tutorial on collision detection, but if you’re looking for something a little clearer or just written in a different style this blog might help you out. Anyway, mission accomplished – I have a perfectly functioning OBB collision detector set up now for use in Eternity.

Posted in Technical | Tagged , , , | Comments Off

Sprite Sheets in Cocos2D

This morning, I decided to learn how to animate sprites using sprite sheets in Cocos2D. I did a quick google search and discovered this excellent tutorial:

How To Use Animations and Sprite Sheets in Cocos2D | Ray Wenderlich.

Before you too attempt to tackle this tutorial, I’ll provide a couple gotchas that got me and you can avoid:

1. This entry helped illustrate Ray’s post.
cocos2d wiki entry for animation

2. I had to patch Cocos2d’s class: CCSpriteFrameCache as described in this article as I was getting a format compile error: ‘cocos2d: WARNING: format is not supported for CCSpriteFrameCache addSpriteFramesWithDictionary:texture:’ and this article points how to add the additional format 2 setting:
zwopple integration patch for cocos2d

Other than that, it was a straightforward process and it took me about 3 hours to finally see my animated sprite but that was mainly do to research time. In the future, it should take me about 5 minutes to setup a sprite sheet and introduce it to my project.

Zwoptex: After reading Ray’s recommendation, I purchased this software for $24. My current plan is to use Flash to draw and animate the assets, texture them in Photoshop (just to change up the art style so they don’t look all pure vector), and then finally bring them into Zwoptex to create the necessary png sprite sheet and plist files.

Posted in Technical | Comments Off

Monocle Studios Tutorials – iPhone Development with cocos2d-iphone

Monocle Studios Tutorials – iPhone Development with cocos2d-iphone.

This is an excellent tutorial. I was able to take it and quickly modify it to add menu items and create new scenes.

Posted in Technical | Comments Off

Cocos2D Box2D iphone dev dump

cocos2D IPHONE for iPhone SDK 4.0

After spending a couple mornings messing around iPhone 3.0 sdk and various incompatible libraries, I’ll like to dump some points around getting up and running with Cocos2D for iPhone.

Right now, I’m developing on iPhone 3G, and the following are very loose steps about how I got the latest version 0.9.44 of Cocos2D to compile.

1. I decided to install iPhone SDK 4.0 and XCODE 3.2.3 from the apple developer site.

2. If you recently upgraded your iPhone OS 4.0, you may need to get another provisioning profile.

After I upgraded my OS to 4.0, I got a “No Provisioned Iphone OS connected error” and here is a tech note about that issue.

3. Once I upgraded my OS and downloaded the latest version of Cocos2D, I wanted to setup XCode with Cocos2D templates.

If these templates fail to install, you may need to follow the instructions in the terminal after the error message. It failed for me and followed the advice to:

./install-templates.sh -u

BUILD
setting:
If you using an older iPhone 3G, you may need to change your Build Architecture from arm7 to arm6

http://www.cocos2d-iphone.org/forum/topic/7320

Also check the drop down Device – 4.O |Debug and make sure arm6 is checked!

You may notice that when you create a app via the template, you will encounter classes with a “.mm” file extension.

.m vs .mm

The light straight from the Objective C Primer

.m

This is the typical extension used for source files and can contain both Objective-C and C code.

.mm

A source file with this extension can contain C++ code in addition to Objective-C and C code. This extension should be used only if you actually refer to C++ classes or features from your Objective-C code.

You can mix objective-c and C++ classes although you should be careful doing so.

Posted in Technical | Comments Off