Token导航 LogoToken导航

Agent Skill · 开发

v3-to-v4-migration(v3 到 v4 的迁移)

v3-to-v4-migration 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

v3-to-v4-migration 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 13,958。

总安装 783周安装 32GitHub Stars 39,490下载 253核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:v3-to-v4-migration(v3 到 v4 的迁移)
来源仓库:https://github.com/phaserjs/phaser
仓库路径:skills/v3-to-v4-migration
安装命令:
npx skills add https://github.com/phaserjs/phaser --skill v3-to-v4-migration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/phaserjs/phaser --skill v3-to-v4-migration

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

用于处理 GitHub 仓库和代码协作信息。适合围绕仓库状态和代码变更进行整理。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。可结合来源仓库和 README 核验具体用法。安装前建议确认权限范围和命令执行风险。

v3-to-v4-migration 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/v3-to-v4-migration

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/phaserjs/phaser --skill v3-to-v4-migration;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

v3-to-v4-migration 怎么安装?

在终端执行 npx skills add https://github.com/phaserjs/phaser --skill v3-to-v4-migration。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

v3-to-v4-migration 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

v3-to-v4-migration 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

v3-to-v4-migration 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

v3-to-v4-migration 用的人多吗?

公开数据是累计安装 783 次,近一周安装 32 次,下载 253 次,GitHub 39,490 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

v3-to-v4-migration 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 39,490 星,维护活跃度相对可查。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
v3-to-v4-migration

v3 到 v4 的迁移 · 本页

78339,490需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Phaser v3 to v4 Migration Guide

This guide covers everything you need to change when upgrading a Phaser v3 project to Phaser v4. It is organized from highest-impact changes to smaller details, so you can work through it top-to-bottom.

Related skills:../v4-new-features/SKILL.md,../game-setup-and-config/SKILL.md,../filters-and-postfx/SKILL.md


Table of Contents

  1. Renderer: Pipelines to Render Nodes
  2. Canvas Renderer Deprecated
  3. FX and Masks are now Filters
  4. Tint System
  5. Camera System
  6. Texture Coordinates and GL Orientation
  7. DynamicTexture and RenderTexture
  8. Shader API
  9. GLSL Loading
  10. Lighting
  11. TileSprite
  12. Graphics and Shape
  13. Geometry: Point Replaced by Vector2
  14. Math Constants
  15. Data Structures
  16. Round Pixels
  17. Removed Game Objects
  18. Removed Plugins and Entry Points
  19. Removed Utilities and Polyfills
  20. Spine Plugins
  21. Miscellaneous Breaking Changes
  22. Migration Checklist

1. Renderer: Pipelines to Render Nodes

Phaser v4 contains a brand-new WebGL renderer. The entire rendering pipeline from v3 has been replaced. This is the single biggest change in v4.

What was removed:

The v3 Pipeline system has been removed entirely. Pipelines frequently held multiple responsibilities (e.g. the Utility pipeline handled various different rendering tasks) and each had to manage WebGL state independently, leading to conflicts where one pipeline could break another's assumptions.

What replaced it:

The new RenderNode architecture. Each render node handles a single rendering task, making the system more maintainable. All render nodes have a run method, and some have a batch method to assemble state from several sources before invoking run.

What this means for you:

  • If your game only uses the standard Phaser API (Sprites, Text, Tilemaps, etc.), the new renderer should work transparently.
  • If you wrote custom WebGL pipelines in v3, they will need to be rewritten as render nodes. Use RenderConfig#renderNodes to register custom render nodes at boot.
  • If you accessed WebGLRenderer internals directly, be aware that many internal properties have been removed or restructured:

- WebGLRenderer.textureIndexes is removed. Use glTextureUnits.unitIndices instead. - WebGLRenderer#genericVertexBuffer and #genericVertexData are removed (freeing ~16MB RAM/VRAM). BatchHandler render nodes now create their own WebGL data buffers. - WebGLAttribLocationWrapper is removed.

  • Do not make direct WebGL gl calls in a Phaser v4 game. This can change the WebGL state without updating the internal WebGLGlobalWrapper, causing unpredictable behavior. If you need direct WebGL access, use an Extern game object, which resets state after it finishes.

2. Canvas Renderer Deprecated

The Canvas renderer is still available but should be considered deprecated. Canvas rendering does not support any of the WebGL techniques used in v4's advanced rendering features. As WebGL support is effectively baseline today, we recommend WebGL for all new projects.

Canvas retains one advantage: 27 blend modes vs WebGL's 4 native modes (NORMAL, ADD, MULTIPLY, SCREEN). In v4, the new Blend filter can recreate all Canvas blend modes in WebGL, though it requires indirection through a CaptureFrame, DynamicTexture, or similar.


3. FX and Masks are now Filters

This is one of the most impactful changes for v3 users who relied on the FX or Mask systems.

What changed:

FX (pre and post) and Masks have been unified into a single Filter system. A Filter takes an input image and produces an output image, usually via a single shader. All filters are mutually compatible.

Key differences from v3:

  • No more preFX/postFX distinction. Filters are divided into internal (affects just the object) and external (affects the object in its rendering context, usually the full screen) lists.
  • No more object restrictions. In v3, only certain objects supported FX. In v4, filters can be applied to any game object or scene camera, including Extern objects.
  • BitmapMask removed. Use the new Mask filter instead. GeometryMask remains available in Canvas only.

Removed derived FX and their replacements:

v3 FXv4 Replacement
BloomPhaser.Actions.AddEffectBloom()
ShinePhaser.Actions.AddEffectShine()
CirclePhaser.Actions.AddMaskShape()
GradientGradient game object

ColorMatrix change:

The ColorMatrix filter shifted its color management methods onto a colorMatrix property:

// v3
colorMatrix.sepia();

// v4
colorMatrix.colorMatrix.sepia();

Mask migration:

// v3 - BitmapMask
const mask = new Phaser.Display.Masks.BitmapMask(scene, maskObject);
sprite.setMask(mask);

// v4 - Mask filter
sprite.filters.internal.addMask(maskObject);

4. Tint System

The tint system has been overhauled with a new API and additional blend modes.

Removed:

  • tintFill property
  • setTintFill() method

Replacement:

  • Use the new tintMode property or setTintMode() method to control tint blending.
  • Phaser.TintModes enumerates the available modes: MULTIPLY, FILL, ADD, SCREEN, OVERLAY, HARD_LIGHT.

How to convert your code:

// v3
sprite.setTintFill(0xff0000);

// v4
sprite.setTint(0xff0000).setTintMode(Phaser.TintModes.FILL);

Other tint changes:

  • tint and setTint() now purely affect color settings. In v3, calling these would silently deactivate fill mode.
  • FILL mode now treats partial alpha correctly.
  • BitmapText tinting now works correctly.

5. Camera System

The camera matrix system has been rewritten. If you only use standard camera properties (scrollX, scrollY, zoom, rotation), your code should work without changes. However, if you access camera matrices directly, you must update your code.

What changed:

v3v4
Camera#matrix = position + rotation + zoomCamera#matrix = rotation + zoom + scroll (no position)
Scroll appended separatelyScroll is part of Camera#matrix
No equivalentCamera#matrixExternal = position only
No equivalentCamera#matrixCombined = matrix * matrixExternal

If you manipulated scroll factors manually:

// v3
spriteMatrix.e -= camera.scrollX * src.scrollFactorX;

// v4
TransformMatrix.copyWithScrollFactorFrom(matrix, scrollX, scrollY, scrollFactorX, scrollFactorY);

Other camera changes:

  • GetCalcMatrix() now takes an additional ignoreCameraPosition parameter.
  • GetCalcMatrixResults now includes a matrixExternal property.

6. Texture Coordinates and GL Orientation

Phaser v3 used top-left orientation for textures, which caused mismatches internally (framebuffers drawn upside-down, then flipped). Phaser v4 uses GL orientation throughout, where Y=0 is at the bottom.

Action required:

  • If you use compressed textures, they must be re-compressed with the Y axis starting at the bottom and increasing upwards. This is usually available as a "flip Y" option in your texture compression software.
  • Standard image textures (PNG, JPG, etc.) are handled automatically -- no action needed.
  • If you write custom shaders, note that texture coordinates now use GL conventions where Y=0 is at the bottom of the image.

7. DynamicTexture and RenderTexture

In v3, DynamicTexture allowed you to define batches and perform intricate drawing operations directly. In v4, many of these complex methods have been removed in favor of using the standard rendering system, which handles batching automatically.

Breaking change: DynamicTexture and RenderTexture must now call render() to execute all buffered drawing commands. Previously, draw commands were executed immediately.

New capabilities:

  • DynamicTexture#preserve() keeps the command buffer for reuse after rendering, allowing you to re-render commands that draw changing game objects.
  • DynamicTexture#callback() inserts a callback to run during command buffer execution.
  • DynamicTexture#capture renders game objects more accurately than draw, capturing the current camera view.
  • RenderTexture.renderMode property: "render" (draw like an Image), "redraw" (update texture during render loop without drawing), or "all" (both). The "redraw" mode enables updating textures mid-render-loop for same-frame shader outputs.
  • TextureManager#addDynamicTexture now has a forceEven parameter.

8. Shader API

The Shader game object has been significantly rewritten. Existing v3 shaders will need to be updated.

What changed:

  • The construction signature now takes a config object (ShaderQuadConfig) instead of individual parameters.
  • Shadertoy-style uniforms (resolution, time, etc.) are no longer set automatically. Encode them into your configuration if needed.
  • Texture coordinates now use GL conventions (Y=0 at bottom).
  • New Shader#setUniform(name, value) method for setting program uniforms individually.
  • New Shader#renderImmediate method for rendering outside the regular render loop.

9. GLSL Loading

The way Phaser loads GLSL code has changed:

  • GLSL code is no longer classified as "fragment" or "vertex" when loaded. Under the new system it could be either, or both. You load shaders separately and combine them when creating a Shader.
  • Custom templates have been replaced with #pragma preprocessor directives, which are valid GLSL and compatible with automated syntax checkers. The pragmas are removed before compilation.

10. Lighting

Lighting has been simplified and enhanced.

How to convert your code:

// v3 - Pipeline-based lighting
sprite.setPipeline('Light2D');

// v4 - Simple method call
sprite.setLighting(true);

Other lighting changes:

  • Lighting is available on many game objects: BitmapText, Blitter, Graphics, Shape, Image, Sprite, Particles, SpriteGPULayer, Stamp, Text, TileSprite, Video, TilemapLayer, and TilemapGPULayer.
  • Objects can now cast self-shadows using a shader that simulates shadows from surface features based on texture brightness. Configurable game-wide or per-object.
  • Lights now have a z value to set height explicitly, replacing the implicit height based on game resolution from v3.
  • Note: lighting changes the shader, which breaks render batches.
  • You can also use the ImageLight filter for image-based lighting, but it is separate from the core lighting system.

11. TileSprite

TileSprite has been internally rewritten to use a new shader that manually controls texture coordinate wrapping instead of relying on WebGL texture wrapping parameters.

What changed:

  • TileSprite no longer supports texture cropping.
  • TileSprite now assigns default dimensions to each dimension separately.

New capabilities:

  • TileSprite now supports texture frames within atlases and spritesheets (v3 could only repeat the entire texture file).
  • New tileRotation property allows rotating the repeating texture.
  • Works correctly with compressed textures, non-power-of-two textures, and DynamicTextures (all had issues in v3).

12. Graphics and Shape

  • Graphics has a new pathDetailThreshold property (also available as a game config option) that skips vertices within a certain distance of one another, improving performance on complex curves in small areas.
  • Grid shape has renamed properties: it now uses stroke instead of outline, matching the conventions of other Shape objects. Grid also has new controls for rendering gutters between cells and whether to draw outlines on the outside of the grid or just between cells.
  • Rectangle now supports rounded corners.

13. Geometry: Point Replaced by Vector2

The Geom.Point class and all related functions have been removed. Use Vector2 instead.

Quick reference for method replacements:

v3 (Point)v4 (Vector2 / Math)
Point.CeilVector2.ceil
Point.FloorVector2.floor
Point.CloneVector2.clone
Point.CopyFrom(src, dest)dest.copy(src)
Point.EqualsVector2.equals
Point.GetCentroidMath.GetCentroid
Point.GetMagnitudeVector2.length
Point.GetMagnitudeSqVector2.lengthSq
Point.InvertVector2.invert
Point.NegativeVector2.negate
Point.SetMagnitudeVector2.setLength
Point.ProjectVector2.project
Point.ProjectUnitVector2.projectUnit
Point.InterpolateMath.LinearXY
Point.GetRectangleFromPointsMath.GetVec2Bounds

All geometry classes now return Vector2 instead of Point:

The following classes and their static helper functions (getPoint, getPoints, getRandomPoint, CircumferencePoint, Random, etc.) all return Vector2 instances:

  • Geom.Circle
  • Geom.Ellipse
  • Geom.Line
  • Geom.Polygon
  • Geom.Rectangle
  • Geom.Triangle

If you have code that checks instanceof Phaser.Geom.Point, update it to check for Phaser.Math.Vector2.


14. Math Constants

v3v4Notes
Math.TAU (was PI / 2)Math.TAU (now PI * 2)Value changed! This is now the correct mathematical tau.
Math.PI2RemovedUse Math.TAU instead.
No equivalentMath.PI_OVER_2New constant for PI / 2 (what v3's TAU incorrectly was).

Action required: If you used Math.TAU in v3 expecting PI / 2, replace it with Math.PI_OVER_2. If you used Math.PI2, replace it with Math.TAU.


15. Data Structures

Phaser.Struct.Set has been replaced with a native JavaScript Set. Methods like iterateLocal are gone. Use standard Set methods (forEach, has, add, delete, etc.).

Phaser.Struct.Map has been replaced with a native JavaScript Map. Methods like contains and setAll are gone. Use standard Map methods (has, get, set, delete, etc.).


16. Round Pixels

The roundPixels game config option now defaults to false (it was true in v3). The behavior has also been refined:

  • roundPixels only operates when objects are axis-aligned and unscaled, preventing flicker on transforming objects.
  • For per-object control, use the new GameObject#vertexRoundMode property:

- "off" -- Never round. - "safe" -- Round only when the transform is position-only (no scale/rotation). - "safeAuto" (default) -- Like "safe", but only when the camera has roundPixels enabled. - "full" -- Always round (can cause wobble on rotated sprites, PS1-style). - "fullAuto" -- Like "full", but only when the camera has roundPixels enabled.

  • The TransformMatrix#setQuad roundPixels parameter has been removed.

17. Removed Game Objects

  • Mesh and Plane have been removed. These were limited 3D implementations; proper 3D support is planned for the future.

18. Removed Plugins and Entry Points

The following have been completely removed:

  • Camera3D Plugin
  • Layer3D Plugin
  • Facebook Plugin detection constants
  • phaser-ie9.js entry point (IE9 is no longer supported)

19. Removed Utilities and Polyfills

Create.GenerateTexture and all Create Palettes / the create folder have been removed. TextureManager.generate is also removed as a result.

Math.SinCosTableGenerator has been removed.

All legacy polyfills removed:

  • Array.forEach
  • Array.isArray
  • AudioContextMonkeyPatch
  • console
  • Math.trunc
  • performance.now
  • requestAnimationFrame
  • Uint32Array

Modern browsers provide all of these natively.


20. Spine Plugins

The Spine 3 and Spine 4 plugins bundled with Phaser are no longer updated. Use the official Phaser Spine plugin created by Esoteric Software instead.


21. Miscellaneous Breaking Changes

  • Shader#setTextures() now replaces the texture array rather than adding to it. If you were calling it multiple times to build up textures, call it once with the full array.
  • DOMElement now throws an error if it has no container. Ensure your DOM elements have a parent container.
  • GameObject#enableLighting can now be set even if the scene light manager is not enabled. The manager must still be enabled for lights to render, but the flag itself is no longer gated.
  • Gamepad Button class now accepts an isPressed parameter to initialize state correctly across scene transitions.
  • BatchHandlerConfig#createOwnVertexBuffer type property has been removed.
  • WebGLRenderer#genericVertexBuffer and #genericVertexData have been removed (freeing ~16MB RAM/VRAM).

Migration Checklist

Use this checklist to track your migration progress:

  • Update npm install phaser@4 (or equivalent)
  • Replace any custom WebGL pipelines with render nodes
  • Replace BitmapMask usage with the Mask filter
  • Replace removed FX (Bloom, Shine, Circle, Gradient) with their Action/GameObject equivalents
  • Update ColorMatrix calls (methods moved to .colorMatrix property)
  • Replace any setTintFill() calls with setTint().setTintMode(Phaser.TintModes.FILL)
  • Replace Geom.Point usage with Vector2
  • Update Math.TAU usage (now equals PI * 2, not PI / 2)
  • Replace Math.PI2 with Math.TAU
  • Replace Phaser.Struct.Set with native Set
  • Replace Phaser.Struct.Map with native Map
  • Add render() calls to DynamicTexture / RenderTexture usage
  • Re-compress any compressed textures for new Y-axis orientation
  • Update any direct Camera#matrix access to use the new matrix system
  • Update Shader game objects to use new ShaderQuadConfig constructor
  • Update GLSL loading code (no fragment/vertex classification, #pragma directives)
  • Replace sprite.setPipeline('Light2D') with sprite.setLighting(true)
  • Update light height code to use new z property
  • Remove any TileSprite texture cropping code
  • Update Grid shape code (outline properties renamed to stroke)
  • Remove any Mesh or Plane usage
  • Replace any Phaser-bundled Spine plugin usage with the official Esoteric Software plugin
  • Remove any reliance on Create.GenerateTexture or TextureManager.generate
  • Test roundPixels behavior (now defaults to false)
  • Remove any usage of removed polyfills, plugins, or entry points
  • Verify custom shader texture coordinates (Y=0 is now at bottom)

平台分布

Codex

36.65%
按下载量换算93

Claude

33.2%
按下载量换算84

Cursor

18.63%
按下载量换算47

Gemini CLI

9.35%
按下载量换算24

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills