Phaser v3.85.1 #6903
photonstorm
announced in
Announcements
Phaser v3.85.1
#6903
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Version 3.85.1 - Itsuki - 5th September 2024
MatterJS
wrapmethod has been natively integrated into theBodyclass to replace the existingMatterWrapplugin. Here's how it works.attractorsplugin has been natively integrated into theBodyclass and Matter engine. More details here.MatterCollisionEventsplugin functionality directly into theMatter.Worldclass to handle collisions more effectively. More details here.Matter.Worldto improve the performance, accuracy, and reliability of theupdatemethod in handling physics simulations or animations. More details here.Matter.Worldbug wheregroup.lengthreturnsundefined. Changed togroup.getLength()to correctly return number of children in a group.Matter.World.pausewould stop the world updating, but the RunnertimeLastTickwasn't reset whenresumewas called, causing all the bodies to advance. The time is now reset correctly. Fix Matter Pause Issue | 3.85.0-beta.2 #6892 (thanks @philipgriffin)Round Pixels
Includes a Potentially Breaking Change
The way
roundPixelshas been handled in this release has been changed significantly. In previous versions we passed a uniform to the shaders and handled the pixel rounding on the GPU. However, this caused issues with our batching flow - for example, a Sprite would need to be rounded, but a Text or Shape object would not. This lead to complications in some parts of the render code.In this release we have removed the shader uniform and branching and also made
roundPixelsdefault tofalsein the Game Config. Previously, it wastrue, so you may need to switch this flag if you were relying on it. Here are the results of this change:roundPixelsproperty now defaults tofalse.uRoundPixelsuniform has been removed from the Single, Multi and Mobile vertex shaders.uRoundPixelsuniform has been removed from the Single, Rope, PreFX, PostFX, Multi and Mobile WebGL Pipelines.camera.roundPixelsvalue to the Transform MatrixsetQuadmethod.batchSpriteandbatchTexturemethods will now applyMath.floorto the sprite matrix calculations if camera round pixels is enabled.BaseCamera.preRenderhas been removed. This method was completely overridden byCamera.preRenderwhich is the method that contained the correct rendering logic. As the Base Camera variant was not used internally outside of Dynamic Textures, we have removed it to save space.Camera.preRenderhas been updated to use both zoomX and zoomY for the matrix transform.Camera.preRenderhas been updated to apply Math.floor to the scroll factor when rounding is enabled on the Camera. This fixes an issue where following sprites with Camera lerp, or heavy zoom factors, would cause 'stuttering' at sub-pixel values.New Features - Loader
The Loader now has a new feature called
maxRetries. This specifies the number of times a single File will retry loading itself should it error for whatever reason, such as poor network connectivity. The default value is 2. You can change this in the Game Config, on the LoaderPlugin instance, on the FileConfig or on the File level itself. Thanks to @pavle-goloskokovic for the suggestion.loader.maxRetriesis a new Game Config option to set the number of retries a file will attempt to load. The default is 2.LoaderPlugin.maxRetriesis a new property that holds the number of times to retry loading a single file before it fails. This property is set via the Game Config, but can also be adjusted manually. Changing it doesn't not impact files already in the load queue, only those added later.FileConfig.maxRetriesis a new File Config option to set the number of retries a file will attempt to load. If not specified in the config, the value is read from theLoaderPlugin.maxRetriesproperty.Loader.File.retryAttemptsis the internal property holding the counter for the number of times to retry loading this file before it fails. This value is decreased after each attempt. When it reaches zero, the file is considered as failed.New Features
BaseSoundManager.isPlayingis a new method that will return a boolean if the given sound key is playing. If you don't provide a key, it will return a boolean if any sound is playing (thanks @samme)WebGLRenderer.dispatchContextLostis a new internal method that is called when the WebGL context is lost. By default this is bound to the propertyWebGLRenderer.contextLostHandler. If you override the context loss handler, be sure to invoke this method in due course.WebGLRenderer.dispatchContextRestoreis a new internal method that is called when the WebGL context is restored. By default this is bound to the propertyWebGLRenderer.contextRestoreHandler. If you override the context restore handler, be sure to invoke this method in due course.WebGLRenderer.setContextHandlersis a new internal method with 2 optional parameters:contextLostandcontextRestored. These allow you to overwrite the defaultcontextLostHandlerandcontextRestoreHandlerhandlers. (thanks @yaustar)Phaser.Textures.Frame#setCutPositionis a new internal method with 2 optional parameters:xandy. These sets the x and y position within the source image to cut from.Phaser.Textures.Frame#setCutSizeis a new internal method with 2 parameters:widthandheight. These sets the width, and height of the area in the source image to cut. (thanks @FelipeIzolan)ORIENTATION_CONST. The constantsLANDSCAPE_SECONDARYandPORTRAIT_SECONDARYhave been added to thePhaser.Scale.Orientationobject. These constants represent the secondary landscape and portrait orientations respectively. This addition provides more granular control over device orientation handling in Phaser. Fix scaleManager.isPortrait and scaleManager.isLandscape #6837 (thanks @rexrainbow)updateConfigmethod inParticleEmitterto allow dynamic updating of Particle Emitter configurations. This method enables existing properties to be overridden and new properties to be added to the emitter's configuration. It ensures that the emitter is reset with the updated configuration for more flexible particle effects management.Phaser.Textures.DynamicTexture#clearmethod. Clear a specific area within aDynamic Textureby specifyingx,y,width, andheightparameters to clear only a portion of the texture. Fix Textures should have a way toerasea portion of the texture via a size / width / height #6853 (thanks @SelfDevTV)Phaser.Renderer.WebGL.RenderTarget#clearmethod. Clear a specific area within theRenderTargetby specifyingx,y,width, andheightparameters.TextureManager. In the gameconfig, setdefaultImagetonullto ignore loading thedefaultImage.TextureManager. In the gameconfig, setmissingImagetonullto ignore loading themissingImage.TextureManager. In the gameconfig, setwhiteImagetonullto ignore loading thewhiteImage.Phaser.Core.TimeStep#pauseDurationis a new property that holds the duration of the most recent game pause, if any, in ms (thanks @samme)Events#RESUMEevent now contains a new parameterpauseDurationwhich is the duration, in ms, that the game was paused for (thanks @samme)Phaser.Loader.LoaderPlugin#removePackmethod toLoaderPluginthat removes resources listed in an Asset Pack.(thanks @samme)Scene.switchyou can now optionally specify adataargument, just like with Scene start, which will be passed along to the Scene that was switched to (thanks @wooseok123)PRE_RENDER_CLEARis a new event dispatched by the WebGL and Canvas Renderer. It's dispatched at the start of the render step, immediately before the canvas is cleared. This allows you to toggle theclearBeforeRenderproperty as required, to have fine-grained control over when the canvas is cleared during render.Video.getFirstFrameis a new method that can be used to load the first frame of the Video into its texture without starting playback. This is useful if you want to display the first frame of a video behind a 'Play' button, without calling the 'play' method.GameObject.getDisplayListis a new method that will return the underlying list object that the Game Object belongs to, either the display list or its parent container.GameObject.setToTopis a new method that will move the Game Object to the top of the display list, or its parent container (thanks @rexrainbow)GameObject.setToBackis a new method that will move the Game Object to the bottom of the display list, or its parent container (thanks @rexrainbow)GameObject.setAboveis a new method that will move the Game Object to appear above a given Game Object (thanks @rexrainbow)GameObject.setBelowis a new method that will move the Game Object to appear below a given Game Object (thanks @rexrainbow)WebGL Rendering Updates
WebGLTextureWrapper.updateexpanded:sourceparameter is now type?object, so it can be used for anything that is valid in the constructor.formatparameter can update the texture format.Updates - Input System
GameObject.disableInteractivemethod has a new optional parameterresetCursor. If set, this will reset the current custom input cursor - regardless if the Game Object was the one that set it, or not.GameObject.removeInteractivemethod has a new optional parameterresetCursor. If set, this will reset the current custom input cursor - regardless if the Game Object was the one that set it, or not.InputManager.resetCursormethod has a new optional booleanforceResetwhich will reset the state of the CSS canvas cursor, regardless if there is a given Interactive Object, or not.InputPlugin.isActivemethod will now check if the InputPlugin has the InputManager reference set, and if that is also enabled, as well as checking its own enabled state and that of the Scene.InputPlugin.resetCursoris a new method that will reset a custom CSS cursor from the main canvas, regardless of the interactive state of any Game Objects.InputPlugin.disablemethod has a new optional boolean parameterresetCursorwhich will reset the CSS custom cursor if true.InputPlugin.setCursoris a new method that will immediately set the CSS cursor to the given Interactive Objects cursor. Previously, this was hidden behind a private method in the Input Manager.All of the core Input Plugin process methods have been rewritten. The methods that have changed are:
InputPlugin.processMoveEventsInputPlugin.processWheelEventInputPlugin.processOverEventsInputPlugin.processOutEventsInputPlugin.processOverOutEventsInputPlugin.processUpEventsInputPlugin.processDownEventsAnd they all now do the following flow:
sprite.on('pointerdown'))isActive() falsethen it will break from the handler loop. This will only happen if the user explicitly tells the event to stop propogation, or if they disable either the Input Plugin, or the entire Input Manager, during the event handler. Previously, only the state of cancelled event was checked. Also previously, if the Game Objects own input handler was removed or disabled as a result of their event handler, it would break from the process loop. This no longer happens. It will carry on inspecting the remaining interactive objects in the loop, as long as the Input system itself wasn't disabled.this.input.on('gameobjectdown')are emitted.isActive() falsethen it will break from the handler loop, otherwise it carries on.this.input.on('pointerdown')from a Scene)The above flow is new in v3.85 and will catch a lot more strange edge-cases, where Game Objects, or the Event, or the whole Input system is disabled during an active event handler. The above fixes #6833 (thanks @ddanushkin), #6766 (thanks @pabloNeuronup) and #6754 (thanks @orcomarcio)
InputPlugin.forceDownStateis a new method that will force the given Game Object into the 'down' input state, regardless of what state it is currently in. This will emit the relevant events accordingly.InputPlugin.forceUpStateis a new method that will force the given Game Object into the 'up' input state, regardless of what state it is currently in. This will emit the relevant events accordingly.InputPlugin.forceOverStateis a new method that will force the given Game Object into the 'over' input state, regardless of what state it is currently in. This will emit the relevant events accordingly.InputPlugin.forceOutStateis a new method that will force the given Game Object into the 'out' input state, regardless of what state it is currently in. This will emit the relevant events accordingly.InputPlugin.forceStateis a new internal method that forces a Game Object into the given state.Updates
Phaser.Scale.ScaleManager.leaveFullScreenSuccessHandlermethod to separateEvents.LEAVE_FULLSCREENfromPhaser.Scale.ScaleManager.stopFullscreento ensureEvents.LEAVE_FULLSCREENis only emitted once when exiting fullscreen mode. (Fix leave fullscreen event fires twice #6885, thanks @Antriel)Timeline.pausewill now pause any currently active Tweens that the Timeline had started (thanks @monteiz)Timeline.resumewill now resume any currently paused Tweens that the Timeline had started (thanks @monteiz)Timeline.clearandTimeline.destroywill now destroy any currently active Tweens that the Timeline had created. Previously, active tweens would continue to play to completion (thanks @monteiz)TimelineEventhas a new property calledtweenInstance. If the Timeline event has a tween that has been activated, this will hold a reference to it.requestVideoFramepolyfill has been updated to the latest release, which should resolve some SSR framework issues. Fix requestVideoFrame polyfill is causing a error in Next.js hot-reload #6776 (thanks @lantictac)ScaleManagerlisteners includes checks for thescreen.orientationobject and adds/removes achangeeventListener method to handle screen orientation changes on mobile devices. Theorientationchangeevent is still maintained for backwards compatibility. Fix scaleManager.isPortrait and scaleManager.isLandscape #6837 (thanks @rexrainbow)TileSprite, setting eitherwidthorheightto0results in both values being set to thedisplayFrame.widthanddisplayFrame.height. The updated logic now checks forwidthandheightseparately. Ifwidthis0, it is set todisplayFrame.width. Ifheightis0, it is set todisplayFrame.height. Fix Tilesprite width / height not respected one dimension is zero #6857 (thanks @GaryStanton)GetBitmapTextSizewith improvedmaxWidthcalculations for wrapped text.Vector3.subVectorsis a new method that will take 2 Vector3s, subtract them from each other and store the result in the Vector3 it was called on.TextStyle.setStylemethod will no longer mutate the givenstyleobject if it includes a numericfontSizevalue. Fix TextStyle.setStyle mutates the given style parameter object #6863 (thanks @stormpanda)Shape.Ellipse.setSizemethod will internally callupdateDisplayOriginto retain position after a size change.BitmapText BatchCharfunction now inlines all of the matrix math, avoiding 16 function calls per character rendered.Bug Fixes
activePointersgame config option is now the correct amount of touch input pointers set. Fix The last touch input pointer is never activated #6783 (thanks @samme)TextureManager.checkKeywill now returnfalseif the key is not a string, which fixes issues where a texture could be created if a key was given that was already in use (thanks Will Macfarlane).imageLoadType) to LoaderConfig, so they now appear in the TypeScript defs.EXPANDscale mode had a bug that prevented it from using the world bounds cameras, cutting rendering short. Fix EXPAND falls back to config width and height when changing scenes #6767 (thanks @Calcue-dev @rexrainbow)getPipelineName()on a Game Object would cause a runtime error if running under Canvas. It now simply returnsnull. FixgetPipelineName()errors with the Canvas renderer #6799 (thanks @samme)setPushable(false)method forcirclebodies prevents the bodies from being pushed. Fix Pushablefalsebodies still move when circle shaped #5617 (thanks @kainage)addDeathZone()on a particle emitter Game Object had a bug where theDeathZoneused world position coordinates.DeathZonenow uses local position coordinates following the particle emitter position. Fix Particle emitter death zones are positioned in global space #6371 (thanks @vforsh)GetLineToLinemethod inGetLineToLineto handle the case wheredx1ordy1values is zero. This ensures the function correctly returnsnullin this case to prevent errors in calculations involving line segments. Fix The result will be NaN, if dx1===0 (GetLineToLine.js) #6579 (thanks @finscn)&operation betweenbody1.collisionMaskandbody2.collisionCategory. The defaultcollisionMaskvalue is changed to2147483647to correctly match anycollisionCategory. Fix Group vs Group collisions fail if child objects have non-default masks or categories because the default collisionMask only matches the category "1". #6764 (thanks @codeimpossible)BitmapTextwhere adding a space character' 'at the end of a line did not correctly align the vertical position of the new line. The updated calculation now correctly accounts for both line height and line spacing. Fix a problem with the bitmap text when the maxWidth is set and the last letter is space #6717 (thanks @wooseok123)BitmapTextwhere an extra empty line was added whensetMaxWidthwas called, and the width of the line was less than a word. Previously,yAdvancewas incorrectly incremented bylineHeight + lineSpacingfor each word, leading to an unintended increase in vertical space. The correction now calculatesyAdvancebased on thecurrentLineindex, ensuring that vertical spacing accurately reflects the number of lines. Fix BitmapText setMaxWidth() bug #6807 (thanks @AlvaroNeuronup)BitmapTextwhere adding a space character' 'at the end of a line caused the following line of to ignore line wrapping when usingsetMaxWidth. Fix BitmapText not wrapping lines in some cases #6860 (thanks @bagyoni)Matrix4.lookAtRHmethod would fail because it called two missing Vector3 methods.RenderTargetwill now automatically listen for the Renderer resize event ifautoResizeis true. This fixes an issue with Bitmap Masks where they wouldn't resize if the renderer resized. Fix Resolution of BitmapMask gets somehow corrupted on game resize #6769 Post FX Blur With Mask on Graphics Loses Position/Scale on Resize #6794 (thanks @pavels @seansps)Texture.getFrameBoundsmethod will now include the BASE texture in its calculations. This prevents it from returning a size of Infinity. This fixes an issue where a Tileset with margin/spacing loaded viaload.spritesheetinstead ofload.imagewould have its margin and spacing ignored. Fix Tilemap support for spacing and/or margin broken since 3.80 #6823 (thanks @damian-pastorini)TextGame Object, combined with stroke, the stroke would be mis-aligned. The stroke is now applied to the letter-spaced text as well (thanks @RomanFrom710)PreFXPipeline.batchQuadmethod will now applyMath.roundto the target bounds center point. This prevents sub-pixel values during thecopyTextSubImage2Dcall, preventing sprites with pre-fx from appearing mis-aligned during camera pans. Fix images with preFX jitter #6879 (thanks @Antriel)processCallbackwill now correctly handle non-Game Object physics bodies and pass them to the callback (thanks @ospira)WebAudioSoundto loop and setSoundManager.pauseOnBlur = false, then if you start the sound and tab away from Phaser, the sound wouldn't then loop on return to the game, if the loop expired while the tab was out of focus. This was due to checking the audio source node target against the wrong internal property. Fix Audio set to loop infinitely stops, when next loop triggers while switched to another tab. #6702 (thanks @michalfialadev)MeshWebGLRenderer will now recalculate thevertexOffsetcorrectly if the batch flushes, fixing an issue where it would display missing triangles in a mesh after a batch flush. Fix Meshes are missing parts when multiple batches are needed to render scene #6814 (thanks @pavels)NineSliceGame Object will now guard against an invalid texture by checking for theframeandtextureFramevars before trying to read values from them. Fix Nineslice object bug #6804 (thanks @IvanDem)Input Bug Fixes
pointer.leftButtonReleasedwill now returntruewhen multiple mouse buttons are being pressed.pointer.rightButtonReleasedwill now returntruewhen multiple mouse buttons are being pressed.pointer.middleButtonReleasedwill now returntruewhen multiple mouse buttons are being pressed.pointer.backButtonReleasedwill now returntruewhen multiple mouse buttons are being pressed.pointer.forwardButtonReleasedwill now returntruewhen multiple mouse buttons are being pressed. Fix pointer.leftButtonReleased() while holding RMB on DRAG_END reports false (wrong), instead of true (correct) value #6027 (thanks @michalfialadev)Examples, Documentation, Beta Testing and TypeScript
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:
@AlbertMontagutCasero
@Andrek25
@Antriel
@leha-games
@lgtome
@monteiz
@rexrainbow
@saintflow47
@samme
@ssotangkur
@vankop
Deprecation Warning for the next release
The next release of Phaser will make the following API-breaking changes:
Phaser.Struct.Mapand replacing it with a regular JSMapinstance. This means methods likecontainsandsetAllwill be gone.Phaser.Struct.Setand replacing it with a regular JSSetinstance. This means methods likeiterateLocalwill be gone.Create.GenerateTexture, all of the Create Palettes and thecreatefolder will be removed.phaser-ie9.jsentry-point will be removed along with all associated polyfills.Geom.Pointclass and all related functions will be removed. All functionality for this can be found in the existing Vector2 math classes. All Geometry classes that currently create and return Point objects will be updated to return Vector2 objects instead.This discussion was created from the release Phaser v3.85.1.
Beta Was this translation helpful? Give feedback.
All reactions