something in the way

a tumblog about design + code
Dec 18

Pirates Love Daisies HTML5 Game Launches!

I’m extremely excited to announce the launch of one of our recent projects: Pirates Love Daisies!

Microsoft approached us a few months ago and asked to work with us to build a best of breed tower defense game in Javascript and HTML5. I was a bit hesitant at first – it’s been quite awhile since I worked with JS and HTML in any great depth, and most of my memories were of fighting browser incompatibilities and cursing the lack of decent developer tools. However, we did some quick code spikes to get a feel for what was possible and decided that this was a great opportunity to gain some applied experience with a new technology while working on a fun project.

Concept
We teamed up with local illustration group Pulp Studios and started brainstorming ideas for the theme of the game. Fairly early on we latched on to the idea of pirates (I mean really, who doesn’t like pirates!), but we needed something for them to defend. We considered going with the typical tower defense model, and simply have the user prevent creeps (enemies) from getting from point A to point B, but I’ve never liked that narrative. What exactly is at point B that’s so important?

We decided that the creeps were out to steal something valuable from the pirates, but we weren’t sure what that should be. Gold was an obvious choice, but it was boring, and it made more sense as the currency for purchasing units and upgrades. Then it hit us… Daisies!

Why daisies? Because Pirates Love Daisies, of course. The fact that daisies are visually iconic, seemed to be appropriately fun and quirky, and would work well aesthetically may have factored in as well.

With the illustrators working on sketches, we got down to writing code.

Coding
We started out by building core game logic, and a simple library to manage canvas state. We profiled performance, then revisited some of our initial ideas to work with the limitations we found.

Overall, we found working with JS to be a lot easier than we expected. Picking up the language was a breeze, and we were able to apply the processes and approaches we’ve developed from years of working on interactive content with Flash. For me, working with Javascript again actually had a certain pleasant nostalgia to it, as it recalled the days working with ActionScript 1. There is a certain amount of fun and freedom afforded by a dynamic scripting language, though the lack of strict typing, compiler time errors, and language-level support for inheritance (ie. no super keyword) were frustrating but manageable.

We also ran into some browser incompatibilities, though far fewer than we initially feared. The worst of them revolved around audio. It seems that every browser has its own set of irritating quirks related to dynamic audio that we had to stumble our way through. We wound up building an audio manager to resolve these issues that we may clean up and share in the future.

All round, things went fairly smoothly from a coding perspective. We ran into some challenges and had to make some compromises, but we surmounted all the major obstacles and learned a ton.

Performance
Overall, I was really impressed by the performance we were able to obtain. Code execution speeds are fairly similar to AS3 (which is impressive if you consider all the extra type data the AS3 JIT has to work with), and graphics performance is, for the most part, reasonable.

IE9 was the big stand out on graphics performance – its GPU-enabled engine is smoking fast, especially with large bitmaps. Interestingly, we found that iOS had terrible performance (when it worked at all) – something like 4-5x slower than Android on comparable hardware.

One other thing we found that’s worth noting is that drop shadows are ridiculously slow in canvas. A few small drop shadows rendered to canvas could drop our framerate in half.

HTML5 Features
HTML5 is actually a collection of standards at different levels of completion, so while it’s easy to refer to this as an HTML5 game, it really just leverages a few of the new features that are included under that umbrella.

Specifically, we used canvas for drawing the game board (terrain, units, creeps, effects, etc), local storage to save local scores, the audio element for all of the sound, and embedded fonts throughout.

Tools and Libraries
One of the challenges we encountered was the lack of good tools. For JS development, we tried a few different options but ultimately settled on Dreamweaver – it’s not a fantastic JS code editor, but it’s decent, cross-platform, and everyone in the office already had it.

The game art was created in Illustrator, then animated in Flash Pro. We built a custom AIR tool for exporting SWF animations to a sprite sheet (a grid of animation frames) which helped out tremendously. We also built a super simple AIR app that preps our JS files, runs level 1 of the google compiler on them, and then runs the result through the YUI compressor. We’re hoping to release both of these apps in the new year, once we have a chance to clean them up.

For testing and debugging, we used the debug tools in every major browser. Roughly half our developers were on Macs using Safari and Chrome, and the other half were using Windows with IE9 and Firefox. This let us spot cross browser issues early on. We also found different problems were more easily solved with different browser’s dev/debug tools.

In our code, we leveraged JQuery, JSON, and a new library we developed called Easel. The Easel library provides a hierarchical display list, similar to the one in AS3, that makes it much easier to work with the canvas element. We released the alpha version of Easel today at EaselJS.com under the MIT license. It should make it much easier for both Flash and JS developers to get started using canvas.

Gameplay
When building a game it’s essential that you don’t underestimate the huge amount of time required to balance gameplay. Our level designer built spreadsheets, graphs, and formula to help model the characteristics of the units, creeps, and maps, but it took hundreds of plays through the game (a sacrifice, to be sure) to get the balance right.

We tried hard to make the game very approachable, with a short tutorial, and easy start, but also layer lots of strategy into it for the more experienced gamer. Our scoring system involves lots of trade-offs. As an example, you get points for defeating creeps and ending waves faster, but you also get points each wave for hoarding gold. You have to decide how to balance these two opposed reward systems.

It was only when, having opened PLD to test some specific feature, I caught myself in my third game trying to beat another developer’s high score (and getting yelled at by my wonderfully patient wife) that I really started to feel like everything was coming together. If you can completely lose track of time while playing your own game, after being immersed in planning, designing, and coding it for a couple months, I think that’s probably a good sign… though it can have a negative impact on office productivity.

Overall
Microsoft was a fantastic client. After suggesting the tower defense genre, they trusted us with all the technical and creative details to make the project a success, while offering great feedback throughout. They put a lot of faith in a company that’s really not known for Javascript or game development, and I’d like to believe it was well placed.

I never thought I’d say this, but Internet Explorer 9 actually looks to be a great browser. It has impressive performance, and seems to be very standards compliant. I would definitely recommend checking it out, you might be surprised.

Everyone involved with the project had a huge amount of fun building it out. We had a great time brainstorming ideas, coming up with ways to tweak gameplay, and spending (way too much) time play testing. We’d love to hear what you think of the game in the comments below.

May 8

Google Chooses WebGL and Moves O3D to a WebGL Javascript Library

Media_httpi81photobuc_cfssc
Google has decided to put weight behind WebGL and stop actively developing O3D as a plugin, rather they will make O3D a Javascript library on top of WebGL. This will focus the 3D plugin development efforts from Google into just WebGL on top of the OpenGL ES 2 spec, which in turn runs in the html5 <canvas> tag.

WebGL is pretty exciting offering browser based OpenGL and hardware rendered graphics. When this becomes mainstream this will change up gaming and interactive on the web immensely. Unity 3D and Flash 3d engines add lots of immersive environments and WebGL will be just as exciting, if all browsers adopt it (canvas/webgl).

At Google, we’re deeply committed to implementing and advancing standards, so as of today, the O3D project is changing direction, evolving from its current plug-in implementation into a JavaScript library that runs on top of WebGL. Users and developers will still be able to download the O3D plug-in and source code for at least one year, but other than a maintenance release, we plan to stop developing O3D as a plug-in and focus on improving WebGL and O3D as a JavaScript library.

About WebGL

Media_httpi81photobuc_ygdec
WebGL is a cross-platform, royalty-free web standard for a low-level 3D graphics API based on OpenGL ES 2.0, exposed through the  Canvas element as  interfaces. Developers familiar with OpenGL ES 2.0 will recognize WebGL as a Shader-based API using GLSL, with constructs that are semantically similar to those of the underlying OpenGL ES 2.0 API. It stays very close to the OpenGL ES 2.0 specification, with some concessions made for what developers expect out of memory-managed languages such as JavaScript.

WebGL brings plugin-free 3D to the web, implemented right into the browser. Major browser vendors Apple (Safari), Google (Chrome), Mozilla (Firefox), and Opera (Opera) are members of the WebGL Working Group. “It feels like, someone’s missin-ing”

Media_httpfeedsfeedbu_kqdgw

Media_httpfeedadsgdou_stvzu

Media_httpfeedadsgdou_kjany

Media_httpfeedsfeedbu_kseif
Media_httpfeedsfeedbu_qxhid
Feb 9

EA faz campanha em código fonte

Media_httpwwwbrainsto_ocojg

Para o lançamento do jogo “Dante’s Inferno”, a Eletronic Arts fez uma campanha bastante original ao exibir seus anúncios no código fonte de sites como o Digg. As imagens são todas feitas em ASCII, exibem personagens do jogo além de uma URL e um código. Os usuários que conseguissem os seis códigos, teriam acesso a wallpapers, posters, concept-art do jogo e músicas relacionadas ao jogo.

Media_httpwwwbrainsto_idgxr

Se essa ação é efetiva? Sozinha, provavelmente não mas, se somada a banners ou posts perguntando se “você já viu o código fonte do Kotaku hoje?” até que chama a atenção e gera um boca a boca no nicho interessado em games e no mercado publicitário.

Aparentemente, o time editorial do Kotaku não sabia da ação e também se surpreendeu com ela. Seria mais um bla-bla-bla para aumentar o buzz ou a distância entre o time comercial e o editorial realmente aumentou depois desse projeto?

Media_httpwwwbrainsto_eilnn

Sep 15

First sign of WebGL lands in WebKit

Jeffrey Rosen has taken a look at a preview of WebGL landing in the WebKit project. The demo above is an example of this work (here in HD):

WebGL is basically an initiative to bring 3D graphics into web browsers natively, without having to download any plugins. This is achieved by adding a few things to HTML5, namely, defining a JavaScript binding to OpenGL ES 2.0 and letting you draw things into a 3D context of the canvas element.

It is interesting to compare this low level API to O3D which is a scene graph API from Google (Google also supports WebGL, via the O3D team also, and sees the APIs as complimentary). They are very different APIs taking drastically different approaches. One gives you a new API but a higher level one that may appeal to JS developers more, whilst the other is very familiar to a certain set of developers and would be easier to port work. Ideally, someone will Processing/jQuery-inize WebGL to give it some nice high level love too.

Fun times with 3D and the Web! Great to see WebKit and Gecko doing great things with WebGL already.

Media_httpfeedsfeedbu_ulfpc
Media_httpfeedsfeedbu_lbomf
Media_httpfeedsfeedbu_yrbba
Jul 1

Flash Augmented Reality, Made Easier: Open Source FLARManager

You’ve seen the demos. You like the idea of tracking tags in the real world to create visuals. And now you want to try augmented reality for yourself - and, incidentally, you’re a Flash developer.

Reader Eric Socolofsky writes to share a framework he’s created that makes it much easier to work with the Flash-based, open source FLARToolkit, called FLARManager. Version 0.4 is just released:

http://words.transmote.com/wp/20090618/flarmanager-v04/

FLARManager has a number of features that improve upon the existing work done by FLARToolkit:

  • Building the apps themselves is easier. Fire up the framework with Flex Builder (or Flash, or Eclipse, or FlashDevelop), and you have access to all the libraries you need, so you can start playing more or less out of the box. Hello, world, indeed.
  • You don’t have to rely on Papervision if you don’t want to. Papervision, the faux-3D library for Flash, is included with the distribution. But marker tracking is decoupled from Papervision, so you don’t have to use it if you don’t need it.
  • Better event management. Marker adding, updating, and removal, multiple pattern detection and management, and the like are all extended in FLARManager.
  • Great documentation. Eric has taken the time to read some fantastic getting started tutorials, all accessible from the site above so you can go play.

Now, you wouldn’t pick Flash for speed - that’s not the idea.

This is about the slowest implementation of ARToolkit you’ll find. But you’d use it for compatibility, because of easy deployment to the browser. Speaking of speed, the NyARToolkit Java implementation actually outperforms the original C version. I’m the last person you should talk to about writing efficient, optimized code, but I can tell you that the notion that Java is “slower” than C is simply wrong. There are a great many other, more important variables, and in some cases Java can in fact outperform C. That doesn’t mean that Java is always the right tool for the job any more than C is, though, and in fact because Java’s Garbage Collector and event scheduling aren’t really built for real-time performance, and because “native” code is suited to certain situations, there are in fact times when you wouldn’t want to use Java. Understanding the application is what really matters - and that’s why it’s nice that NyARToolkit and siblings are available for AS3, C#, the mobile Android platform, iPhone, and others.

Eric doesn’t just do this to fool around, either; he works in interactive design for museums, and has what has to be one of the world’s sweetest “day jobs” - working for the legendary Exploratorium. He’s also working with Processing and the wonderful reacTIVision library on a separate project that’s working with tangible table-based interfaces; more on that separately. Thanks, Eric!

If you get interesting work in augmented reality going, let us know. And if you need some inspiration, my current favorite is from our friend Marco Tempest, working with Zach Lieberman in OpenFrameworks on augmented magic.

Media_httpfeedsfeedbu_ddhss
Media_httpfeedsfeedbu_hdlfc
Feb 28

ODE (Open Dynamics Engine) 3D Physics Engine Running on Flash Player Using Alchemy

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.

Media_httpi81photobuc_vvogy

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.

Dec 24

Unity3D \m/’s - Adobe should buy them.

Media_httpunity3dcomu_nidgi

I know it’s been a while since I last posted, and I have a REALLY good reason for it

Media_httpswordpressc_mtydf
  You see, Andy Zupko had been dropping comments here and there about how he’d wanted to do Unity3D work.  First couple of times I heard him say it, I was thinking “yeah yeah flash master Andy, what’s this unity thing anyway?”

Well, I finally asked him what Unity3D was and he pointed me over to www.unity3d.com and then showed me their Tropical Paradise demo and my jaw began to hit the floor.  This was a web plugin?  holy polygons/lighting/shaders batman!

Media_httpcontentscre_cgjvh

Tropical Paradise - Terrains, streamed terrainse

With OpenGL and DirectX support, this little web plugin ROCKS.  It’s a complete game development tool that allows you to code in JavaScript, C# and a dialect of Python called Boo.  The JavaScript is strictly typed and compiles to native machine code - it’s just as fast as C# or Boo.  Not to mention 20x’s faster than Flash’s ActionScript.  And for me, getting into Unity took practically ZERO time.  I was up and importing FBX (you can export as FBX from 3D Studio Max) models and practically doing what I do in Papervision3D with very little effort!  In fact, moving some of my classes over to Unity for this game that Andy and I are working was a matter or some simple refactoring to accommodate Unity’s api.

Now, before we start getting totally OHH and AHH over this, let’s take a look at the discussion that’s already on your mind probably at this point in the post:  Why can’t FLASH/ADOBE have this?!?  I know, cause I was thinking the same thing

Media_httpswordpressc_mtydf
  The answer might be something like “I don’t think there’s a good reason anymore”.  It USED to be a really big discussion about player size.  I remember back on Flash6 beta, I was begging for w3d support since you could use those files in Director at that time, and they were fairly lightweight.  But the argument was around hardware support and player download size.

But check this out:

Flash player download = 5.5mb
Unity3D web player download = 4.5mb

Ding.  Round one over.  The winner?  Unity3D.

Ok, so is that a fair comparison?  No, not really, but in the argument about the player growing in size seems to be greatly reduced from the days of a 700k Flash player plugin download.  I realize that 5.5mb + 4.5mb = a bit more of a struggle to convince people to download, BUT, I’m SURE there’s a conversation that could be had about loading and running SWF’s into Unity3D like Director does.  Yes?  Did I mention Unity3D is cross-platform compatible?  Publish standalone builds for Mac OS X (Universal Binary, or specific, smaller Intel/PPC-only builds) and Windows 2000/XP/Vista - OH and then put it on the web…cause you can.

If that wasn’t enough to sweeten the pot on Adobe buying out Unity3D - Unity3D does iPhone apps with a single click ( watch the Demo Movie of the iPhone development setup - that’ll sell you right there ).  Hmmm I love me some iPhone

Media_httpswordpressc_bjgje
  Not enought??  How about Wii Development?!  BAM!  NOW WHAT?

Terrain, Shaders, Physics, Lighting, Cross-Platform, multi-depolyment option, multi-lingual, Game churning tool!

Have you ever found yourself saying: ” I wish Director used Actionscript - if it did, I’d move right on over to it and develop there!” Well, ok, maybe that’s too drastic and silly, but Unity3D gave me more power than Director and it was extremely easy to get into - the “power” here is that it is realized and made available to *me*.  I’ve had access to Director for nearly 10yrs now, and not once did feel like I could get into it easily.  I realize you can do Javascript now (Lingo was an abomination), but after my bad experiences in the past, I wasn’t willing to get into the the Director mess again.  I saw Unity for 5 minutes and downloaded it instantly. Unity’s IDE rocks - flat out.  It’s fairly easy to understand, and debugging 3D scenes at runtime is awesome.  You can have the scene up top with the game running below and you have access at runtime to really dig through and manipulate all objects and properties at runtime (hmmm… where have I heard that before…XRAY

Media_httpswordpressc_mtydf

Media_httpcontentscre_fgqnf

Unity3D IDE

One of the other nice things is that you can configure TextMate with a Unity3D bundle for editing.

I think I’m a fairly good indication of what *could* happen when other Flashers like me get a hold of Unity3D.  I hope Adobe’s listening

Media_httpswordpressc_mtydf

With all of that, combine the fact that SilverLight is working hard to compete with Flash and they have access to DirectX - it won’t be long until Adobe see’s they need a kick-ass solution.  THIS one actually works cross-platform with a ton of speed, easy adoption rate by the development community and a smaller player download size than Flash.  Either they’re already looking at Unity3D as I type this post or they soon will be.

One other thought I had is that, I’m not sure the Flash player is going to keep up or IS keeping up with the abilities of hardware that have been out for a while now.  I can see where they’re going with Pixel Bender etc, but I know I wasn’t the only one disappointed with what came out in FP10 in terms of hardware acceleration etc and so on ( I don’t need to restate what others have already said ).  I think that’s exactly what draws me to Unity3D - total frustration over speed/performance.  With Unity, it was like a massive breath of life for me in terms of developing games and playing in my own time.

Media_httpunity3dcomg_ihyci

Avert Fate - Particles, physics, ragdolls, image effects and custom shaders

So, let’s put our money where our mouth is, shall we?

By now, you know I work for Infrared5 with a ton of great developers.  If you want Flash / Flex / Red5 work done, we can do it. Duh.  But what about iPhone development?  what about serious game development?  What about product/marketing efforts that need more than what the Flash Player can give us in terms of power?  Where would we turn?  Well, we’ve officially added Unity3D and iPhone game developement to the list of services BECAUSE of Unity3D.  Considering that any one of our developers can get up to speed in a matter of an hour or less, it’s a no brainer to expand our service base.  SO, if you’re in the market for iPhone game development or app development, let me know, and I’ll get you in touch with the right people

Media_httpswordpressc_mtydf

Given how well many iPhone / iTouch apps are doing in the app store with Apple, I think there’s a bonanza of opportunity there - HUGE.

Ok, so the payoff for even posting this…post, is that I wanted to FINALLY show a few screen shots of a game I’d story boarded 4yrs ago and promised I would produce wayyyyyy back in 2002 (8/16/2002 to be exact) when I released my first Star Wars game - Escape of the Falcon.  I’m not going to show too much, but you guys and gals need to see I’m serious about what I just typed above.

Media_httpcontentscre_pygko

Original Star Wars game: Escape of the Falcon

Media_httpcontentscre_bkfzx

Web Version of the Trench Run

Media_httpcontentscre_jxhlg

Web Version of the Trench Run

Media_httpimgyoutubec_ocvwd

And Since Keith was showing off his iPhone Gravity fun, I wouldn’t feel right not sharing since he mentioned a Star Wars game

Media_httpswordpressc_mtydf

Media_httpcontentscre_cjnmw

iPhone Trench Run - low poly trench model

Media_httpimgyoutubec_gemkp

I have to thank Andy for getting into Unity though! I don’t know that I would have heard of it or gotten into it if he hadn’t pointed out the obvious to me

Media_httpswordpressc_mtydf
  To say the least, he’s in hog heaven with real physics, custom shaders and streamed terrains!

I seriously suggest that if you’re into 3D, Gaming and Flash right now, you should try Unity3D.  And yes, I fully expect that I’ll drive SO much traffic their way that they’ll give me a license

Media_httpswordpressc_mtydf
  Thankfully, IR5 got me one !  LOVE YOU CHRIS/REB/DOMINICK!  LOVE you.  Man love.

And Finally:  Adobe - if you’re reading this, you guys should seriously consider buying out Unity3D.  I can’t say it any more plain than that.  If you don’t, I don’t know how you’ll COMPETE with them.  As soon as they’re able to support running SWF’s in Unity, i’m going to be doing alot more work over there

Media_httpswordpressc_mtydf

      

Get Updates

Tags

Archive

2012 (6)
2011 (11)