Agent Skillsfanfan-de/anybox › web-game-foundations

web-game-foundations

GitHub

用于在实现前确立网页游戏架构,指导引擎选型、模拟与渲染分离、输入映射及资源管理等核心边界设计。

plugins/Anybox-Plugins/game-studio/skills/web-game-foundations/SKILL.md fanfan-de/anybox

Trigger Scenarios

未确定游戏引擎或渲染器时 需要定义模块边界和状态所有权时 多技能协作需统一架构框架时

Install

npx skills add fanfan-de/anybox --skill web-game-foundations -g -y
More Options

Non-standard path

npx skills add https://github.com/fanfan-de/anybox/tree/master/plugins/Anybox-Plugins/game-studio/skills/web-game-foundations -g -y

Use without installing

npx skills use fanfan-de/anybox@web-game-foundations

指定 Agent (Claude Code)

npx skills add fanfan-de/anybox --skill web-game-foundations -a claude-code -g -y

安装 repo 全部 skill

npx skills add fanfan-de/anybox --all -g -y

预览 repo 内 skill

npx skills add fanfan-de/anybox --list

SKILL.md

Frontmatter
{
    "name": "web-game-foundations",
    "description": "Set browser-game architecture before implementation. Use when the user needs engine choice, simulation and render boundaries, input model, asset organization, or save\/debug\/performance strategy."
}

Web Game Foundations

Overview

Use this skill to establish the non-negotiable architecture before implementation starts. Browser games degrade quickly when simulation, rendering, UI, asset loading, and input handling are mixed together.

Default rule: simulation state is owned outside the renderer, browser UI is not forced into the canvas unless there is a clear reason, and shipped 3D assets default to GLB or glTF 2.0 rather than ad hoc model formats.

Use This Skill When

  • the user has not settled the engine or renderer choice
  • the task is about boundaries, module shape, state ownership, or asset policy
  • multiple specialist skills need one shared architectural frame

Do Not Stay Here When

  • the runtime track is clearly Phaser
  • the runtime track is clearly vanilla Three.js
  • the runtime track is clearly React Three Fiber
  • the task is purely about shipped 3D assets

Once the stack is clear, hand off to the runtime or asset specialist skill.

Architecture Rules

  1. Separate simulation from rendering.
    • Simulation owns entities, turns, timers, collisions, progression, and saveable state.
    • The renderer owns scene composition, animation playback, camera, particles, and input plumbing.
  2. Keep input mapping explicit.
    • Define actions such as move, confirm, cancel, ability-1, and pause.
    • Map physical inputs to actions in one place.
  3. Treat asset loading as a first-class system.
    • Use stable manifest keys.
    • Group by domain: characters, environment, UI, audio, FX.
    • For 3D content, standardize on GLB or glTF 2.0 unless the chosen engine ecosystem requires another format upstream.
  4. Define save/debug/perf boundaries up front.
    • Save serializable simulation state, not renderer objects.
    • Keep debug overlays and perf probes easy to toggle.
  5. Use DOM overlays for menus and HUD by default.
    • Canvas or WebGL should handle the playfield.
    • DOM should handle text-heavy HUD, menus, settings, and accessibility-sensitive controls.
    • In 3D, keep the persistent UI budget small so the scene stays readable and interactive.
  6. Lock 3D runtime conventions early.
    • Choose consistent units, origins, pivots, and naming conventions.
    • Decide how collision proxies, LODs, and baked lighting data are authored before runtime integration starts.

Engine Selection

  • Default to Phaser for 2D games with sprites, tilemaps, top-down or side-view action, turn-based grids, and classic browser arcade flows.
  • Default to vanilla Three.js for explicit 3D scenes that want direct scene, camera, renderer, and loop control in plain TypeScript or Vite.
  • Default to React Three Fiber when the 3D scene lives inside a React application and needs declarative composition, shared app state, or React-first UI coordination.
  • Use raw WebGL only for shader-heavy or renderer-first projects where engine abstractions would get in the way.
  • Keep Babylon.js and PlayCanvas as alternative-engine paths rather than the default code-generation target.

See ../../references/engine-selection.md for the default decision table.

Implementation Checklist

Define these before writing core code:

  • Player fantasy and primary verbs
  • Core loop and loss or reset states
  • Camera model
  • Input action map
  • Simulation modules
  • Renderer modules
  • Asset manifest layout
  • 3D asset format and optimization rules
  • HUD and menu surfaces
  • Save data boundary
  • Debug and perf surfaces

Anti-Patterns

  • Mixing gameplay rules directly into scene callbacks
  • Treating the renderer as the source of truth for game state
  • Putting all HUD and menu UI into the canvas by default
  • Letting asset filenames become the public API instead of manifest keys
  • Shipping unoptimized 3D assets straight from the DCC tool into the browser
  • Mixing camera-control state and menu or modal state without an explicit input boundary
  • Rebuilding architecture every time the game changes genre

References

  • Engine selection: ../../references/engine-selection.md
  • Phaser structure: ../../references/phaser-architecture.md
  • Three.js structure: ../../references/three-webgl-architecture.md
  • Three.js ecosystem stack: ../../references/threejs-stack.md
  • React Three Fiber stack: ../../references/react-three-fiber-stack.md
  • 3D asset shipping: ../../references/web-3d-asset-pipeline.md

Version History

  • 08dc189 Current 2026-07-05 18:59

Same Skill Collection

.agents/skills/anybox-frontend-guidelines/SKILL.md
.agents/skills/anybox-mobile-release/SKILL.md
.agents/skills/anybox-plugin/SKILL.md
.agents/skills/deploy-anybox-tencent-docker-windows/SKILL.md
.agents/skills/deploy-anybox-tencent-server/SKILL.md
.agents/skills/fanfande-frontend-style/SKILL.md
.agents/skills/fanfande-plugin-structure/SKILL.md
.agents/skills/frontend-ui-style-kit/SKILL.md
.agents/skills/obsidian-like/SKILL.md
.agents/skills/pdf/SKILL.md
.agents/skills/transcribe/SKILL.md
.agents/skills/zhihu-md-publisher/SKILL.md
.anybox/skills/anybox-plugin-development/SKILL.md
.anybox/skills/anybox-start-dev/SKILL.md
packages/chrome-plugin/runtime/skills/chrome/SKILL.md
plugins/Anybox-Plugins/anybox-plugin-development/skills/anybox-plugin-development/SKILL.md
plugins/Anybox-Plugins/atlassian-rovo/skills/capture-tasks-from-meeting-notes/SKILL.md
plugins/Anybox-Plugins/atlassian-rovo/skills/generate-status-report/SKILL.md
plugins/Anybox-Plugins/box/skills/box/SKILL.md
plugins/Anybox-Plugins/browser/skills/browser/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-app-intents/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-debugger-agent/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-ettrace-performance/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-memgraph-leaks/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-simulator-browser/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-liquid-glass/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-performance-audit/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-ui-patterns/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-view-refactor/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/appkit-interop/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/build-run-debug/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/liquid-glass/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/packaging-notarization/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/signing-entitlements/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/swiftpm-macos/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/swiftui-patterns/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/telemetry/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/test-triage/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/view-refactor/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/window-management/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/frontend-app-builder/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/frontend-testing-debugging/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/react-best-practices/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/shadcn-best-practices/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/supabase-best-practices/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-branded-presentation/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-resize-for-all-social-media/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-translate-design/SKILL.md
plugins/Anybox-Plugins/chrome/skills/chrome/SKILL.md
plugins/Anybox-Plugins/cinema/skills/initialize-cinema-project/SKILL.md

Metadata

Files
0
Version
de06d03
Hash
ef35c195
Indexed
2026-07-05 18:59

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-09 03:21
浙ICP备14020137号-1 $Carte des visiteurs$