Update 18:03 GMT: the original download did not start due to a digital signature error. We've updated the download with a fix so please download it again if you see an error. Sorry for the inconvenience!
New this build: basic WebGL 2 support, new triggers for offline events to replace the old AppCache-based ones, switched to standards-based Pointer Events where available, and several other changes and bug fixes.
The runtime now uses WebGL 2 if the browser supports it. This probably sounds bigger than it really is - for the most part it is still executing the same code it did before, but there are two changes in WebGL 2 mode:
- Non-power-of-two (NPOT) tiled backgrounds can now tile perfectly without internally stretching it to a power-of-two (POT) size first, which could in some cases degrade the quality
- Other NPOT images like sprites now have mipmaps created, which allows for better and more consistent downscaling quality regardless of the image size
That is the only benefit of WebGL 2 for now. WebGL 1 is of course still fully supported and it will revert to that if WebGL 2 is not available. In future we may be able to make use of more WebGL 2 features to help optimise or enhance the rendering engine, but for now we're just fixing the POT restrictions since WebGL 2 has better capabilities there and it's straightforward to do.
WebGL 2 is not currently available in any stable browser, but it was just enabled by default for Chrome 56. You can try it early with Chrome Canary, or by going to chrome://flags and enabling the WebGL 2 flag. Other browsers should be following soon (all vendors are actively working on WebGL 2). When WebGL 2 is in use, the runtime will log "Using WebGL 2 renderer: ..." in the browser console. You can also check if it's supported in Chrome by going to chrome://gpu and reviewing the status for WebGL 2.
Triggers for offline events
When we introduced the new Service Worker based offline support, we had to remove the old offline events ("Is downloading update" and "On update ready") since the new offline system worked differently and it was difficult to support them in the same way. We've now brought back three new triggers which work with Service Worker. These are:
- On offline ready: this is triggered on the first run when offline caching has finished, and the game can now work offline. (Previously there was no equivalent, this is new.)
- On update found: triggered when an update starts downloading in the background. (Note this is a trigger which fires once, as opposed to the old "Is downloading update" condition.)
- On update ready: triggered when an update has finished downloading in the background. Closing and reopening the browser tab will start using the update.
Note these triggers can occur before the game has started, in which case they are buffered, and will fire immediately after "On start of layout" on the first layout. This is to avoid the events going undetected if your game hasn't started yet.
For a long time there have been two APIs to detect touch input: Apple-style touch events (e.g. "touchstart", "touchend") and Microsoft-style pointer events (e.g. "pointerdown", "pointerup"). Pointer events have subsequently become the preferred standard and browsers are starting to move to the new API. C2 now uses standards-compliant detection of pointer events and (as before) will use pointer events instead of touch events if available. The reason this is being highlighted is because Chrome 55 will enable pointer events, which means C2 games will switch from touch events to pointer events from then on. Despite the fact we've long supported pointer events for IE and Edge, this could cause some bugs or incompatibilities if Chrome has any differences between the two APIs, so it's worth looking out for any issues around touch input in Chrome.
We'd love it if you could show your appreciation of it by retweeting and sharing it on Facebook and Twitter!