phaserjs/phaser/v4-new-features

Claude Code and agent skill by phaserjs/phaser

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

A map of what Phaser 4.0 to 4.3 added, a few lines each, with the skill which covers it: Filters, render nodes, lighting and cone lights, tint modes and setTint2, CaptureFrame, Gradient, the Noise objects, Sky and its stars, World3D, SpriteGPULayer, TilemapGPULayer, Stamp, Mesh2D, Stencil, CustomContext, setFPSLimit, SDF Graphics and Shapes, line joins, clean alpha, the Loader AbortSignal and the Phaser.AUTO fallback to Canvas. Use when asked what's new in Phaser 4 or a 4.x release, or when choosing a v4-only object for huge numbers of sprites, large tilemaps, procedural noise, gradients, banded skies, starfields or meshes. Triggers on: what's new, 4.1, 4.2, 4.3, Salusa, Giedi, Arrakis, changelog, SpriteGPULayer, TilemapGPULayer, Mesh2D, Stencil, noise, gradient, sky, starfield, raster bands.

Install

npx vskill@latest install phaserjs/phaser/v4-new-features

SKILL.md

The same SKILL.md was published earlier as phaserjs/phaser/v4-new-features.

What's new in Phaser 4.0 to 4.3

A map of the features added since Phaser 3, by release. Each entry names the API and links to the skill with the detail. For code which must change when porting from v3, use v3-to-v4-migration.

Source: changelog/v4/4.0/CHANGELOG-v4.0.0.md, changelog/v4/4.1/, changelog/v4/4.2/, changelog/v4/4.2.1/, changelog/v4/4.3/CHANGELOG-v4.3.0.md, docs/Phaser 4 Rendering Concepts/. Related: phaser4-core, v3-to-v4-migration.

Most new rendering features are WebGL only. obj.filters is null until enableFilters(), which does nothing in Canvas, and Phaser.AUTO can fall back to Canvas (4.3). Guard them as phaser4-core shows.

Quick start: the v4-only objects with no other skill

js
create ()
{
const { width, height } = this.scale;
// Gradient: a GPU gradient, as a Game Object. config, x, y, width, height.
this.add.gradient({
bands: [ { colorStart: 0x0b1d51, colorEnd: 0xff7e5f } ],
shapeMode: 2, // 0 LINEAR, 1 BILINEAR, 2 RADIAL, 3 CONIC_SYMMETRIC, 4 CONIC_ASYMMETRIC
start: { x: 0.5, y: 0.5 }
}, width / 2, height / 2, width, height);
// Sky (4.3): a vertical gradient in chunky bands, which fills the game and ignores the Camera.
// Colors run top to bottom: a preset name, or an array of colors and [ color, percent ] stops.
const sky = this.add.sky([ 0x1b1446, [ 0xd9455f, 60 ], 0xffd166 ]).setBandHeight(24);
// Stars are drawn by the Sky. addStars returns the stars, not the Sky.
const stars = sky.addStars({ count: 300, speedY: 40 });
// Noise: the factory names are all lower case.
const clouds = this.add.noisesimplex2d({ noiseIterations: 4, noiseSeed: [ 1, 2 ] }, 200, 200, 256, 256);
this.tweens.add({ targets: clouds, noiseFlow: Math.PI * 2, duration: 8000, repeat: -1 });
// SpriteGPULayer: up to millions of quads from one texture in one draw call.
const layer = this.add.spriteGPULayer('stars', 10000); // texture, maximum members
for (let i = 0; i < 10000; i++)
{
layer.addMember({ x: Math.random() * width, y: Math.random() * height, frame: 'star' });
}
}
  • The noise objects are noise, noisecell2d, noisecell3d, noisecell4d, noisesimplex2d and noisesimplex3d. noiseSeed is an array of integers. Animate noiseOffset (an [x, y] array) to scroll, and noiseFlow (simplex) or the extra axes (noisecell3d, noisecell4d) to evolve the pattern. noiseNormalMap: true outputs a normal map for lighting.
  • The Gradient colors are a Phaser.Display.ColorRamp of ColorBands. Call gradient.ramp.encode() after changing them.
  • Sky: the config, x, y, width, height. The default size is the game, with an origin of 0 and a scroll factor of 0. Presets: day, dawn, sunset, dusk, night, rainbow (Phaser.GameObjects.Sky.Presets). setColors can be called every frame. bandHeight is in pixels, and 0 is a smooth gradient.
  • Sky colors and the Camera: setGradientHeight(worldHeight, 1) makes the colors cover the world, so the Sky shows the part the Camera's scrollY is at. Only vertical scroll changes the colors. scrollY, scrollSpeed and repeat scroll them by hand. scrollBands moves the bands, not just the colors.
  • Sky stars (SkyStars): count, layers, color / farColor, size / farSize, speedX / speedY in pixels per second (positive is right and down), cameraFactor (default 0.5), key / frame for a texture. is3D: true flies them out of originX, originY at speedZ. See src/gameobjects/sky/.
  • Gradient, Sky and the Noise objects extend Shader. See custom-rendering.
  • SpriteGPULayer: fill it once. Adding, editing or removing members rewrites the GPU buffer, which is expensive. Members can animate on the GPU (x, y, rotation, scaleX, scaleY, alpha and tintBlend take an animation config). It has setLighting. See src/gameobjects/spritegpulayer/.

4.0: the new renderer

FeatureAPISkill
Render nodes replace pipelinessetRenderNodeRole, render.renderNodes config, addRenderStepcustom-rendering
Filters replace preFX, postFX and FXenableFilters(), filters.internal, filters.externalfilters-and-postfx
The Mask filter replaces BitmapMaskfilters.internal.addMask(), Phaser.Actions.AddMaskShapemasks-and-stencils
Effect ActionsPhaser.Actions.AddEffectBloom, AddEffectShine, FitToRegionfilters-and-postfx, actions-and-utilities
Lighting componentsetLighting(true), setSelfShadow(), lights have zlighting
Tint modessetTintMode(Phaser.TintModes.FILL) and othersgame-object-components
Vertex roundingvertexRoundMode, roundPixels defaults to false, smoothPixelArtphaser4-core, scale-and-responsive
CaptureFramethis.add.captureFrame(key): copies what's drawn so far to a texturefilters-and-postfx
Gradient, Noisethis.add.gradient, this.add.noise and the other fiveQuick start above
SpriteGPULayerthis.add.spriteGPULayer(texture, size)Quick start above
TilemapGPULayermap.createLayer(id, tileset, x, y, true): one quad, one tileset, orthogonal mapstilemaps
Stampthis.add.stamp(x, y, texture, frame): a quad which ignores the Camera, for Dynamic Texturesrender-textures
Dynamic Texture changesrender() runs the queued draws; preserve, callback, capture; Render Texture renderModerender-textures
TileSpriteUses atlas frames; tileRotationsprites-and-images
NineSlicetileX, tileY arguments tile the edgessprites-and-images
Compact texture atlasthis.load.atlasPCT(key, url): a small text atlas formatloading-assets
Hash noise in JSPhaser.Math.Hash, HashCell, HashSimplexgeometry-and-math
Color rampsPhaser.Display.ColorBand, ColorRamp; Color helpers can write to an existing Colorgeometry-and-math
Destroyed flaggameObject.isDestroyedgame-object-components

4.1 (Salusa)

  • import Phaser from 'phaser' works: the ESM build has a default export.
  • Layer is a true Game Object, so its filters work. See groups-and-containers.
  • render.mipmapRegeneration lets Dynamic Textures rebuild their mipmaps. Filters never use mipmaps.
  • Filter Controllers have getPaddingCeil(). Custom render nodes should call it rather than getPadding().

4.2 (Giedi)

FeatureAPISkill
Stencilthis.add.stencil(x, y, children, options): a Container which writes to the stencil buffer, a fast lasting maskmasks-and-stencils
StencilReferencethis.add.stencilreference(stencil, options): draws a Stencil again with other settingsmasks-and-stencils
CustomContextthis.add.customcontext(x, y, children, callback): a Container which changes the DrawingContext, such as the scissor or stencil testmasks-and-stencils
Alpha strategiesrender.alphaStrategy ('keep'), render.stencil (true), render.stencilAlphaStrategy ('dither'); strategies keep, dither, thresholdmasks-and-stencils
Mesh2Dthis.add.mesh2d(x, y, texture, vertices, indices): textured triangles which batch with sprites. Vertices are x, y, u, v; indices are a, b, c, page. Supports lightingsrc/gameobjects/mesh2d/Mesh2D.js
Cone lightsthis.lights.addConeLight(...), light.setCone(), setConeRotation, setConeAngles, disableConelighting
Second tintTintModes.MULTIPLY_TWO, setTint2(), tint2TopLeft and the other cornersgame-object-components
FPS limit at runtimethis.game.loop.setFPSLimit(30); 0 removes the limitgame-setup-and-config
  • The filters render step now runs just before the object's own render step, so other render steps can run first.
  • inTintEffect in the tint shader changed from a float to a vec4. Only custom shaders which read it are affected.
  • The new BatchHandlerTri render node draws triangles; TransformerVertex has setupMatrix and transformVertex.
  • 4.2.1 fixed stencilInvert, and stencil clearing in framebuffers.

4.3 (Arrakis)

Graphics and Shapes, all in graphics-and-shapes:

  • SDF shapes. WebGL draws circles, ellipses, arcs, rounded rectangles, strokes and lines with signed distance fields. They're round and smooth at any zoom, and look different from 4.2. render.sdfShapes: false goes back to triangles.
  • Joins. Stroked paths now have pointed joins, as in Canvas. lineJoin ('miter', 'bevel', 'round') and miterLimit (default 10) on Graphics, setLineJoin and setMiterLimit on Shapes.
  • Gradients. fillLinearGradient, fillRadialGradient, lineLinearGradient and lineRadialGradient on Graphics, and setFillLinearGradient, setFillRadialGradient, setStrokeLinearGradient and setStrokeRadialGradient on Shapes. Any number of stops. Both renderers draw them.
  • Hard edges. setHardEdges(true) turns off the smoothed edge, for a crisp mask.
  • Clean alpha. setCleanAlpha() on Graphics and Shapes fades the whole object evenly, so overlapping parts don't show through each other. WebGL only, and it costs a framebuffer while alpha is below 1.

Other features:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
39,633
Repository forks
7,130
7-day trend score
53

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 May 2026, 6 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Grok Build (Cursor)
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/phaserjs/phaser/v4-new-features/badge)](https://verified-skill.com/skills/phaserjs/phaser/v4-new-features)

Something wrong with this skill or its page? Tell us.