@mclawnet/agent 0.6.20 → 0.6.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/cli.js +63 -0
  2. package/dist/__tests__/checkpoint.test.d.ts +2 -0
  3. package/dist/__tests__/checkpoint.test.d.ts.map +1 -0
  4. package/dist/__tests__/fs-handler-decode.test.d.ts +2 -0
  5. package/dist/__tests__/fs-handler-decode.test.d.ts.map +1 -0
  6. package/dist/__tests__/idle-sweeper.test.d.ts +2 -0
  7. package/dist/__tests__/idle-sweeper.test.d.ts.map +1 -0
  8. package/dist/__tests__/mcp-config.test.d.ts +2 -0
  9. package/dist/__tests__/mcp-config.test.d.ts.map +1 -0
  10. package/dist/__tests__/schedule-runtime-spawn.test.d.ts +2 -0
  11. package/dist/__tests__/schedule-runtime-spawn.test.d.ts.map +1 -0
  12. package/dist/__tests__/schedule-runtime.test.d.ts +2 -0
  13. package/dist/__tests__/schedule-runtime.test.d.ts.map +1 -0
  14. package/dist/__tests__/session-limit.test.d.ts +2 -0
  15. package/dist/__tests__/session-limit.test.d.ts.map +1 -0
  16. package/dist/__tests__/swarm-cli-client.test.d.ts +2 -0
  17. package/dist/__tests__/swarm-cli-client.test.d.ts.map +1 -0
  18. package/dist/__tests__/swarm-control-dispatch.test.d.ts +2 -0
  19. package/dist/__tests__/swarm-control-dispatch.test.d.ts.map +1 -0
  20. package/dist/__tests__/swarm-session-bridge.test.d.ts +2 -0
  21. package/dist/__tests__/swarm-session-bridge.test.d.ts.map +1 -0
  22. package/dist/backend-adapter.d.ts +43 -0
  23. package/dist/backend-adapter.d.ts.map +1 -1
  24. package/dist/checkpoint.d.ts +67 -0
  25. package/dist/checkpoint.d.ts.map +1 -0
  26. package/dist/{chunk-RIK7IXSW.js → chunk-WJWCYGLQ.js} +1130 -147
  27. package/dist/chunk-WJWCYGLQ.js.map +1 -0
  28. package/dist/errors.d.ts +40 -0
  29. package/dist/errors.d.ts.map +1 -0
  30. package/dist/fs-handler.d.ts.map +1 -1
  31. package/dist/hub-connection.d.ts +13 -0
  32. package/dist/hub-connection.d.ts.map +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/schedule-runtime.d.ts +125 -0
  35. package/dist/schedule-runtime.d.ts.map +1 -0
  36. package/dist/session-manager.d.ts +102 -0
  37. package/dist/session-manager.d.ts.map +1 -1
  38. package/dist/skill-loader.d.ts +20 -0
  39. package/dist/skill-loader.d.ts.map +1 -1
  40. package/dist/start.d.ts +2 -0
  41. package/dist/start.d.ts.map +1 -1
  42. package/dist/start.js +1 -1
  43. package/dist/swarm-cli-client.d.ts +24 -0
  44. package/dist/swarm-cli-client.d.ts.map +1 -0
  45. package/dist/swarm-cli-client.js +83 -0
  46. package/dist/swarm-cli-client.js.map +1 -0
  47. package/dist/swarm-control-dispatch.d.ts +47 -0
  48. package/dist/swarm-control-dispatch.d.ts.map +1 -0
  49. package/dist/swarm-session-bridge.d.ts +22 -0
  50. package/dist/swarm-session-bridge.d.ts.map +1 -0
  51. package/package.json +6 -4
  52. package/skills/cocos-creator-3x-cn/SKILL.md +475 -0
  53. package/skills/cocos-creator-3x-cn/references/framework/asset-management.md +322 -0
  54. package/skills/cocos-creator-3x-cn/references/framework/component-system.md +348 -0
  55. package/skills/cocos-creator-3x-cn/references/framework/event-patterns.md +410 -0
  56. package/skills/cocos-creator-3x-cn/references/framework/playable-optimization.md +257 -0
  57. package/skills/cocos-creator-3x-cn/references/language/performance.md +363 -0
  58. package/skills/cocos-creator-3x-cn/references/language/quality-hygiene.md +307 -0
  59. package/skills/cocos-creator-3x-cn/references/review/architecture-review.md +183 -0
  60. package/skills/cocos-creator-3x-cn/references/review/quality-review.md +251 -0
  61. package/skills/cocos-performance-optimizer/SKILL.md +214 -0
  62. package/skills/game-development/2d-games/SKILL.md +129 -0
  63. package/skills/game-development/3d-games/SKILL.md +145 -0
  64. package/skills/game-development/SKILL.md +175 -0
  65. package/skills/game-development/game-art/SKILL.md +195 -0
  66. package/skills/game-development/game-audio/SKILL.md +200 -0
  67. package/skills/game-development/game-design/SKILL.md +139 -0
  68. package/skills/game-development/mobile-games/SKILL.md +118 -0
  69. package/skills/game-development/multiplayer/SKILL.md +142 -0
  70. package/skills/game-development/pc-games/SKILL.md +154 -0
  71. package/skills/game-development/vr-ar/SKILL.md +133 -0
  72. package/skills/game-development/web-games/SKILL.md +160 -0
  73. package/skills/game-engine/SKILL.md +140 -0
  74. package/skills/game-engine/assets/2d-maze-game.md +528 -0
  75. package/skills/game-engine/assets/2d-platform-game.md +1855 -0
  76. package/skills/game-engine/assets/gameBase-template-repo.md +310 -0
  77. package/skills/game-engine/assets/paddle-game-template.md +1528 -0
  78. package/skills/game-engine/assets/simple-2d-engine.md +507 -0
  79. package/skills/game-engine/references/3d-web-games.md +754 -0
  80. package/skills/game-engine/references/algorithms.md +843 -0
  81. package/skills/game-engine/references/basics.md +343 -0
  82. package/skills/game-engine/references/game-control-mechanisms.md +617 -0
  83. package/skills/game-engine/references/game-engine-core-principles.md +695 -0
  84. package/skills/game-engine/references/game-publishing.md +352 -0
  85. package/skills/game-engine/references/techniques.md +894 -0
  86. package/skills/game-engine/references/terminology.md +354 -0
  87. package/skills/game-engine/references/web-apis.md +1394 -0
  88. package/skills/theone-cocos-standards/SKILL.md +557 -0
  89. package/skills/theone-cocos-standards/references/framework/component-system.md +645 -0
  90. package/skills/theone-cocos-standards/references/framework/event-patterns.md +433 -0
  91. package/skills/theone-cocos-standards/references/framework/playable-optimization.md +429 -0
  92. package/skills/theone-cocos-standards/references/framework/size-optimization.md +308 -0
  93. package/skills/theone-cocos-standards/references/language/modern-typescript.md +658 -0
  94. package/skills/theone-cocos-standards/references/language/performance.md +580 -0
  95. package/skills/theone-cocos-standards/references/language/quality-hygiene.md +582 -0
  96. package/skills/theone-cocos-standards/references/review/architecture-review.md +250 -0
  97. package/skills/theone-cocos-standards/references/review/performance-review.md +288 -0
  98. package/skills/theone-cocos-standards/references/review/quality-review.md +239 -0
  99. package/dist/chunk-RIK7IXSW.js.map +0 -1
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: pc-games
3
+ description: "PC and console game development principles. Engine selection, platform features, optimization strategies."
4
+ risk: safe
5
+ source: community
6
+ date_added: "2026-02-27"
7
+ ---
8
+
9
+ # PC/Console Game Development
10
+
11
+ > Engine selection and platform-specific principles.
12
+
13
+ ---
14
+
15
+ ## 1. Engine Selection
16
+
17
+ ### Decision Tree
18
+
19
+ ```
20
+ What are you building?
21
+
22
+ ├── 2D Game
23
+ │ ├── Open source important? → Godot
24
+ │ └── Large team/assets? → Unity
25
+
26
+ ├── 3D Game
27
+ │ ├── AAA visual quality? → Unreal
28
+ │ ├── Cross-platform priority? → Unity
29
+ │ └── Indie/open source? → Godot 4
30
+
31
+ └── Specific Needs
32
+ ├── DOTS performance? → Unity
33
+ ├── Nanite/Lumen? → Unreal
34
+ └── Lightweight? → Godot
35
+ ```
36
+
37
+ ### Comparison
38
+
39
+ | Factor | Unity 6 | Godot 4 | Unreal 5 |
40
+ |--------|---------|---------|----------|
41
+ | 2D | Good | Excellent | Limited |
42
+ | 3D | Good | Good | Excellent |
43
+ | Learning | Medium | Easy | Hard |
44
+ | Cost | Revenue share | Free | 5% after $1M |
45
+ | Team | Any | Solo-Medium | Medium-Large |
46
+
47
+ ---
48
+
49
+ ## 2. Platform Features
50
+
51
+ ### Steam Integration
52
+
53
+ | Feature | Purpose |
54
+ |---------|---------|
55
+ | Achievements | Player goals |
56
+ | Cloud Saves | Cross-device progress |
57
+ | Leaderboards | Competition |
58
+ | Workshop | User mods |
59
+ | Rich Presence | Show in-game status |
60
+
61
+ ### Console Requirements
62
+
63
+ | Platform | Certification |
64
+ |----------|--------------|
65
+ | PlayStation | TRC compliance |
66
+ | Xbox | XR compliance |
67
+ | Nintendo | Lotcheck |
68
+
69
+ ---
70
+
71
+ ## 3. Controller Support
72
+
73
+ ### Input Abstraction
74
+
75
+ ```
76
+ Map ACTIONS, not buttons:
77
+ - "confirm" → A (Xbox), Cross (PS), B (Nintendo)
78
+ - "cancel" → B (Xbox), Circle (PS), A (Nintendo)
79
+ ```
80
+
81
+ ### Haptic Feedback
82
+
83
+ | Intensity | Use |
84
+ |-----------|-----|
85
+ | Light | UI feedback |
86
+ | Medium | Impacts |
87
+ | Heavy | Major events |
88
+
89
+ ---
90
+
91
+ ## 4. Performance Optimization
92
+
93
+ ### Profiling First
94
+
95
+ | Engine | Tool |
96
+ |--------|------|
97
+ | Unity | Profiler Window |
98
+ | Godot | Debugger → Profiler |
99
+ | Unreal | Unreal Insights |
100
+
101
+ ### Common Bottlenecks
102
+
103
+ | Bottleneck | Solution |
104
+ |------------|----------|
105
+ | Draw calls | Batching, atlases |
106
+ | GC spikes | Object pooling |
107
+ | Physics | Simpler colliders |
108
+ | Shaders | LOD shaders |
109
+
110
+ ---
111
+
112
+ ## 5. Engine-Specific Principles
113
+
114
+ ### Unity 6
115
+
116
+ - DOTS for performance-critical systems
117
+ - Burst compiler for hot paths
118
+ - Addressables for asset streaming
119
+
120
+ ### Godot 4
121
+
122
+ - GDScript for rapid iteration
123
+ - C# for complex logic
124
+ - Signals for decoupling
125
+
126
+ ### Unreal 5
127
+
128
+ - Blueprint for designers
129
+ - C++ for performance
130
+ - Nanite for high-poly environments
131
+ - Lumen for dynamic lighting
132
+
133
+ ---
134
+
135
+ ## 6. Anti-Patterns
136
+
137
+ | ❌ Don't | ✅ Do |
138
+ |----------|-------|
139
+ | Choose engine by hype | Choose by project needs |
140
+ | Ignore platform guidelines | Study certification requirements |
141
+ | Hardcode input buttons | Abstract to actions |
142
+ | Skip profiling | Profile early and often |
143
+
144
+ ---
145
+
146
+ > **Remember:** Engine is a tool. Master the principles, then adapt to any engine.
147
+
148
+ ## When to Use
149
+ This skill is applicable to execute the workflow or actions described in the overview.
150
+
151
+ ## Limitations
152
+ - Use this skill only when the task clearly matches the scope described above.
153
+ - Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
154
+ - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: vr-ar
3
+ description: "VR/AR development principles. Comfort, interaction, performance requirements."
4
+ risk: unknown
5
+ source: community
6
+ date_added: "2026-02-27"
7
+ ---
8
+
9
+ # VR/AR Development
10
+
11
+ > Immersive experience principles.
12
+
13
+ ---
14
+
15
+ ## 1. Platform Selection
16
+
17
+ ### VR Platforms
18
+
19
+ | Platform | Use Case |
20
+ |----------|----------|
21
+ | **Quest** | Standalone, wireless |
22
+ | **PCVR** | High fidelity |
23
+ | **PSVR** | Console market |
24
+ | **WebXR** | Browser-based |
25
+
26
+ ### AR Platforms
27
+
28
+ | Platform | Use Case |
29
+ |----------|----------|
30
+ | **ARKit** | iOS devices |
31
+ | **ARCore** | Android devices |
32
+ | **WebXR** | Browser AR |
33
+ | **HoloLens** | Enterprise |
34
+
35
+ ---
36
+
37
+ ## 2. Comfort Principles
38
+
39
+ ### Motion Sickness Prevention
40
+
41
+ | Cause | Solution |
42
+ |-------|----------|
43
+ | **Locomotion** | Teleport, snap turn |
44
+ | **Low FPS** | Maintain 90 FPS |
45
+ | **Camera shake** | Avoid or minimize |
46
+ | **Rapid acceleration** | Gradual movement |
47
+
48
+ ### Comfort Settings
49
+
50
+ - Vignette during movement
51
+ - Snap vs smooth turning
52
+ - Seated vs standing modes
53
+ - Height calibration
54
+
55
+ ---
56
+
57
+ ## 3. Performance Requirements
58
+
59
+ ### Target Metrics
60
+
61
+ | Platform | FPS | Resolution |
62
+ |----------|-----|------------|
63
+ | Quest 2 | 72-90 | 1832x1920 |
64
+ | Quest 3 | 90-120 | 2064x2208 |
65
+ | PCVR | 90 | 2160x2160+ |
66
+ | PSVR2 | 90-120 | 2000x2040 |
67
+
68
+ ### Frame Budget
69
+
70
+ - VR requires consistent frame times
71
+ - Single dropped frame = visible judder
72
+ - 90 FPS = 11.11ms budget
73
+
74
+ ---
75
+
76
+ ## 4. Interaction Principles
77
+
78
+ ### Controller Interaction
79
+
80
+ | Type | Use |
81
+ |------|-----|
82
+ | **Point + click** | UI, distant objects |
83
+ | **Grab** | Manipulation |
84
+ | **Gesture** | Magic, special actions |
85
+ | **Physical** | Throwing, swinging |
86
+
87
+ ### Hand Tracking
88
+
89
+ - More immersive but less precise
90
+ - Good for: social, casual
91
+ - Challenging for: action, precision
92
+
93
+ ---
94
+
95
+ ## 5. Spatial Design
96
+
97
+ ### World Scale
98
+
99
+ - 1 unit = 1 meter (critical)
100
+ - Objects must feel right size
101
+ - Test with real measurements
102
+
103
+ ### Depth Cues
104
+
105
+ | Cue | Importance |
106
+ |-----|------------|
107
+ | Stereo | Primary depth |
108
+ | Motion parallax | Secondary |
109
+ | Shadows | Grounding |
110
+ | Occlusion | Layering |
111
+
112
+ ---
113
+
114
+ ## 6. Anti-Patterns
115
+
116
+ | ❌ Don't | ✅ Do |
117
+ |----------|-------|
118
+ | Move camera without player | Player controls camera |
119
+ | Drop below 90 FPS | Maintain frame rate |
120
+ | Use tiny UI text | Large, readable text |
121
+ | Ignore arm length | Scale to player reach |
122
+
123
+ ---
124
+
125
+ > **Remember:** Comfort is not optional. Sick players don't play.
126
+
127
+ ## When to Use
128
+ This skill is applicable to execute the workflow or actions described in the overview.
129
+
130
+ ## Limitations
131
+ - Use this skill only when the task clearly matches the scope described above.
132
+ - Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
133
+ - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: web-games
3
+ description: "Web browser game development principles. Framework selection, WebGPU, optimization, PWA."
4
+ risk: unknown
5
+ source: community
6
+ date_added: "2026-02-27"
7
+ ---
8
+
9
+ # Web Browser Game Development
10
+
11
+ > Framework selection and browser-specific principles.
12
+
13
+ ---
14
+
15
+ ## 1. Framework Selection
16
+
17
+ ### Decision Tree
18
+
19
+ ```
20
+ What type of game?
21
+
22
+ ├── 2D Game
23
+ │ ├── Full game engine features? → Phaser
24
+ │ └── Raw rendering power? → PixiJS
25
+
26
+ ├── 3D Game
27
+ │ ├── Full engine (physics, XR)? → Babylon.js
28
+ │ └── Rendering focused? → Three.js
29
+
30
+ └── Hybrid / Canvas
31
+ └── Custom → Raw Canvas/WebGL
32
+ ```
33
+
34
+ ### Comparison (2025)
35
+
36
+ | Framework | Type | Best For |
37
+ |-----------|------|----------|
38
+ | **Phaser 4** | 2D | Full game features |
39
+ | **PixiJS 8** | 2D | Rendering, UI |
40
+ | **Three.js** | 3D | Visualizations, lightweight |
41
+ | **Babylon.js 7** | 3D | Full engine, XR |
42
+
43
+ ---
44
+
45
+ ## 2. WebGPU Adoption
46
+
47
+ ### Browser Support (2025)
48
+
49
+ | Browser | Support |
50
+ |---------|---------|
51
+ | Chrome | ✅ Since v113 |
52
+ | Edge | ✅ Since v113 |
53
+ | Firefox | ✅ Since v131 |
54
+ | Safari | ✅ Since 18.0 |
55
+ | **Total** | **~73%** global |
56
+
57
+ ### Decision
58
+
59
+ - **New projects**: Use WebGPU with WebGL fallback
60
+ - **Legacy support**: Start with WebGL
61
+ - **Feature detection**: Check `navigator.gpu`
62
+
63
+ ---
64
+
65
+ ## 3. Performance Principles
66
+
67
+ ### Browser Constraints
68
+
69
+ | Constraint | Strategy |
70
+ |------------|----------|
71
+ | No local file access | Asset bundling, CDN |
72
+ | Tab throttling | Pause when hidden |
73
+ | Mobile data limits | Compress assets |
74
+ | Audio autoplay | Require user interaction |
75
+
76
+ ### Optimization Priority
77
+
78
+ 1. **Asset compression** - KTX2, Draco, WebP
79
+ 2. **Lazy loading** - Load on demand
80
+ 3. **Object pooling** - Avoid GC
81
+ 4. **Draw call batching** - Reduce state changes
82
+ 5. **Web Workers** - Offload heavy computation
83
+
84
+ ---
85
+
86
+ ## 4. Asset Strategy
87
+
88
+ ### Compression Formats
89
+
90
+ | Type | Format |
91
+ |------|--------|
92
+ | Textures | KTX2 + Basis Universal |
93
+ | Audio | WebM/Opus (fallback: MP3) |
94
+ | 3D Models | glTF + Draco/Meshopt |
95
+
96
+ ### Loading Strategy
97
+
98
+ | Phase | Load |
99
+ |-------|------|
100
+ | Startup | Core assets, <2MB |
101
+ | Gameplay | Stream on demand |
102
+ | Background | Prefetch next level |
103
+
104
+ ---
105
+
106
+ ## 5. PWA for Games
107
+
108
+ ### Benefits
109
+
110
+ - Offline play
111
+ - Install to home screen
112
+ - Full screen mode
113
+ - Push notifications
114
+
115
+ ### Requirements
116
+
117
+ - Service worker for caching
118
+ - Web app manifest
119
+ - HTTPS
120
+
121
+ ---
122
+
123
+ ## 6. Audio Handling
124
+
125
+ ### Browser Requirements
126
+
127
+ - Audio context requires user interaction
128
+ - Create AudioContext on first click/tap
129
+ - Resume context if suspended
130
+
131
+ ### Best Practices
132
+
133
+ - Use Web Audio API
134
+ - Pool audio sources
135
+ - Preload common sounds
136
+ - Compress with WebM/Opus
137
+
138
+ ---
139
+
140
+ ## 7. Anti-Patterns
141
+
142
+ | ❌ Don't | ✅ Do |
143
+ |----------|-------|
144
+ | Load all assets upfront | Progressive loading |
145
+ | Ignore tab visibility | Pause when hidden |
146
+ | Block on audio load | Lazy load audio |
147
+ | Skip compression | Compress everything |
148
+ | Assume fast connection | Handle slow networks |
149
+
150
+ ---
151
+
152
+ > **Remember:** Browser is the most accessible platform. Respect its constraints.
153
+
154
+ ## When to Use
155
+ This skill is applicable to execute the workflow or actions described in the overview.
156
+
157
+ ## Limitations
158
+ - Use this skill only when the task clearly matches the scope described above.
159
+ - Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
160
+ - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: game-engine
3
+ description: 'Expert skill for building web-based game engines and games using HTML5, Canvas, WebGL, and JavaScript. Use when asked to create games, build game engines, implement game physics, handle collision detection, set up game loops, manage sprites, add game controls, or work with 2D/3D rendering. Covers techniques for platformers, breakout-style games, maze games, tilemaps, audio, multiplayer via WebRTC, and publishing games.'
4
+ version: 1.0.0
5
+ ---
6
+
7
+ # Game Engine Skill
8
+
9
+ Build web-based games and game engines using HTML5 Canvas, WebGL, and JavaScript. This skill includes starter templates, reference documentation, and step-by-step workflows for 2D and 3D game development with frameworks such as Phaser, Three.js, Babylon.js, and A-Frame.
10
+
11
+ ## When to Use This Skill
12
+
13
+ - Building a game engine or game from scratch using web technologies
14
+ - Implementing game loops, physics, collision detection, or rendering
15
+ - Working with HTML5 Canvas, WebGL, or SVG for game graphics
16
+ - Adding game controls (keyboard, mouse, touch, gamepad)
17
+ - Creating 2D platformers, breakout-style games, maze games, or 3D experiences
18
+ - Working with tilemaps, sprites, or animations
19
+ - Adding audio to web games
20
+ - Implementing multiplayer features with WebRTC or WebSockets
21
+ - Optimizing game performance
22
+ - Publishing and distributing web games
23
+
24
+ ## Prerequisites
25
+
26
+ - Basic knowledge of HTML, CSS, and JavaScript
27
+ - A modern web browser with Canvas/WebGL support
28
+ - A text editor or IDE
29
+ - Optional: Node.js for build tooling and local development servers
30
+
31
+ ## Core Concepts
32
+
33
+ The following concepts form the foundation of every web-based game engine.
34
+
35
+ ### Game Loop
36
+
37
+ Every game engine revolves around the game loop -- a continuous cycle of:
38
+
39
+ 1. **Process Input** - Read keyboard, mouse, touch, or gamepad input
40
+ 2. **Update State** - Update game object positions, physics, AI, and logic
41
+ 3. **Render** - Draw the current game state to the screen
42
+
43
+ Use `requestAnimationFrame` for smooth, browser-optimized rendering.
44
+
45
+ ### Rendering
46
+
47
+ - **Canvas 2D** - Best for 2D games, sprite-based rendering, and tilemaps
48
+ - **WebGL** - Hardware-accelerated 3D and advanced 2D rendering
49
+ - **SVG** - Vector-based graphics, good for UI elements
50
+ - **CSS** - Useful for DOM-based game elements and transitions
51
+
52
+ ### Physics and Collision Detection
53
+
54
+ - **2D Collision Detection** - AABB, circle, and SAT-based collision
55
+ - **3D Collision Detection** - Bounding box, bounding sphere, and raycasting
56
+ - **Velocity and Acceleration** - Basic Newtonian physics for movement
57
+ - **Gravity** - Constant downward acceleration for platformers
58
+
59
+ ### Controls
60
+
61
+ - **Keyboard** - Arrow keys, WASD, and custom key bindings
62
+ - **Mouse** - Click, move, and pointer lock for FPS-style controls
63
+ - **Touch** - Mobile touch events and virtual joysticks
64
+ - **Gamepad** - Gamepad API for controller support
65
+
66
+ ### Audio
67
+
68
+ - **Web Audio API** - Programmatic sound generation and spatial audio
69
+ - **HTML5 Audio** - Simple audio playback for music and sound effects
70
+
71
+ ## Step-by-Step Workflows
72
+
73
+ ### Creating a Basic 2D Game
74
+
75
+ 1. Set up an HTML file with a `<canvas>` element
76
+ 2. Get the 2D rendering context
77
+ 3. Implement the game loop using `requestAnimationFrame`
78
+ 4. Create game objects with position, velocity, and size properties
79
+ 5. Handle keyboard/mouse input for player control
80
+ 6. Implement collision detection between game objects
81
+ 7. Add scoring, lives, and win/lose conditions
82
+ 8. Add sound effects and music
83
+
84
+ ### Building a 3D Game
85
+
86
+ 1. Choose a framework (Three.js, Babylon.js, A-Frame, or PlayCanvas)
87
+ 2. Set up the scene, camera, and renderer
88
+ 3. Load or create 3D models and textures
89
+ 4. Implement lighting and shaders
90
+ 5. Add physics and collision detection
91
+ 6. Implement player controls and camera movement
92
+ 7. Add audio and visual effects
93
+
94
+ ### Publishing a Game
95
+
96
+ 1. Optimize assets (compress images, minify code)
97
+ 2. Test across browsers and devices
98
+ 3. Choose distribution platform (web, app stores, game portals)
99
+ 4. Implement monetization if needed
100
+ 5. Promote through game communities and social media
101
+
102
+ ## Game Templates
103
+
104
+ Starter templates are available in the `assets/` folder. Each template provides a complete, working example that can be used as a starting point for a new project.
105
+
106
+ | Template | Description |
107
+ |----------|-------------|
108
+ | `paddle-game-template.md` | 2D Breakout-style game with pure JavaScript |
109
+ | `2d-maze-game.md` | Maze game with device orientation controls |
110
+ | `2d-platform-game.md` | Platformer game using Phaser framework |
111
+ | `gameBase-template-repo.md` | Game base template repository structure |
112
+ | `simple-2d-engine.md` | Simple 2D platformer engine with collisions |
113
+
114
+ ## Reference Documentation
115
+
116
+ Detailed reference material is available in the `references/` folder. Consult these files for in-depth coverage of specific topics.
117
+
118
+ | Reference | Topics Covered |
119
+ |-----------|---------------|
120
+ | `basics.md` | Game development introduction and anatomy |
121
+ | `web-apis.md` | Canvas, WebGL, Web Audio, Gamepad, and other web APIs |
122
+ | `techniques.md` | Collision detection, tilemaps, async scripts, audio |
123
+ | `3d-web-games.md` | 3D theory, frameworks, shaders, WebXR |
124
+ | `game-control-mechanisms.md` | Touch, keyboard, mouse, and gamepad controls |
125
+ | `game-publishing.md` | Distribution, promotion, and monetization |
126
+ | `algorithms.md` | Raycasting, collision, physics, vector math |
127
+ | `terminology.md` | Game development glossary |
128
+ | `game-engine-core-principles.md` | Core design principles for game engines |
129
+
130
+ ## Troubleshooting
131
+
132
+ | Issue | Solution |
133
+ |-------|----------|
134
+ | Canvas is blank | Check that you are calling drawing methods after getting the context and inside the game loop |
135
+ | Game runs at different speeds | Use delta time in update calculations instead of fixed values |
136
+ | Collision detection is inconsistent | Use continuous collision detection or reduce time steps for fast-moving objects |
137
+ | Audio does not play | Browsers require user interaction before playing audio; trigger playback from a click handler |
138
+ | Performance is poor | Profile with browser dev tools, reduce draw calls, use object pooling, and optimize asset sizes |
139
+ | Touch controls are unresponsive | Prevent default touch behavior and handle touch events separately from mouse events |
140
+ | WebGL context lost | Handle the `webglcontextlost` event and restore state on `webglcontextrestored` |