Due to the rapid pace of change some links or details may no longer be correct.

Published in Phaser World Issue 48 on 23rd September 2016 by Richard Davey   @photonstorm

Phaser 3 Beta, Compressed and Rotated Textures


Phaser 3 Beta 1 is now available for download

You can find it in the GitHub Dev Branch. There is a pre-built file in the build folder, or you can pull the whole source and build it yourself as needed.

If you take a quick look at the Change Log you'll see what's new, but it's pretty fundamental stuff.

The headliner has to be multi-texture batch support. We introduced this into an earlier beta of Phaser, where loads of you tested it and gave your feedback. This found some nice bugs, and helped us refine how it works, and Phaser 3 will be the first release with it fully enabled.

I've prepared a gist for you here, which shows how to use it. You'll see it's a 2 part set-up now. You can use the new Render Type 'Phaser.WEBGL_MULTI' in the constructor, or you can use the property 'multiTexture: true' in a Game Configuration Object. Doing either of these will swap out the old shaders for the new ones we wrote, allowing the 'setTexturePriority' call to work.

We also opened up the property 'BaseTexture.textureIndex', which allows you to have really fine-grained control over what is batched, and when.

Compressed Textures

In Phaser 3 you'll also find complete support for compressed texture formats. I discussed the benefits of these in Issue 41 of the newsletter, so please read that issue to refresh yourself.

Supported texture compression formats are: PVRTC, S3TC and ETC1.

Supported file formats are: PVR, DDS, KTX and PKM.

The formats that support all 3 compression algorithms are PVR and KTX.

PKM only supports ETC1, and DDS only supports S3TC.

Compressed textures are supported automatically by our updated WebGL renderer. All you have to do is tweak your preload code a bit. Here is a gist showing how to do it.

Rotated Atlas Frame Support

Also new in Phaser 3 is supported for rotated texture atlas frames. Atlas packers such as Texture Packer support the option to rotate the frames, to achieve better packing results. Phaser will now automatically parse this information when the atlas is loaded, and apply it during the rendering stages for both Canvas and WebGL. It's great to finally have this one in here :)

There will be an official release candidate of Phaser 3 early next week, and the final version by the end of September. Rather than go 'all out', we made the important changes that we needed to, and will build on those incrementally over the coming months.