Libraries and Modules
The HTML5 ecosystem is quickly reaching parity with Flash. However, there are still some limitations to be aware of before writing any code. Like vector art not being production ready and none of the popular engines supporting it just yet. So art assets can be tricky. Art can be made in multiple sizes. The closest size can then be used depending on the device. Another option is to create large images and down sample them. Otherwise, scaling could be disabled altogether if you really wanted to. Lastly and my favorite, you can try to stay within some middle ground to limit the blurry image problem of scaling images.
Another limitation is text. Of course HTML is the grandfather of text, inputs, and all the things that make the web. But for Canvas and WebGL elements, there are no native text inputs and engines often lack friendly ways to display complex text elements. It is possible to layer text over the Canvas or WebGL elements. However, keeping everything inside the drawn elements will make scaling easier. Flash solved this problem a long time ago and now JS game engines are reaching the point where the issue is being worked on.
The web and consequently devices that connect to it are dynamic. They come in all sizes from mobile, tablets, desktop, to televisions. Figuring out your plan of attack for scaling at the beginning will make your end product work much better. Like most things in JS there are many options to choose from. The easiest solution is full screen. It will ask the player for permission to take up their entire screen. In some cases this is desired and in others it can be annoying. Another option is to scale the game to the size of the parent element. The game will have an ideal size with the option to still fit within sites that want to display it smaller or expand it for something closer to a full screen experience.
Scaling leads to another important design topic, what is the ideal size for a game? If targeting the web, considering browser top bars and operating system task bars is critical. For our current audience, a game resolution around 900x600 works really well. Each platform will have its own considerations. It will be impossible to make a game that works on a smartwatch and a TV. So choose who you want to target and try to reach similar devices. A simple trick we found to reach desktops, tablets, and phones is to use landscape ratios and big buttons in the user interface. It’s possible to reach a massive audience with some creative game design.