|
Will Eastcott is a video game technologist that has worked for EA, Sony, and Activision on triple-A titles and is co-founder of PlayCanvas, a technology company that provides a cloud-hosted development and publishing platform for HTML5 games. In this article, he shares his opinions on how the emerging technology will really affect game developers and makes a case for the language as a great next step in game development.
You have probably seen the headlines. "Consoles are dead!" "HTML5 is the future!"
The talk around HTML5 is often quite sensationalized and, dare I say, biased. Let's put all of that aside and introduce a little calm objectivity. Here is my measured proposition: HTML5 will fundamentally change the way we make video games. Before I explain why, let me summarize the state of play with HTML5 today.
Over the last 30 years, we have witnessed a general trend of increasingly powerful hardware platforms coupled with ever better strategies for exploiting that hardware through an evolving ecosystem of tools and languages. The drive towards hyperreal gaming environments has been relentless, with console manufacturers delivering ever more powerful technology into the hands of developers.
However, with the rise of mobile gaming, we have witnessed a new phenomenon. Gamers have responded exceptionally well to playing simpler games in any location, on any device, with any of their friends. These are the key demands of the user now. Technology is still important, and beautifully crafted pixels still matter, but what matters more is that a game is accessible and connected. What is more accessible and connected than a web browser?
So what are the options for building such a game? You could write it from scratch, but targeting more than one platform can be a tall order for a small dev team. There's Flash, although with every passing month Flash seems less appealing. A retreat from the mobile space and confusing messages about Stage3D licensing costs have generated considerable negative feeling amongst developers.
There are engines like Havok Vision Engine and Unity, for example. These engines generally target the desktop browser via proprietary plugins and mobile devices via a native build. And then there's HTML5. Before you finally plump for HTML5, it is vital to understand its strengths and know how to mitigate its weaknesses. Let's take a closer look.
An Evolving Standard
HTML5 is not done. It is still being developed by the standards groups W3C and WHATWG, so browser vendors are tracking a moving target. Therefore, the level of support for HTML5 is different across every browser. This is illustrated in painstaking detail by the site caniuse.com.
An oft-cited example of cross browser inconsistency is audio. There are currently three distinct APIs: Mozilla's Audio Data API, Google's Web Audio API, and the Audio element JavaScript API. In recent days, Mozilla has announced that it has deprecated its own API and will soon begin work on implementing Web Audio. So it is clear that browser vendors are working hard to simultaneously innovate and converge the HTML5 platform to make life easier for the developer.
There has been a concerted drive from browser vendors to deliver new HTML5 APIs specifically for game developers. The three main examples are the GamePad API (which can read input from all natively supported pad devices), the Pointer Lock API (which hides the mouse cursor and reads raw mouse movement), and the Fullscreen API (which can make any HTML element go fullscreen).
These APIs have all been specced and implemented into multiple browsers in a consistent fashion in a short space of time. With their arrival, games like first person shooters are suddenly far easier to implement in HTML5.
JavaScript
Coders harbor remarkably strong sentiments about programming languages. Those coming from a console background are likely to view JavaScript with suspicion. It is yet another new language to learn, JavaScript will be slower than the equivalent C++ code, and optimization strategies such as vectorization are not possible with JS. Plus there's the fact that a game's code is available for all to see in the browser's developer tools.
I think it is important to reference Douglas Crockford's assertion that JS is the "The World's Most Misunderstood Programming Language". For C++ programmers, JavaScript is actually a breeze to learn. It is syntactically closely related to C++, although concepts such as closures and the "this" keyword can take some getting used to.
For those of us who don't like the rigidity and verbosity of a language like C++, JavaScript is a fantastic, dynamic language. Powerful features like first-class functions will drastically reduce the amount of code you have to write and the time it takes to write it. It's likely that a lot of people who convert to JavaScript won't be going back.
Performance is better than you might think. Firstly, the Web Workers API enables multi-threaded programming in JavaScript. Secondly, and more importantly, JavaScript engines have come a long way in the last few years. To illustrate, there is already a JS port of the open source physics engine Bullet, and although performance is not stellar, it demonstrates you can run some very CPU intensive algorithms at acceptable speeds using JS.
Let's face it -- cloning exists on all platforms, but when it comes to HTML5 games, it is important to keep a couple of things in mind. Tools such as Google's Closure Compiler do an impressive job of optimizing the source, and poring over the obfuscated source code is not the same as access to the original code. As a codebase increases in size, the more impractical it becomes to attempt to reverse engineer it. Secondly, if a game is to have an online component, much of the code can be run on the server, and the client is really just a thin visualizer. Much of the "value" resides hidden on the server.
2D vs. 3D
One of the most fundamental choices when designing a game is whether the graphics are to be 2D or 3D. 2D HTML5 games generally use a 2D context queried from a canvas element on the page. Every major browser now has good support for the 2D canvas context, so if your game is sprite based, there are no worries.
Things are more involved if you are looking to develop a 3D game. The only way to get high quality, hardware accelerated 3D graphics in an HTML5 game is to use WebGL, a JavaScript interface almost identical to OpenGL ES 2.0. Support for WebGL on the desktop is strong in Chrome and Firefox, and only Internet Explorer is holding out. Fortunately, Google Chrome Frame provides an elegant mitigation for Microsoft's resistance to WebGL, and although Apple has yet to enable WebGL in Safari by default, it is available to developers now.
WebGL has come a long way since the 1.0 spec was announced in March 2011. With OpenGL ES 3.0 freshly unveiled at SIGGRAPH, you can bet it won't be long until the corresponding spec for WebGL 2.0 is released. Exciting times for 3D browser gaming, to be sure.
|
I understand that this article is about HTML5, but considering you mentioned biase and objectivity, it would have been more considerate if you did not insult our intelligence by just brush off Flash in such a simplistic -not to mention inaccurate- way. I was excited to read the feature, what a turn off.
It would also be remiss not to mention Haxe, which is seeing increasing uptake for a combination of language features(static types, macros, etc.) and its ability to hedge platform decisions.
I also agree with the cheap shot to Flash, and should've known there would be one in this article.
- Ziro out.
I wouldn't at all mind if HTML5 revolutionized how games are made, but I rather choose to only be cautiously optimistic about it. As a best case scenario, I suspect it might just revolutionize how promising designers get their first foothold in the industry.
Learning Javascript beyond the level of tinkering with web pages has been annoying to me as a C++ programmer and it's clear that the optimizations that I'm accustomed to with a compiled language just don't exist in the browser. It seems logical that an interpreted language won't have the same kind of optimizations as a compiled language without using a tool like Google's Closure Compiler...thanks for pointing me at that.
I think their a lot to be said for cross-platform support for content, logic, and framework and I'm personally very interested in browser driven games (for certain types of games). It's true that there are already systems that provide cross-platform support for content, logic, and framework, but in those cases, the tool vendor is responsible for maintaining support...with HTML5, it's the browser vendor that is responsible for the the support. Seems like a more realistic way to support 100s of platforms.
Plus I think if win8 catches on (it probably wont) MS will intentionally block out some things to try and force developers into their more closed and apple like app store. Personally I'll go all linux first.
He lost me here. Granted, "Gamers" is the easiest term for people who are playing games, but based on context, he's referring to people who play games as a primary activity, most of whom still greatly prefer their PCs, consoles, and things you see on Tabletop.
In other words, are there good numbers showing that gaming platforms have become a zero-sum system? Or has the increase in mobile gaming come mostly from expanding gaming into free time that was previously going untapped?
I can imagine some decline in console playing time related to the end-of-generation thing. But is there good evidence that PC gaming (in the era of increasing digital distribution) is being cannibalized by mobile?
Regarding the actual article, I'd have liked to know more about reasons why someone might not want to use HTML5. There's a 2D game trying to get out of me, and I'd really like to maximize platform accessibility with minimum rework, so HTML5 is attractive. But I'd be surprised if there weren't some biz/tech pitfalls waiting to ensnare the new HTML5 developer.
tml That article does go on to mention what's going on with console sales as well, but the evidence is less clear. I guess I'm also partially going on empirical evidence - my own experiences and those of people I know.
Mobile platforms are increasing in performance faster than console platforms. I would expect to see mobile platforms more aggressively challenge consoles in the next few years with high quality, AirPlay-style gaming on the TV. As for the PC, there has been a lot of talk recently about how PC sales are suffering at the hands of the tablet (e.g. check out Dell's share price for the last 6 months, although PC manufacturers are facing other problems too).
As for the reasons a developer might not want to use HTML5, I did try to be quite balanced on that. The fact is that you can make great cross-platform 2D games with Flash, HTML5, and the various commercial engines on offer. They all have their strengths and weaknesses. I wasn't really setting out to do a comparative analysis of the options. The overview of HTML5 was really a lead-in to the discussion on what HTML5 means for the future of development itself. But all I would say is that you need to do a bit of due diligence before you finally settle on a technology. Figure out what the technical requirements for your game are and check that the tech you want to use can reach the required platforms and give you the features and performance that you need. Figure out where/how you want to sell your game and ensure you can get there. I mentioned targeting apps stores with HTML5 in the article for example. I'll plug a company that is doing really fun stuff with 2D HTML5 games: Lost Decade Games. They're great at showing how to get products onto all sorts of platforms and blog relentlessly about their experiences. Check out their web site.
I've seen and benchmarked various 3D physics engines for JavaScript and personally I would not consider them viable at this point. For some simple scenarios you might get away with acceptable performance on a decent machine, but downgrade your test machine to a netbook or low end desktop and suddenly you have yourself a slide show. I would personally lean more towards 2D games and physics engines, such as Box2D. I think that is a much better combination for today's HTML gaming market. Think angry birds and you'll be flying to success.. or hurdling to your impending doom ;)
Don't get me wrong, i love C++, it's my background and it took me a long time to get where i am. However, at the same time, most people just don't need the power of C++ to make the games they want. Even for 3D, what do you expect to make? Even if the technology was capable of rendering AAA scenes you'd still not make them because you'd lose the instant experience. You may aswell ask somebody to download a binary and we know how bad that is, caching is there, but it's mostly about the first impression. HTML5 is powerful enough for most small teams and it's much easier to distribute, promote and connect with social media.
Also calling "casual" on HTML5 is silly. It's like calling "casual" on Objective C or Java because of the App Store and Google Play. There are plenty of hardcore 2D games around, they're just not implemented in HTML5. The technology is definetly capable of handling them.
Sorry, my post was dripping in sarcasm. I thought it would be more obvious than that.
If you make simplistic games you can use something like HTML 5, but will HTML 5 ever reach 2048 X 1680 rez 32 bit color FPS running at 60 frames per second? Not in the next 10 years (or longer).
This performance mark is easily reached by C++ engines.
Ricard Garriott once told me "You can never realase a game on a given platform, that doesnt look better and run better that the exsisting generation of games". Switch to a technology that lets you produce games that look like they where developed in 1992, doesnt work on PC's, it might work on a cell phone.
But I think Unity and Flash have that segment covered pretty well.
I guess it depends on the types of games you're building. Clearly, as of today, you can't write CoD in JS+WebGL and have it play/look/perform like the 360 version. I don't think HTML5 is necessarily about replacing that kind of content. As a sometime-indie developer, though, it's great that HTML5 enables me to use tools that are free, open, accessible from any device, with no install. It's also great that I can make games and immediately publish them out for people to enjoy by following a hyperlink. For me, that's really exciting.
As for an FPS running at 2048x1680 @ 60Hz, well, what's the HW spec? ;) Seriously, a small Mozilla team just released BananaBread (https://developer.mozilla.org/en-US/demos/detail/bananabread), a reasonably simple FPS demo that showcases various HTML5 features. If they can do that, you can bet others will come along and build something even better.
I am leery about publishing a work in progress of a new IP out to the world, unfinished on Github. There is a compelling reason to post your code to the public. But what makes sense to me, is how companies like Id do it. Post the source code only after you have exhausted it's commercial release business model. I also don't like the idea of posting my internal development communications to the twitterverse. Again some instances make sense, like crowdsourcing advice on using a certain design pattern or technique. But discussing features of the game on a public forum doesn't make sense to me.
Perhaps I am just old school in these matters. But I am interested in further debate about these new proposed collaboration methods and why their benefits outweigh the security concerns.
All these articles about HTML5 ignore one simple fact. There's no difference between coding a game in Flash with Stage 3D or HTML5 and WebGL besides penetration. 99% Flash penetration making it playabale across all devices (especially with the new AIR and 10.4 release) or HTML5, specifically WebGL in case of PlayCanvas, covering barely 40% of desktop PC. That's... Well... 20% of all devices out there as you can't publish it to mobile? Even Unity3D in this case is more preferable .
I do agree with you that HTML5 will not change much about how games are consumed. Other technologies have much higher penetration, and the average consumer doesn't care about the tech behind it, anyway.
But HTML5 brings something new to developers.
Suddenly, your code editor, testing environment, real-time collaborative tools, and even publishing platform, can all be in a single website. Without the need to download anything, update software, and just for the hell of it, all backed up on the cloud.
That is powerful stuff.
That said, I strongly agree HTML5 brings something new to *developers.*
Suddenly, your code editor, testing environment, real-time collaborative tools, and even publishing platform, can all be in a single website. Without the need to download anything, update software, and just for the hell of it, all backed up on the cloud.
That is powerful stuff.
WebGL is around since when? A year? and you're writing it off already! Are you serious. This is brand new technology and it's already catching up to Flash.
While I still think that the tech is early on in its life, I can see a lot more developer migrate over to it in the next few years. I think there's still a lot of potential using javscript and things like the canvas element which people just simply don't understand yet -- and while a little weird to get into, it really does open up a lot more possibilities compared to something heavy like Flash and action script.
What kind of possibilities are you thinking about?
I think from strictly a gamer's perspective, no, there won't be a change in what can be made, but how it's made? Much better.
Plus native mobile support is always nice too~
What you stated sounds great and here's hoping for an ideal outcome.
My gripes about HTML development have to do with the DOM and the current version of JavaScript; where it's slated with Harmony, will greatly help, but for now I prefer working in other languages, since by design they are much better at managing and working with complex code.
One last quick ramble, because this can be a book. I have 17 years under my belt on developing web content and much of what you said about the possibilities of HTML5, actually rings true for platforms like Flash -- it of course covers more than just web development, but there are so many crossovers.
FYI, Unity has a free version that cost nothing to target the web plug-in that I'm recalling -- I have it downloaded, I just have not used it much -- and FlashDevelop and Haxe are both open source.
Meanwhile, every major game company that has tried it (Wooga, Zynga, etc) has realized that the technology is broken and fragmented, and has abandoned it. Not to mention that Javascript is really the last language you want to build a 50,000 line project in. By the time HTML5 is "mature", Stage3D and Unity will have taken so much browser share that there'll basically no point anymore.