Phaser
Fast, free HTML5 game framework for building 2D games for desktop and mobile.
3. Used by agents' projects
Dependency in 12 public GitHub projects set up for AI coding agents that we scanned (0.2%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Phaser does
Phaser is a web-first, 2D-only game framework that ships AI agent skills in its own repository, including one written to port Phaser 3 games to Phaser 4's rewritten WebGL renderer.
Phaser popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Phaser is used
- Phaser is a dependency in 12 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 603 projects, and what it is used with below comes from all of them.
- Projects that use it most often also use Vite (45.6%), webpack (24.4%), webpack CLI (20.9%).
By coding agent
Often used with
Phaser in practice
Strengths
The repository has a <code>skills/</code> folder for coding agents. The README says it covers scenes, physics, input, animations, tilemaps, tweens, particles, cameras and more. A separate v3-to-v4 migration skill is meant to guide an agent through porting an old game.
The README says <code>phaser.js</code> is over 8 MB because of inline JSDoc. The full minified build, <code>phaser.min.js</code>, is listed at 345 KB gzipped, and <code>phaser-arcade.min.js</code> at 313 KB. The README says build settings can exclude features to shrink it further.
Phaser 4 adds <code>SpriteGPULayer</code>. The maintainers say it handles "a million or more" sprites, "up to 100x faster" than standard rendering. Each member can animate position, rotation, scale, alpha, tint and frame on the GPU.
<code>TilemapGPULayer</code> draws a whole tilemap layer as a single quad. The README says it can show up to 4096 x 4096 tiles with no penalty for tile count, and that texture filtering has no seams across tile boundaries.
Watch out for
The getting-started tutorial says Phaser is a 2D framework. It says 3D needs third-party libraries, and that the documentation and examples reflect 2D.
The tutorial says you cannot simply drag the HTML file into a browser. Files opened that way use <code>file://</code>, which it calls "massively restricted". A game has to load images, audio and JSON.
The README says iOS, Android, Steam and native apps are reached "using 3rd party tools". Phaser itself builds for the browser.
Scaffold a new Phaser game
npm create @phaserjs/game@latest
npx @phaserjs/create-game@latest
yarn create @phaserjs/game
pnpm create @phaserjs/game@latest
bun create @phaserjs/game@latestMore about Phaser
Funding
- Patreon: https://patreon.com/photonstorm
- Own page: https://phaser.io/community/donate
Agent Skills for it
- phaser-arcade-physics: Phaser 4 Arcade Physics movement and collision: bodies, velocity, gravity, colliders vs overlaps, groups and bullet pools. Use for a Phaser
Packages around it
- webpack: Bundler
- webpack-cli: webpack command line
- webpack-dev-server: webpack dev server
- vite: Bundler and dev server
- html-webpack-plugin: HTML output for webpack
- @babel: JavaScript compiler
Alternatives
Phaser This page
Get started
Install it.
npm install phaserRules for your agent
## Phaser
- Install with `npm install phaser` and import with `import Phaser from 'phaser';`. In TypeScript, add `"typeRoots": ["./node_modules/phaser/types"]` and `"types": ["Phaser"]` to `tsconfig.json` if the editor does not detect the definitions.
- For new projects, scaffold with `npm create @phaserjs/game@latest`. For first-time users, the docs recommend the options Web Bundler and then Vite.
- When porting Phaser 3 code, use the `v3-to-v4-migration` skill and the Migration Guide. Do not use the removed classes `Point`, `Mesh` and `BitmapMask`. FX and Masks are now Filters.
- In v4, enable lighting with `sprite.setLighting(true)` and set tint behaviour with `setTintMode()`.
- Serve the game over `http://` from a local web server during development. Do not open the HTML via `file://`.
- Keep features 2D. Phaser has no built-in 3D rendering or 3D physics.
- For very large sprite counts use `SpriteGPULayer`. For large tilemaps use `TilemapGPULayer`.