Phaser v3.90.0
GameObjects.Rectangle.setRounded
is a new method that will allow the Rectangle Shape Game Object to have rounded corners. Pass the radius to set for the corners, or pass a value of zero to disable rounded corners.GameObjects.Rectangle.isRounded
is a new read-only boolean that can be used to determine if the Rectangle Shape Game Object has rounded corners, or not.GameObjects.Rectangle.radius
is a new read-only number that is the size of the rounded corners. Do not set directly, instead use the methodsetRounded
.- Added
Phaser.Math.Angle.GetClockwiseDistance()
to get the shortest nonnegative angular distance between two angles. PR #7092 (thanks @samme) - Added
Phaser.Math.Angle.GetCounterClockwiseDistance()
gets the shortest nonpositive angular distance between two angles. PR #7092 (thanks @samme) - Added
Phaser.Math.Angle.GetShortestDistance()
gets the shortest signed angular distance between two angles. (This is likePhaser.Math.Angle.ShortestBetween()
but in radians.) PR #7092 (thanks @samme) - Added
Phaser.GameObjects.BitmapText#setDisplaySize
method toBitmapText
to get the original scaled size of 1. PR #6623 (thanks @samme) - Added fallback for Web Audio on Firefox. Firefox doesn't implement
positionX
,positionY
andpositionZ
properties on the AudioListener instances at the moment. This prevents the follow feature from WebAudioSound to operate on Firefox. PR #7083 (thanks @raaaahman)
- The
EXPAND
Scale Mode has been updated to now clamp the size of the canvas that is created, preventing it from growing too large on landscape ultra-wide displays. Fix #7027 (thanks @leha-games @rexrainbow) - An Error will now be thrown if you try to create a DOM Game Object but haven't correctly configured the Game Config (thanks @samme)
- An erroneous
console.log
was left in the Text Game Object. This has now been removed. - Particle emitter color RGB arrays are cleared before repopulating. Fix #7069 (thanks @Golen87 @samme)
Phaser.Animations.AnimationFrame
correctly uses frame duration when it is set. Fix #7070 (thanks @sylvainpolletvillard)- Particle emitter custom
moveTo
functions can now move particles. Fix #7063 (thanks @samme) - Changed ImageCollections default Tileset values from
null
toundefined
. Fix #7053 (thanks @Snoturky) - Chained tweens now
persist
correctly even after callingPhaser.Tweens.BaseTween#stop
. Fix #7048 (thanks @FranciscoCaetano88) - New left-to-right
Text
Game Objects now includes the defaultcanvas.dir = 'ltr
andcontext.direction = 'ltr';
. Fixes a bug in Chrome 134 & Edge 134 where callingdestroy()
on a right-to-leftText
Game Object prevents the next created left-to-rightText
Game Object from rendering. Fix #7077 (thanks @Demeno) Grid
Game Objects renderslineWidth
correctly in WebGL mode. Fix #7029 (thanks @AlvaroNeuronup)- Added
collisionMask
andcollisionCategory
checks toPhaser.Physics.Arcade.World#separate
to allow individual physics game objects within a physics group to have it's own unique collision categories. Fix #7034 (thanks @frederikocmr) - Fixed Arcade Physics bug causing immovable circle objects to move when pushed by polygons. Fix #7054 (thanks @hunkydoryrepair)
- Fixed
createFromTiles
to handle multiple tilesets when using sprite sheets. Fix #7122 (thanks @vikerman) - Fixed audio files not loading from Base64 data URIs (thanks @bagyoni)
Thanks to the following for helping with the Phaser Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@justin-calleja @ixonstater @DayKev
Phaser v4.0.0 Release Candidate 4
This update improves performance related to data buffer size, primarily affecting filters, including masks. A game that was bottlenecked by filters on mobile devices may experience speedups of 16x or more. A desktop system, or a scene with no filters, may be broadly unaffected, save for memory savings.
BatchHandlerQuadSingle
render node added.- This is just a copy of
BatchHandlerQuad
with space for 1 quad. - The rendering system uses this node internally for transferring images in some steps of the filter process.
- This is just a copy of
BatchHandler
render nodes now create their own WebGL data buffers.- This uses around 5MB of RAM and VRAM in a basic game.
- Dedicated buffers are an optimum size for batch performance.
WebGLRenderer#genericVertexBuffer
and#genericVertexData
removed.- This frees 16MB of RAM and VRAM.
BatchHandlerConfig#createOwnVertexBuffer
type property removed.TileSprite
no longer supports texture cropping.
- Lighting fixed on rotated or filtered objects.
- Added missing 'this' value for Group.forEach and StaticGroup.forEach (thanks @TadejZupancic)
- Fix
createFromTiles
to handle multiple tilesets when using sprite sheets. Fix #7122 (thanks @vikerman) - Fix audio files not loading from Base64 data URIs (thanks @bagyoni)
Thanks to the following people:
@captain-something @DayKev @ixonstater
Phaser v4.0.0 Release Candidate 3
This release candidate introduces better pixel art controls, and fixes performance issues related to pixel art options.
Updates since RC2:
GameObject#vertexRoundMode
added to control vertex pixel rounding on a per-object basis.- Options include:
"off"
: Never round vertex positions."safe"
: Round vertex positions if the object is "safe": it is rendering with a transform matrix which only affects the position, not other properties such as scale or rotation."safeAuto"
(default): Like "safe", but only if rendering through a camera whereroundPixels
is enabled."full"
: Always round vertex positions. This can cause sprites to wobble if their vertices are not safely aligned with the pixel resolution, e.g. during rotations. This is good for a touch of PlayStation 1 style jank."fullAuto"
: Like "full", but only if rendering through a camera whereroundPixels
is enabled.
GameObject#willRoundVertices(camera, onlyTranslated)
returns whether vertices should be rounded. In the unlikely event that you need to control vertex rounding even more precisely, you are intended to override this method.
- Options include:
Blocky
filter added. This is similar to Pixelate, but it picks just a single color from the image, preserving the palette of pixel art. You can also configure the pixel width and height, and offset. This is a good option for pixelating a retro game at high resolution, setting up for additional filters such as CRT emulation.
- WebGL2 canvases are now compatible with the WebGL renderer.
- Optimize multi-texture shader.
- Shader branching pattern changed to hopefully be more optimal on a wider range of devices.
- Shader will not request the maximum number of textures if it doesn't need them, improving performance on many mobile devices.
- Shader no longer performs vertex rounding. This will prevent many situations where a batch was broken up, degrading performance.
WebGLSnapshot
and snapshot functions based on it now return the correct pixel, instead of the one above it (or nothing if they're at the top of the image).ArcadePhysics#closest()
and#furthest()
are properly defined (thanks @samme).GamepadPlugin.stopListeners
andGamepadPlugin.disconnectAll
now have guards around them so they won't try to invoke functions on potentially undefined gamepads (thanks @cryonautlex)- Arcade Physics OverlapCirc() and OverlapRect() error when useTree is false. Fix #7112 (thanks @samme)
Thanks to the following people:
@ospira @samme @OuttaBounds @raaaahman
Phaser v4.0.0 Release Candidate 2
Updates since RC1:
RenderConfig#renderNodes
allows you to add render nodes at game boot.ShaderQuadConfig#initialUniforms
lets you initialize a Shader with uniforms on creation.Shader#setUniform(name, value)
lets you set shader program uniforms just once, instead of putting them all into thesetupUniforms()
method, where some uniforms might be set redundantly after init. This wrapsShader#renderNode.programManager.setUniform
.
TextureManager#addDynamicTexture
now hasforceEven
parameter.
- Fix parent transform on filtered objects (e.g. masks inside containers).
- Fix camera shake.
- Add typedefs for the
{ internal, external }
structure ofCamera#filters
(andGameObject#filters
). - Fix
FilterList#addMask
docs. - In Layer and Container objects, use that object's children for the
displayList
passed toRenderWebGLSteps
. - Fix positioning of Group members and offset objects in
DynamicTexture#draw
. - Fix Shadow filter direction.
Phaser v4.0.0 Release Candidate 1
Updates since beta 8:
- Mask filter now uses current camera by default.
GameObject#enableLighting
now works even if the scene light manager is not enabled. The light manager must still be enabled for lights to render, but the game object flag can be set at any time.YieldContext
andRebindContext
render nodes now unbind all texture units. These nodes are used for external renderer compatibility. An external renderer could change texture bindings, leading to unexpected textures being used, so we force texture rebind.
WebGLSnapshot
(used in snapshot functions) supports unpremultiplication, which is on by default. This removes dark fringes on text and objects with alpha.- Add chainable setter methods to
Filter
component:setFiltersAutoFocus
,setFiltersFocusContext
,setFiltersForceComposite
,setRenderFilters
. - All enhancements from Phaser v3 development have been merged. This includes:
Transform#getWorldPoint
Layer#getDisplayList
DynamicTexture
andRenderTexture
changes:forceEven
parameter forces resolution to be divisible by 2.clear(x, y, width, height)
method now takes the listed optional parameters.
Rectangle
now supports rounded corners.Physics.Matter.Components.Transform#scale
for setting scaleX and scaleY together.WebGLRenderer
reveals functions around context loss:setExtensions
setContextHandlers
dispatchContextLost
dispatchContextRestored
- Improvements to tile handling for non-orthogonal tiles.
Tween#isNumberTween
- Many other fixes and tweaks.
- Fix
WebGLSnapshot
orientation. - Fix filters rendering outside intended camera scissor area.
- Fix reversion in BitmapText kerning.
- Fix
CaptureFrame
compatibility withLayer
andContainer
. - Fix
Grid
using old methods. It was supposed to use 'stroke' just like otherShape
objects, not a unique 'outline'. - Add
@return
tag toFilterList#addBlend
(thanks @phasereditor2d!). - Fix
RenderSteps
parameter propagation intoLayer
andContainer
. This resolves some missing render operations in complex situations. - Fix
DynamicTexture
errors when rendering Masks. - Fix camera transform matrix order issues, as seen when rendering through transformed cameras.
- Fix GL scissor sometimes failing to update. The actual issue was, we were storing the screen coordinates, but applying GL coordinates, which can be different in different-sized framebuffers.
DrawingContext
now takes screen coordinates, and sets GL coordinates in theWebGLGlobalWrapper
.
Phaser v4.0.0 Beta 8
- Mask Filter now uses world transforms by preference when drawing the mask. This improves expected outcomes when mask objects are inside Containers.
- Extend
RenderWebGLStep
to take the currently rendering object list and index as parameters. This allows render methods to know their context in the display list, which can be useful for optimizing third-party renderers.- This takes the place of
nextTypeMatch
from Phaser v3, but is much more flexible.
- This takes the place of
- Add
DynamicTexture#capture
, for rendering game objects more accurately and with greater control thandraw
. - Add
CaptureFrame
game object, which copies the current framebuffer to a texture when it renders. This is useful for applying post-processing prior to post.
- Prevent
RenderTexture
from rendering while it's rendering, thus preventing infinite loops. - Fix boundary errors on the Y axis in
TilemapGPULayer
shader, introduced after switching to GL standard texture orientation. - Fix
Filters#focusFilters
setting camera resolution too late, leading to unexpected results on the first frame. - Fix parent matrix application order, resolving unexpected behavior within Containers.
- Fix
FillCamera
node being misaligned/missing in cameras rendering to framebuffers. - Fix errors when running a scene without the lighting plugin.
- Fixes to TypeScript documentation: thanks to SBCGames and mikuso for contributions!
Phaser v4.0.0 Beta 7
- Camera System Rewrite
The camera system rewrite changes the way camera matrices are calculated.
The Phaser 3 camera combined position, rotation, and zoom into Camera#matrix
. Camera scroll was appended later.
The new camera system uses two matrices. Camera#matrix
is now a combination of rotation, zoom, and scroll. A new Camera#matrixExternal
property includes camera position. This allows us to cleanly divide the view from the position.
This change doesn't affect how you set camera properties to change the view. It mostly affects internal systems. However, if you use camera matrices directly, be aware that they have changed.
Camera#matrix
now includes scroll, and excludes position.Camera#matrixExternal
is a new matrix, which includes the position.Camera#matrixCombined
is the multiplication ofmatrix
andmatrixExternal
. This is sometimes relevant.- The
GetCalcMatrix(src, camera, parentMatrix, ignoreCameraPosition)
method now takesignoreCameraPosition
, causing its return value to use the identity matrix instead of the camera's position. GetCalcMatrixResults
now includes amatrixExternal
property, and factors scroll into thecamera
andcalc
matrices.- To get a copy of a matrix with scroll factor applied, use
TransformMatrix#copyWithScrollFactorFrom(matrix, scrollX, scrollY, scrollFactorX, scrollFactorY)
. This generally replaces cases where phrases such asspriteMatrix.e -= camera.scrollX * src.scrollFactorX
were used.
The new system fixes many issues with nested transforms, filters, and other uses of transforms.
- Add documentation explaining how to modify a
SpriteGPULayer
efficiently. - Add
SpriteGPULayer#insertMembers
method. - Add
SpriteGPULayer#insertMembersData
method. - Add
SpriteGPULayer#getDataByteSize
method. - Add non-looping animations to
SpriteGPULayer
(set animation toloop: false
) to support one-time particle effects and dynamic sources. - Add creation time to
SpriteGPULayer
members. - Add documentation for writing a
Extern#render
function. TilemapLayer
andTilemapGPULayer
now support a parent matrix during rendering.Shape
now setsfiltersFocusContext = true
by default, to prevent clipping stroke off at the edges.
- Fix missing reference to Renderer events in
BatchHandler
(thanks @mikuso) - Fix
SpriteGPULayer
segment handling (segments changed from 32 to 24 to avoid problems with 32-bit number processing) - Allow negative acceleration in
SpriteGPULayer
member animations using Gravity. - Rearrange
SpriteGPULayer
data encoding. - Fix
SpriteGPULayer
failing to generate frame animations from config objects. - Allow
TextureSource#setFlipY
to affect all textures (except compressed textures, which have fixed orientation). WebGLProgramWrapper
now correctly recognizes uniforms with a value ofundefined
and can recognize if they have not changed and do not need updates.- Set
roundPixels
game option tofalse
by default. It's very easy to get messy results with this option, but it remains available for use cases where it is necessary. - Throw an error if
DOMElement
has no container. - Fix
TileSprite
applyingsmoothPixelArt
game option incorrectly.
Phaser v4.0.0 Beta 6
- Add Filter support to
Layer
. - Allow
RenderTexture
to automatically re-render.DynamicTexture#preserve()
allows you to keep the command buffer for reuse after rendering.DynamicTexture#callback()
allows you to run callbacks during command buffer execution.RenderTexture.setTextureMode()
allows you to set the RenderTexture to automatically re-render during the render loop.
- Fix
roundPixels
handling in many places, mostly by removing it from irrelevant situations.- Remove
TransformMatrix#setQuad
parameterroundPixels
, as it is no longer used.
- Remove
- Filters are correctly destroyed along with their owners, unless
ignoreDestroy
is enabled. This supports multi-owner Filter controllers. - WebGLRenderer destroys itself properly.
- Remove unnecessary transform related to camera scroll.
- Remove references to Mesh.
- Fix UV coordinates in
Shader
. Shader#setTextures()
now replaces the texture array, rather than adding to it.- Fix
SpriteGPULayer#getMember()
, which previously multiplied the index by 4. - Fix
flipX
/flipY
inFilter#focusFilters
. - Fix
BatchHandlerQuad#run()
parametertintFill
, which was set as a Number but should be used as a Boolean. - Eliminate rounding in
Camera#preRender()
.
Phaser v3.88.1
- Fixed
ReferenceError: GetFastValueOp is not defined
in NumberTweenBuilder (thanks Flow) - Reverted incorrect change made to
SafeRange
array util function. - Fixed
Array.Utils.GetFirst
so it correctly handles a negative start index. Fixes Container.getByName returning null and various other similar methods. Fix #7040 (thanks @XWILKINX)