Token导航 LogoToken导航

Agent Skill · 待分类

game-setup-and-config(游戏设置和配置)

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

game-setup-and-config 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 3,070。

总安装 1,176周安装 50GitHub Stars 39,483下载 412核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/phaserjs/phaser --skill game-setup-and-config

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

用于处理 GitHub 仓库、Issue 和代码协作信息。适合在 Codex、Claude 等宿主中围绕代码变更进行整理。可结合来源仓库和 README 进一步核验具体功能。安装前建议确认权限范围和维护状态。game-setup-and-config 属于待分类类 Skill,可作为该场景下的辅助能力补充。

注意检查是否会触发命令执行或文件读写操作。

来源仓库内路径:skills/game-setup-and-config

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

game-setup-and-config 怎么安装?

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

game-setup-and-config 支持哪些 AI 工具?

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

game-setup-and-config 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

game-setup-and-config 是免费的吗?

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

game-setup-and-config 用的人多吗?

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

game-setup-and-config 安全吗?

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

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

值得选的地方

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

先想清楚的地方

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

适不适合你

更适合

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

不太适合

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

待分类类 Skill 对比

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

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
game-setup-and-config

游戏设置和配置 · 本页

1,17639,483操作浏览器未明确通过

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

SKILL.md 原文

Game Setup and Config

How to create a Phaser.Game instance with the right GameConfig options for renderer, scaling, pixel art, FPS, and canvas placement.

Key source paths: src/core/Game.js, src/core/Config.js, src/core/typedefs/GameConfig.js, src/const.js, src/scale/const/ Related skills:../scenes/SKILL.md,../loading-assets/SKILL.md,../scale-and-responsive/SKILL.md

Quick Start

The simplest possible Phaser 4 game -- a single scene with the default 1024×768 canvas:

class MyScene extends Phaser.Scene {
    preload() {
        this.load.image('logo', 'assets/logo.png');
    }

    create() {
        this.add.image(400, 300, 'logo');
    }
}

const config = {
    type: Phaser.AUTO,
    scene: MyScene
};

const game = new Phaser.Game(config);

new Phaser.Game(config) triggers the entire boot sequence: config parsing (Config), renderer creation, DOM insertion, and the game loop (TimeStep). The game waits for DOMContentLoaded before booting.

Core Concepts

Boot Sequence (src/core/Game.js)

  1. new Phaser.Game(config) -- parses config into a Phaser.Core.Config instance.
  2. Creates global managers: AnimationManager, TextureManager, CacheManager, InputManager, SceneManager, ScaleManager, SoundManager, TimeStep, PluginManager.
  3. Waits for DOMContentLoaded, then calls boot().
  4. boot() creates the renderer (CreateRenderer), adds the canvas to the DOM (AddToDOM), prints the debug header, emits BOOT.
  5. Once textures are ready (TextureManager emits READY), emits READY then calls start().
  6. start() begins the TimeStep loop, sets up the VisibilityHandler, calls config.postBoot.

Config Parsing (src/core/Config.js)

The Config constructor reads a flat GameConfig object and resolves defaults. Some properties can be specified at top level OR nested inside sub-objects (e.g., width can be top-level or under scale.width). The scale sub-object takes priority when both are present.

Render properties can likewise be top-level shortcuts (e.g., pixelArt: true) or nested under render.

Renderer Constants (src/const.js)

ConstantValueBehavior
Phaser.AUTO0WebGL if supported, else falls back to Canvas
Phaser.CANVAS1Force Canvas renderer
Phaser.WEBGL2Force WebGL -- no fallback if unsupported
Phaser.HEADLESS3No renderer -- DOM still required. For unit testing only

Set via config.type. Default is Phaser.AUTO.

Common Patterns

Pixel Art Game

When pixelArt is true, Config automatically sets antialias: false, antialiasGL: false, and roundPixels: true.

const config = {
    type: Phaser.AUTO,
    width: 320,
    height: 240,
    pixelArt: true,
    scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        zoom: Phaser.Scale.ZOOM_2X
    },
    scene: MyScene
};

Smooth Pixel Art (WebGL only)

Preserves blocky pixels but smooths edges between them when scaled up:

const config = {
    type: Phaser.WEBGL,
    width: 320,
    height: 240,
    smoothPixelArt: true,
    scene: MyScene
};

When smoothPixelArt is true, Config sets antialias: true, antialiasGL: true, and pixelArt: false.

Full-Window Responsive Game

const config = {
    type: Phaser.AUTO,
    scale: {
        mode: Phaser.Scale.RESIZE,
        parent: 'game-container',
        width: '100%',
        height: '100%'
    },
    scene: MyScene
};

Fixed Aspect Ratio with FIT

const config = {
    type: Phaser.AUTO,
    scale: {
        mode: Phaser.Scale.FIT,
        parent: 'game-container',
        autoCenter: Phaser.Scale.CENTER_BOTH,
        width: 1280,
        height: 720,
        min: { width: 640, height: 360 },
        max: { width: 1920, height: 1080 }
    },
    backgroundColor: '#2d2d2d',
    scene: MyScene
};

Custom FPS Limit

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    fps: {
        target: 60,
        limit: 30,
        forceSetTimeOut: false,
        smoothStep: true
    },
    scene: MyScene
};

Transparent Canvas Over HTML

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    transparent: true,
    parent: 'game-container',
    scene: MyScene
};

When transparent is true, backgroundColor is forced to 0x000000 with alpha 0.

Pre-existing Canvas Element

const canvas = document.getElementById('my-canvas');

const config = {
    type: Phaser.WEBGL,
    canvas: canvas,
    width: 800,
    height: 600,
    scene: MyScene
};

Multiple Scenes

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    scene: [BootScene, PreloadScene, MenuScene, GameScene],
    physics: {
        default: 'arcade',
        arcade: { gravity: { y: 300 } }
    }
};

Only the first scene starts automatically. Others start only if they have {active: true} in their scene config. See../scenes/SKILL.md.

Boot Callbacks

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    callbacks: {
        preBoot: function (game) {
            // Runs before Phaser boots. Game systems not yet available.
        },
        postBoot: function (game) {
            // Runs after boot. All systems ready, game loop starting.
        }
    },
    scene: MyScene
};

Disabling Input Subsystems

const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    input: {
        keyboard: true,
        mouse: true,
        touch: false,
        gamepad: false,
        activePointers: 1,
        windowEvents: true
    },
    disableContextMenu: true,
    scene: MyScene
};

Configuration Reference

Top-Level GameConfig Properties

PropertyTypeDefaultDescription
typenumberPhaser.AUTO (0)Renderer: AUTO, CANVAS, WEBGL, or HEADLESS
width`number\string`1024Game width in pixels (or '100%'). Overridden by scale.width
height`number\string`768Game height in pixels (or '100%'). Overridden by scale.height
zoomnumber1Canvas zoom multiplier. Overridden by scale.zoom
parent`HTMLElement\string\null`undefinedDOM element or id for canvas. undefined = document body. null = no parent
canvasHTMLCanvasElementnullProvide your own canvas element
context`CanvasRenderingContext2D\WebGLRenderingContext`nullProvide your own rendering context
canvasStylestringnullCSS styles applied to the canvas element
customEnvironmentbooleanfalseSkip feature detection for non-browser environments. renderType cannot be AUTO if true
scene`SceneType\SceneType[]`nullScene class (extends Phaser.Scene) or array of scene classes
seedstring[][random]Seed for Phaser.Math.RND
titlestring''Game title shown in console banner
urlstring'https://phaser.io/...'Game URL shown in console banner
versionstring''Game version shown in console banner
autoFocusbooleantrueAuto-focus window on boot and mousedown
stableSort`number\boolean`-1-1 = auto-detect, 0/false = built-in stable sort, 1/true = rely on native ES2019 sort
disableContextMenubooleanfalseDisable right-click context menu
backgroundColor`string\number`0x000000Canvas background color. Accepts hex number, CSS string, or color object
banner`boolean\BannerConfig`(shown)false to hide console banner entirely

scale (Phaser.Types.Core.ScaleConfig)

PropertyTypeDefaultDescription
width`number\string`1024Base game width
height`number\string`768Base game height
zoomnumber1Zoom multiplier. Use constants: NO_ZOOM (1), ZOOM_2X (2), ZOOM_4X (4), MAX_ZOOM (-1)
parent`HTMLElement\string`undefinedDOM parent for the canvas
modenumberPhaser.Scale.NONE (0)Scale mode (see table below)
expandParentbooleantrueAllow adjusting parent CSS height to 100%
autoRoundbooleanfalseRound display/style sizes for performance
autoCenternumberNO_CENTER (0)Canvas centering mode (see table below)
resizeIntervalnumber500Milliseconds between browser size checks
fullscreenTarget`HTMLElement\string`nullElement for fullscreen mode
min{width, height}{0, 0}Minimum canvas dimensions
max{width, height}{0, 0}Maximum canvas dimensions (0 = no limit)
snap{width, height}{0, 0}Snap canvas size to multiples

Scale Modes (src/scale/const/SCALE_MODE_CONST.js)

ConstantValueBehavior
Phaser.Scale.NONE0No scaling. Canvas stays at config size
Phaser.Scale.WIDTH_CONTROLS_HEIGHT1Height adjusts based on width
Phaser.Scale.HEIGHT_CONTROLS_WIDTH2Width adjusts based on height
Phaser.Scale.FIT3Fit inside parent keeping aspect ratio (letterboxing)
Phaser.Scale.ENVELOP4Cover parent keeping aspect ratio (may overflow)
Phaser.Scale.RESIZE5Canvas resizes to fill parent, ignoring aspect ratio
Phaser.Scale.EXPAND6Like RESIZE for visible area + FIT for canvas scale

Center Modes (src/scale/const/CENTER_CONST.js)

ConstantValue
Phaser.Scale.NO_CENTER0
Phaser.Scale.CENTER_BOTH1
Phaser.Scale.CENTER_HORIZONTALLY2
Phaser.Scale.CENTER_VERTICALLY3

Zoom Constants (src/scale/const/ZOOM_CONST.js)

ConstantValueBehavior
Phaser.Scale.NO_ZOOM1No zoom
Phaser.Scale.ZOOM_2X22x zoom
Phaser.Scale.ZOOM_4X44x zoom
Phaser.Scale.MAX_ZOOM-1Max integer zoom that fits in parent

render (Phaser.Types.Core.RenderConfig)

These can be set at the top level OR nested under render. The render sub-object takes priority.

PropertyTypeDefaultDescription
antialiasbooleantrueLinear interpolation for scaled/rotated textures
antialiasGLbooleantrueAntialias on WebGL context creation
pixelArtbooleanfalseSets antialias: false, roundPixels: true automatically
smoothPixelArtbooleanfalseWebGL only. Blocky pixels with smooth edges
roundPixelsbooleanfalseSnap texture-based objects to integer positions
transparentbooleanfalseTransparent canvas background
clearBeforeRenderbooleantrueClear canvas each frame
preserveDrawingBufferbooleanfalsePreserve WebGL buffers between frames
premultipliedAlphabooleantruePre-multiplied alpha in WebGL drawing buffer
desynchronizedbooleanfalseDesynchronized rendering context
failIfMajorPerformanceCaveatbooleanfalseAbort WebGL if browser reports poor performance
powerPreferencestring'default''high-performance', 'low-power', or 'default'
batchSizenumber16384Max quads per WebGL batch
maxTexturesnumber-1Max GPU textures. -1 = use all available
maxLightsnumber10Max lights visible per camera
autoMobileTexturesbooleantrueRestrict to 1 texture per batch on iOS/Android
selfShadowbooleanfalseSelf-shadowing on lit textured objects
pathDetailThresholdnumber1Point-combining threshold for Graphics WebGL paths
skipUnreadyShadersbooleanfalseSkip drawing objects whose shader is still compiling
mipmapFilterstring''Mipmap filter: 'NEAREST', 'LINEAR', 'NEAREST_MIPMAP_NEAREST', etc.
renderNodesobject{}Custom render nodes for WebGL renderer

fps (Phaser.Types.Core.FPSConfig)

PropertyTypeDefaultDescription
minnumber5Minimum acceptable FPS
targetnumber60Target FPS (informational, does not enforce)
limitnumber0Enforce max FPS. 0 = no limit
forceSetTimeOutbooleanfalseUse setTimeout instead of requestAnimationFrame
deltaHistorynumber10Frames to average for delta smoothing
panicMaxnumber120Frames before trusting delta again after a panic
smoothStepbooleantrueApply delta smoothing

Other Sub-Configs

Sub-Config KeyTypeSource
callbacksCallbacksConfigsrc/core/typedefs/CallbacksConfig.js
domDOMContainerConfigsrc/core/typedefs/DOMContainerConfig.js
inputInputConfigsrc/core/typedefs/InputConfig.js
loaderLoaderConfigsrc/core/typedefs/LoaderConfig.js
physicsPhysicsConfigsrc/core/typedefs/PhysicsConfig.js
plugins`PluginObject\PluginObjectItem[]`src/core/typedefs/PluginObject.js
audioAudioConfigsrc/core/typedefs/AudioConfig.js
imagesImagesConfigsrc/core/typedefs/ImagesConfig.js

Game Lifecycle, Pause/Resume, and Destroy

Game Lifecycle Events

Listen on game.events (or this.game.events from a Scene) for visibility and focus changes:

game.events.on('blur', () => { /* tab lost focus */ });
game.events.on('focus', () => { /* tab regained focus */ });
game.events.on('hidden', () => { /* Page Visibility API: page hidden */ });
game.events.on('visible', () => { /* Page Visibility API: page visible */ });
game.events.on('pause', () => { /* game.pause() was called */ });
game.events.on('resume', () => { /* game.resume() was called */ });

Use named constants: Phaser.Core.Events.BLUR, FOCUS, HIDDEN, VISIBLE, PAUSE, RESUME.

Pause and Resume

// Pause the entire game loop (rendering and updates stop)
game.pause();

// Resume the game loop
game.resume();

// Check if the game is currently paused
if (game.isPaused) {
    // game loop is not running
}

Destroying the Game

// Remove the canvas from the DOM and clean up
game.destroy(true);

// Full cleanup -- pass noReturn=true if you will NEVER create another Phaser instance
// This allows the framework to release additional internal references
game.destroy(true, true);

destroy(removeCanvas, noReturn) is asynchronous -- it flags the game for destruction on the next frame. Listen for Phaser.Core.Events.DESTROY to react to completion.

Global Game Members

The Game instance exposes key managers as properties, accessible from any Scene via this.game:

PropertyTypeDescription
game.configPhaser.Core.ConfigParsed GameConfig (read-only after boot)
game.sceneSceneManagerStart, stop, switch, and manage all scenes
game.registryDataManagerShared data store across all scenes
game.animsAnimationManagerGlobal animation definitions
game.cacheCacheManagerStores loaded non-texture assets (JSON, XML, etc.)
game.texturesTextureManagerStores all loaded textures and sprite sheets
game.soundSoundManagerGlobal sound playback manager
// Example: access the registry from any scene
this.game.registry.set('highScore', 9999);

// Example: access the scene manager
this.game.scene.start('MenuScene');

Gotchas and Common Mistakes

  1. scale vs top-level config. width, height, zoom, and parent can be set at the top level or inside scale. The scale sub-object values take priority. Avoid setting both to prevent confusion.
  2. Phaser.WEBGL has no fallback. Unlike AUTO, using Phaser.WEBGL directly will not fall back to Canvas if WebGL is unavailable. The game will fail silently.
  3. parent: null vs parent: undefined. undefined (or omitted) appends the canvas to document.body. null means Phaser will not add the canvas to the DOM at all -- you must do it yourself.
  4. transparent overrides backgroundColor. When transparent: true, the background color is forced to rgba(0,0,0,0) regardless of what you set.
  5. fps.target does not enforce frame rate. It is advisory only. Use fps.limit to actually cap the frame rate. The browser's display refresh rate is always the upper bound.
  6. fps.limit only slows down, never speeds up. Setting limit: 120 on a 60Hz display still results in 60 FPS.
  7. DOM Container requires a parent. Setting dom.createContainer: true without providing a parent element will not work.
  8. smoothPixelArt is WebGL-only. It has no effect with the Canvas renderer.
  9. window.FORCE_WEBGL and window.FORCE_CANVAS. Config.js checks for these globals at the end of parsing and will override the type setting. This is intended for development/testing.
  10. Game.destroy() is asynchronous. It flags the game for destruction on the next frame. Listen for the DESTROY event to react to completion. Pass noReturn: true only if you will never create another Phaser instance on the same page.

v4 Changes from v3

  • Default dimensions changed: Width defaults to 1024 (was 800), height to 768 (was 600).
  • EXPAND scale mode added: Phaser.Scale.EXPAND (value 6) is new -- combines RESIZE visible area behavior with FIT canvas scaling.
  • Loader maxRetries default: loader.maxRetries defaults to 2 (was 0 in early v3).
  • smoothPixelArt option: New WebGL-only rendering mode that smooths edges between blocky pixels.
  • renderNodes config: New render.renderNodes property for custom WebGL render node registration.
  • skipUnreadyShaders: New option for parallel shader compilation to prevent stutter.
  • pathDetailThreshold: New config for Graphics WebGL path point combining.

Source File Map

ConceptFile
Game class / boot sequencesrc/core/Game.js
Config parsing / all defaultssrc/core/Config.js
GameConfig typedefsrc/core/typedefs/GameConfig.js
Renderer constants (AUTO, WEBGL, CANVAS, HEADLESS)src/const.js
FPSConfig typedefsrc/core/typedefs/FPSConfig.js
RenderConfig typedefsrc/core/typedefs/RenderConfig.js
ScaleConfig typedefsrc/core/typedefs/ScaleConfig.js
Scale mode constantssrc/scale/const/SCALE_MODE_CONST.js
Center constantssrc/scale/const/CENTER_CONST.js
Zoom constantssrc/scale/const/ZOOM_CONST.js
TimeStep (game loop)src/core/TimeStep.js
Renderer creationsrc/core/CreateRenderer.js
ScaleManagersrc/scale/ScaleManager.js
CallbacksConfig typedefsrc/core/typedefs/CallbacksConfig.js
DOMContainerConfig typedefsrc/core/typedefs/DOMContainerConfig.js
InputConfig typedefsrc/core/typedefs/InputConfig.js
LoaderConfig typedefsrc/core/typedefs/LoaderConfig.js
All core typedefssrc/core/typedefs/

平台分布

Codex

34.58%
按下载量换算142

Claude

29.44%
按下载量换算121

Cursor

18.74%
按下载量换算77

Gemini CLI

8.3%
按下载量换算34

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

继续浏览同类 Skills