Phaser is a robust, open-source HTML5 game framework designed for creating 2D games across desktop and mobile web browsers, currently stable at version 4.0.0. It leverages WebGL and Canvas rendering and has been under active development for over a decade. Version 4 represents a significant, ground-up rebuild of its WebGL renderer, featuring a new, node-based architecture that replaces the v3 pipeline system for enhanced performance and reliability, while striving to maintain a familiar API for developers. The framework offers an extensive suite of features for 2D game development, including advanced physics engines, sophisticated tweening systems, and web audio management. It supports development using both JavaScript and TypeScript and is compatible with various modern front-end frameworks. The project is commercially developed and maintained by Phaser Studio Inc. with strong community contributions, adhering to a release cadence that includes extensive pre-release candidates for major versions, ensuring a stable and well-tested core.
npm install phaserVerified import paths — ran on the pinned version, not inferred.
This code sets up a minimal Phaser 4 game with a single scene, displaying a text object and animating a circle using tweens.
Review and refactor any custom render logic, shaders, and pipeline interactions. The new architecture manages WebGL state more explicitly; consult the v4 documentation for migration guidance.
Always use `phaser.min.js` (approximately 345 KB gzipped) or a custom build with unneeded features excluded for production environments to optimize bundle size.
Ensure all textures intended for `REPEAT` wrapping have dimensions that are powers of two. Utilize `Texture#setWrap()` for explicit control over texture wrap modes and consult browser console for WebGL warnings.
Adopt an ES Module-first development workflow. Use `import Phaser from 'phaser';` and ensure your project's build system (e.g., Vite, Webpack, Rollup) is correctly configured for ESM.
Profile game performance on target devices, particularly in scenes heavy with filters or masks. Adjust filter usage or settings if any unexpected performance changes (positive or negative) are observed.
If using a CDN, ensure the `<script>` tag for `phaser.min.js` is correctly placed in your HTML and loaded before your game code. If using modules, ensure `import Phaser from 'phaser';` is present at the top of your module file.
Access core classes and namespaces as properties of the default `Phaser` import: `class MyScene extends Phaser.Scene { ... }` or `const game = new Phaser.Game(...)`.Run `npm install phaser` or `yarn add phaser` to ensure the package is installed. Verify your `tsconfig.json` (for TypeScript) or build tool configuration correctly handles module resolution for ES Modules. If migrating, ensure all `require()` calls are updated to `import` statements.
Carefully review any custom shaders and direct WebGL interactions. Ensure shader uniform types and values match expectations. Refer to the Phaser v4 documentation on the new Render Node Architecture and `Shader#setUniform()` for correct usage and state management.
No dependency data recorded yet.