What Are HTML5 Games? | The Motion Monkey
Mục lục bài viết
What Are HTML5 Games?
HTML5 Game Definition
HTML5 games are predominantly played on the internet and are compatible with a wide range of devices, from desktop computers to smartphones and tablets.
HTML5 (as the term is most commonly used) encompases modern web technologies (HTML 5 markup, CSS 3 and Javascript) to create complex multimedia applications. An HTML5 game allows play directly in modern web browsers without the need for third party plugins. So it has now replaced the discontinued Flash and Unity web players, as the preferred technology used to make web browser games.
Downsides of HTML5 Games
Although they have the advantage of providing the ability to play on mobile devices via the web, HTML5 games have some significant downsides when compared to web browser games created with older plugin based technologies, such as Flash.
Most of these issues arise from the fragmented nature of the various web browsers used to play. Many of these issues can now be overcome by using tried, tested and actively maintained libraries and engines to make HTML5 games.
Some of the main issues with HTML5 games are:
Outdated Browsers
Computers with an outdated browser installed may not be able to play HTML5 games. A modern compatible browser that supports all the features the game needs has to be installed in order to play.
This can prove especially problematic in situations such as where older PCs are used to play HTML5 games, e.g. in corporate environments where they have outdate operating systems and browser software installed with no way to upgrade.
Browser Updates Can Break HTML5 Games
Browser vendors are essentially left to their own devices when choosing how to interpret and implement the ever changing standards. This means updates to browser software can have adverse effects on HTML5 games when playing in that particular browser.
This can in some instances mean updates to HTML5 games are required down the line to fix these issues if/when they arise.
All Assets & Code Are Loose Files
HTML5 games have to load individual assets, much the same as a standard website page would. They are not packaged in a single file. This makes it easy to download loose asset and code files in an easily readable and usable format.
Audio, video and code assets could be stolen and reused without permission. This can be particularly problematic if a HTML5 games use licensed assets created by a third party.
There are some ways to minify and obfuscate (to a limited degree) Javascript code (such as Google Closure Compiler, UglifyJS and YUI Compressor). This only provides limited protection for game code only though.
HTML5 Game Development
Although it’s possible for HTML5 game developers to write all Javascript code from scratch, existing libraries/engines not only help speed up the development process, but handle cross-browser compatibility for you. This can be done via a collection of individual code libraries to handle individual task, or an all-in-one, game specific engine.
HTML5 Game Engines, Frameworks & Tools
A plethora of code libraries and game specific frameworks & engines are now available for HTML5 game development. Even commercial 3D game engines, such as Unity and Unreal can now be used to make HTML5 games for use online (although still fairly experimental in most cases, for 3D games and needing a hefty machine to run graphics heavy content).
Some of the currently available options for making HTML5 games are:
Graphics Libraries
- PixiJS – Fast, fully featured, WebGL accelerated 2D canvas graphics library.
- Three.js – One of the few 3D graphics libraries.
- EaselJS – A graphics library based around the Adobe Flash animation timeline.
Sound Libraries
- Howler.js – Fully featured Web Audio sound player library, with HTML 5 Audio fallback.
Complete Game Engines & Frameworks
- Constuct 2 – Self contained game creator software that builds games as HTML5
- Euge.js – Easy to use and powerful 2D HTML5 game engine. Includes lots of high level game specific features.
- Phaser – Popular 2D HTML5 game framework.
- ImpactJS – One of the very first 2D HTML5 game engines.
Building HTML5 Games As Software Applications
Third party tools have enabled HTML5 games to be built as stand-alone offline software applications. This means HTML5 games can now be built as Windows PC executables and mobile apps for offline play.
In fact some commercially released computer games have already been developed this way.
Using this method does have the downside of game performance not being up to par, when compared with games applications created using other technologies.
Some of the tools that can be used to build HTML5 games as software applications are:
- NW.js (formerly Node Webkit) – Can target Windows, Mac OSX and Linux.
- Electron – Another way of building Windows, Mac OSX or Linux applications.
- Apache Cordova – Build HTML5 games as mobile apps for iOS and Android.