v3-to-v4-migration
Use this skill when migrating a Phaser 3 project to Phaser 4, or when a user asks about breaking changes, API differences, or how to update their v3 code. Covers renderer changes (pipelines to render nodes), FX/masks to filters, tint system, camera matrix, texture coordinates, DynamicTexture, shaders, lighting, removed game objects, and a full migration checklist. Triggers on: migrate, upgrade, v3 to v4, breaking changes, Phaser 3 to 4, migration guide, update from v3.
What this skill does
# 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](#1-renderer-pipelines-to-render-nodes) 2. [Canvas Renderer Deprecated](#2-canvas-renderer-deprecated) 3. [FX and Masks are now Filters](#3-fx-and-masks-are-now-filters) 4. [Tint System](#4-tint-system) 5. [Camera System](#5-camera-system) 6. [Texture Coordinates and GL Orientation](#6-texture-coordinates-and-gl-orientation) 7. [DynamicTexture and RenderTexture](#7-dynamictexture-and-rendertexture) 8. [Shader API](#8-shader-api) 9. [GLSL Loading](#9-glsl-loading) 10. [Lighting](#10-lighting) 11. [TileSprite](#11-tilesprite) 12. [Graphics and Shape](#12-graphics-and-shape) 13. [Geometry: Point Replaced by Vector2](#13-geometry-point-replaced-by-vector2) 14. [Math Constants](#14-math-constants) 15. [Data Structures](#15-data-structures) 16. [Round Pixels](#16-round-pixels) 17. [Removed Game Objects](#17-removed-game-objects) 18. [Removed Plugins and Entry Points](#18-removed-plugins-and-entry-points) 19. [Removed Utilities and Polyfills](#19-removed-utilities-and-polyfills) 20. [Spine Plugins](#20-spine-plugins) 21. [Miscellaneous Breaking Changes](#21-miscellaneous-breaking-changes) 22. [Migration Checklist](#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 FX | v4 Replacement | |---|---| | `Bloom` | `Phaser.Actions.AddEffectBloom()` | | `Shine` | `Phaser.Actions.AddEffectShine()` | | `Circle` | `Phaser.Actions.AddMaskShape()` | | `Gradient` | `Gradient` game object | **ColorMatrix change:** The `ColorMatrix` filter shifted its color management methods onto a `colorMatrix` property: ```js // v3 colorMatrix.sepia(); // v4 colorMatrix.colorMatrix.sepia(); ``` **Mask migration:** ```js // 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:** ```js // 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:** | v3 | v4 | |---|---| | `Camera#matrix` = position + rotation + zoom | `Camera#matrix` = rotation + zoom + scroll (no position) | | Scroll appended separately | Scroll is part of `Camera#matrix` | | No equivalent | `Camera#matrixExternal` = position only | | No equivalent | `Camera#matrixCombined` = `matrix` * `matrixExternal` | **If you manipulated scroll factors manually:** ```js // 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 b
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.