How Construct 2 helps make HTML5 work

Official Construct Post
Ashley's avatar
  • 22 Feb, 2012
  • 1,104 words
  • ~4-7 mins
  • 2,483 visits
  • 0 favourites

It's interesting to read the continuing debate around HTML5. Our forum users also like discussing articles they find on the subject, especially in comparison to other technologies like Flash or native apps. Often these articles are written from a programmer's point of view. As a result they highlight technical details and problems which HTML5 programmers must overcome, and this can make HTML5 compare unfavourably to other technologies. However, from a Construct 2 user's point of view, many of the arguments simply do not apply because we've already done the work in our HTML5 game engine. For example, having to deal with browser quirks is often cited as a significant disadvantage of HTML5. We've actually been very impressed with how standards-compliant modern browsers are, but there are indeed some quirks that need workarounds (such as the recent issue with laggy keyboard input in Chrome that was particularly gnarly). So for Construct 2 users, this is not an issue at all: by using our engine, you get all our browser-specific fixes included. I thought more on the subject, and I came up with a whole list of similar recently-cited shortcomings of HTML5 which Construct 2 fixes for you. Here it is:

"Javascript is ugly!"

Obviously you don't do any coding in Construct 2, so any perceived ugliness is our problem only! Even if you're a plugin developer using our Javascript SDK, you only need to come up with small snippets of Javascript to flesh out the SDK template, which is really no problem at all despite the quirks of the language.

"Javascript is slow!"

Writing high-performance Javascript is sometimes contrived, especially when trying to eliminate garbage-collection pauses. We've done all the necessary work in the engine to adapt it to what Javascript is fastest at, while making it have a minimal garbage overhead. On top of that, we also support WebGL for rendering which brings native-like rendering speeds on supported systems. As a result, we've seen Construct 2 easily beat other Flash-based tools in benchmarks. Mobile performance is an area we're still actively working to improve, but the desktop results prove that Javascript + WebGL have the capacity to be faster than Flash traditionally has been.

"You can't run HTML5 games from the desktop!"

Actually, you can do this with Google Chrome. Mozilla are working on similar features for Firefox, and don't forget Windows 8 integrates HTML5 right in to the desktop.

"There are no good IDEs for HTML5!"

Well, this is the exact problem we hope to be solving with Construct 2 :)

"It all has to be open source (there's no way to hide code)"

By default Construct 2 games are passed through Google Closure Compiler to minify and obfuscate the code, making it impossible to read and extremely difficult to reverse-engineer. We've specially written the runtime to pass through Closure Compiler's Advanced mode, providing the highest level of compression and obfuscation. Even "beautification" does not undo the name mangling that Closure Compiler does. This solves the "view source" problem.

"There's nowhere to publish the games!"

You can currently publish Construct 2 games to Facebook, Kongregate, the Chrome Web Store, as iOS web apps, on your own server, to our Arcade, on Dropbox for quick tests, and we're working on integrating PhoneGap and AppMobi's wrappers to publish your game as native iOS and Android apps. We expect many more traditionally Flash based publishers (especially arcades) to shift over to HTML5 over time, like Kongregate have started.

"Games cannot be securely hosted!"

Using an iframe to the game on a different domain, browser's cross-domain security restrictions kick in making the game secure even for untrusted content. This is how our own arcade works, and it prevents the game from accessing the parent page or site at all, ensuring user accounts and data are secure. This is the standard way to securely host a HTML5 game. HTML5 iframe sandboxing improves security even further.

"HTML5 won't be done until 2022!"

This is oft-repeated nonsense which ZDNet Asia call a myth. As the 2011 article states: "The truth is that 2022 is when Hickson expects the HTML5 spec to become a full W3C recommendation, which means that there are two 100 percent complete, verifiable implementations... consider that no other version of the HTML spec has ever achieved that status... the HTML5 specification is getting close to being solidified and unchanging, right now in 2011." The confusion comes from 2022 being the date Ian Hickson (the HTML5 spec editor) predicted for two separate browsers implementing the specification flawlessly, which can come a long time after the spec being "done" since bugs and tweaks are to be expected in software. That's very different to the HTML5 spec being ready, and much of it is implemented and usable in all modern browsers today. If you have any doubt if HTML5 is usable today, head over to our arcade and play some games!

"You can't do fullscreen games!"

I'm not sure where this misconception came from, because for years you've been able to hit F11 (or some other shortcut) and switch the browser in to fullscreen mode. In Construct 2 games, just make sure you're using one of the fullscreen-in-browser settings so the game fills up the whole window. Better yet, the Browser object also supports automatically entering fullscreen mode (use the 'Request fullscreen' action), which works in the latest Chrome and Firefox.

"HTML5 is a fad and it's not going anywhere!"

This is a fairly opinionated statement so it's hard to answer objectively. However, with Adobe switching focus to HTML5 tools, Microsoft integrating it in to Windows 8, Google working on a whole OS based on a browser, both Google and Mozilla working hard to make HTML5 apps just like native apps, and browsers increasingly going plugin-free (as with iPhones, iPads and Windows 8 tablets), I think it's difficult to argue that it's just a fad - I would say it's here to stay, and will be around for a long time to come as well.

It's always interesting to see carefully thought-out articles and opinions on the subject, and it's exciting to ride the wave of a new technology. So please do get involved! Just be aware of misinformation or out-of-date arguments (since HTML5 is fast advancing), or those arguing points which Construct 2 has already solved for you. They don't matter. I see many of the above points trotted out time and time again across the web, and they range from simply false to being something that Construct 2 solves for you. So as you're reading on the subject, remember: we're working hard to make it work for you!


Get emailed when there are new posts!