Phaser/phaser: Release v3.60.0-beta.3
Name: phaser
Owner: Phaser
Release: Phaser v3.60.0 Beta 3
Released: 2021-10-27
License: MIT
Release Assets:
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the 
renderTargetsin a WebGL Pipeline config, you can now set optionalwidthandheightproperties, which will create a Render Target of that exact size, ignoring thescalevalue (if also given). WebGLPipeline.isSpriteFXis a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse.GameObjects.Components.FXis a new component that provides access to FX specific propertis and methods. The Image and Sprite Game Objects have this component by default.fxPaddingand its related methodsetFXPaddingallow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The 
WebGLPipeline.setShadermethod has a new optional parameterbufferthat allows you to set the vertex buffer to be bound before the shader is activated. - The 
WebGLPipeline.setVertexBuffermethod has a new optional parameterbufferthat allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The 
WebGLRenderer.createTextureFromSourcemethod has a new optional boolean parameterforceClampthat will for the clamp wrapping mode even if the texture is a power-of-two. RenderTargetwill now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrixis a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargetsis a new property that holds an array ofRenderTargetobjects that allSpriteFXpipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimensionis a new property that holds the largest possible target dimension.PipelineManager.frameIncis a new property that holds the amount theRenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndexis a new property that holds the internal target array offset index. Treat it as read-only.- The Pipeline Manager will now create a bunch of 
RenderTargetobjects during itsbootmethod. These are sized incrementally from 32px and up (use theframeIncvalue to alter this). These targets are shared by all Sprite FX Pipelines. PipelineManager.getRenderTargetis a new method that will return the aRenderTargetthat best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTargetis a new method that will return a 'swap'RenderTargetthat matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTargetis a new method that will return a 'alternative swap'RenderTargetthat matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithmis now populated with the compression format used by the texture.Types.Textures.CompressedTextureDatais the new compressed texture configuration object type.TextureManager.addCompressedTextureis a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTextureobject than any Sprite can use.Textures.Parsers.KTXParseris a new parser for the KTX compression container format.Textures.Parsers.PVRParseris a new parser for the PVR compression container format.- The 
WebGLRenderer.compressionproperty now holds a more in-depth object containing supported compression formats. - The 
WebGLRenderer.createTextureFromSourcemethod now accepts theCompressedTextureDatadata objects and creates WebGL textures from them. WebGLRenderer.getCompressedTexturesis a new method that will populate theWebGLRenderer.compressionobject and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureNameis a new method that will return a compressed texture format GLenum based on the given format.
New Features - Multi Tint Pipeline
- If you have a customised Multi Tint Pipeline fragment shader that uses the 
%forloop%declaration, you should update it to follow the new format defined inMulti.frag. This new shader uses a function calledgetSamplerinstead of the often massive if/else glsl blocks from before. Please see the shader code and update your own shaders accordingly. - The 
Multi.fragshader now uses ahighpprecision instead ofmediump. - The 
WebGL.Utils.checkShaderMaxfunction will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS). - The 
WebGL.Utils.parseFragmentShaderMaxTexturesfunction no longer supports the%forloop%declaration. - The internal WebGL Utils function 
GenerateSrchas been removed as it's no longer required internally. 
New Features
ScaleManager.getViewPortis a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
 GameObjects.Layer.addToDisplayListandremoveFromDisplayListare new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURLhas a new optional 4th parametercrossOrigin. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set 
loader.imageLoadType: "HTMLImageElement"in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property 
Tileset.tileOffset(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
 - The 
Tilemap.createFromObjectsmethod has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand) 
Updates
- When you try to use a frame that is missing on the Texture, it will now give the key of the Texture in the console warning (thanks @samme)
 - The 
Display.Masks.BitmapMaskdestroymethod will now remove the context-lost event handler. - The 
hitAreaparameter of theGameObjects.Zone.setDropZonemethod is now optional and if not given it will try to create a hit area based on the size of the Zone Game Object (thanks @rexrainbow) BitmapMask.sceneis a new property that allows the Bitmap Mask to reference the Scene it was created in.- The 
DOMElement.preUpdatemethod has been removed. If you overrode this method, please now seepreRenderinstead. DOMElement.preRenderis a new method that will check parent visibility and improve its behavior, responding to the parent even if the Scene is paused or the element is inactive. Dom Elements are also no longer added to the Scene Update List. Fix #5816 (thanks @prakol16 @samme)- Phaser 3 is now built with webpack 5 and all related packages have been updated.
 - Previously, an Array Matrix would enforce it had more than 2 rows. This restriction has been removed, allowing you to define and rotate single-row array matrices (thanks @andriibarvynko)
 - The Gamepad objects now have full TypeScript definitions thanks to @sylvainpolletvillard
 - Lots of configuration objects now have full TypeScript definitions thanks to @16patsle
 Particle.firewill now throw an error if the particle has no texture frame. This prevents an uncaught error later when the particle fails to render. Fix #5838 (thanks @samme @monteiz)ParticleEmitterManager.setEmitterFrameswill now print out console warnings if an invalid texture frame is given, or if no texture frames were set. Fix #5838 (thanks @samme @monteiz)SceneManager.stopwill now ignore the call if the Scene has already been shut down, avoiding potential problems with duplicate event handles. Fix #5826 (thanks @samme)- Removed the 
TintandFlipcomponents from theCameraclass. Neither were ever used internally, or during rendering, so it was just confusing having them in the API. - A new 
console.errorwill be printed if theFile,MultiFile,JSONFileorXMLFilefail to process or parse correctly, even if they manage to load. Fix #5862 #5851 (thanks @samme @ubershmekel) 
Bug Fixes
Animation.createFromAsepritewould calculate an incorrect frame duration if the frames didn't all have the same speed.- The URL scheme 
capacitor://has been added to the protocol check to prevent malformed double-urls in some environments (thanks @consolenaut) - Removed 
Config.domBehindCanvasproperty as it's never used internally. Fix #5749 (thanks @iamallenchang) dispatchTweenEventwould overwrite one of the callback's parameters. This fix ensures thatTween.setCallbacknow works consistently. Fix #5753 (thanks @andrei-pmbcn @samme)- The context restore event handler is now turned off when a Game Object is destroyed. This helps avoid memory leakage from Text and TileSprite Game Objects, especially if you consistently destroy and recreate your Game instance in a single-page app (thanks @rollinsafary-inomma @rexrainbow @samme)
 - When the device does not support WebGL, creating a game with the renderer type set to 
Phaser.WEBGLwill now fail with an error. Previously, it would fall back to Canvas. Now it will not fall back to Canvas. If you require that feature, use the AUTO render type. Fix #5583 (thanks @samme) - The 
Tilemap.createFromObjectsmethod will now correctly place both tiles and other objects. Previously, it made the assumption that the origin was 0x1 for all objects, but Tiled only uses this for tiles and uses 0x0 for its other objects. It now handles both. Fix #5789 (thanks @samme) - The 
CanvasRenderer.snapshotCanvasmethod used an incorrect reference to the canvas, causing the operation to fail. It will now snapshot a canvas correctly. Fix #5792 #5448 (thanks @rollinsafary-inomma @samme @akeboshi1) - The 
Tilemap.tileToWorldYmethod incorrectly had the parametertileX. It will worked, but didn't make sense. It is nowtileY(thanks @mayacoda) - The 
Tilemap.convertTilemapLayermethod would fail for isometric tilemaps by not setting the physic body alignment properly. It will now callgetBoundscorrectly, allowing for use on non-orthagonal maps. Fix #5764 (thanks @mayacoda) - The 
PluginManager.installScenePluginmethod will now check if the plugin is missing from the local keys array and add it back in, if it is (thanks @xiamidaxia) - The Spine Plugin would not work with multiple instances of the same game on a single page. It now stores its renderer reference outside of the plugin, enabling this. Fix #5765 (thanks @xiamidaxia)
 - In Arcade Physics, Group vs. self collisions would cause double collision callbacks due to the use of the quad tree. For this specific conditions, the quad tree is now skipped. Fix #5758 (thanks @samme)
 - During a call to 
GameObject.Shapes.Rectangle.setSizeit will now correctly update the Rectangle object's display origin and default hitArea (thanks @rexrainbow) - The Arcade Physics Body will now recalculate its center after separation with a Tile in time for the values to be correct in the collision callbacks (thanks @samme)
 - The 
ParseTileLayersfunction has been updated so that it no longer breaks when using a Tiled infinite map with empty chunks (thanks @jonnytest1) - The 
PutTileAtfunction will now set the Tile dimensions from the source Tileset, fixing size related issues when placing tiles manually. Fix #5644 (thanks @moJiXiang @stuffisthings) - The new 
Tileset.tileOffsetproperty fixes an issue with drawing isometric tiles when an offset had been defined in the map data (thanks @moJiXiang) - Fixed issue in 
Geom.Intersects.GetLineToLinefunction that would fail with colinear lines (thanks @Skel0t) - The 
CameraManager.destroyfunction will now remove the Scale ManagerRESIZEevent listener created as part ofboot, where-as before it didn't clean it up, leading to gc issues. Fix #5791 (thanks @liuhongxuan23) - With 
roundPixelsset to true in the game or camera config, Sprites will no longer render at sub-pixel positions under CANVAS. Fix #5774 (thanks @samme) - The Camera will now emit 
PRE_RENDERandPOST_RENDERevents under the Canvas Renderer. Fix #5729 (thanks @ddanushkin) - The Multi Pipeline now uses 
highp floatprecision by default, instead ofmediump. This fixes issues with strange blue 'spots' appearing under WebGL on some Android devices. Fix #5751 #5659 #5655 (thanks @actionmoon @DuncanPriebe @ddanushkin) - The 
Tilemaps.Tile.getBoundsmethod would take acameraparameter but then not pass it to the methods called internally, thus ignoring it. It now factors the camera into the returned Rectangle. Tilemap.createFromObjectshas had the rendering of Tiled object layers on isometric maps fixed. Objects contained in object layers generated by Tiled use orthogonal positioning even when the map is isometric and this update accounts for that (thanks @lfarroco)- Timers with very short delays (i.e. 1ms) would only run the callback at the speed of the frame update. It will now try and match the timer rate by iterating the calls per frame. Fix #5863 (thanks @rexrainbow)
 - The 
Text,TileSpriteandRenderTextureGame Objects would call the pre and post batch functions twice by mistake, potentially applying a post fx twice to them. ScaleManager.getParentBoundswill now also check to see if the canvas bounds have changed x or y position, and if so returntrue, causing the Scale Manager to refresh all of its internal cached values. This fixes an issue where the canvas may have changed position on the page, but not its width or height, so a refresh wasn't triggered. Fix #5884 (thanks @jameswilddev)- The 
SceneManager.bootScenemethod will now always callLoaderPlugin.start, even if there are no files in the queue. This means that the Loader will always dispatch itsSTARTandCOMPLETEevents, even if the queue is empty because the files are already cached. You can now rely on theSTARTandCOMPLETEevents to be fired, regardless, using them safely in your preload scene. Fix #5877 (thanks @sipals) - Calling 
TimerEvent.resetin the Timer callback would cause the timer to be added to the Clock's pending removal and insertion lists together, throwing an error. It will now not add to pending removal if the timer was reset. Fix #5887 (thanks @rexrainbow) 
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@necrokot Golen @Pythux @samme @danfoster @eltociear @sylvainpolletvillard @hanzooo @etherealmachine @DeweyHur @twoco @austinlyon @Arcanorum