template: id: game-architecture-template-v3 name: Game Architecture Document version: 3.0 output: format: markdown filename: docs/architecture.md title: "{{project_name}} Game Architecture Document" workflow: mode: interactive elicitation: advanced-elicitation sections: - id: introduction title: Introduction instruction: | If available, review any provided relevant documents to gather all relevant context before beginning. At a minimum you should locate and review: Game Design Document (GDD), Technical Preferences. If these are not available, ask the user what docs will provide the basis for the game architecture. sections: - id: intro-content content: | This document outlines the complete technical architecture for {{project_name}}, a game built with the WeChat Mini Game framework using JavaScript. It serves as the technical foundation for AI-driven game development with mandatory TDD practices, ensuring consistency, scalability, and 60+ FPS performance across all game systems. This architecture is designed to support the gameplay mechanics defined in the Game Design Document while maintaining optimal performance. - id: starter-template title: Starter Template or Existing Project instruction: | Before proceeding further with game architecture design, check if the project is based on a template or existing codebase: 1. Review the GDD and brainstorming brief for any mentions of: - Starter projects - Existing WeChat Mini Game projects being used as a foundation - Plugins or libraries - Previous game projects to be cloned or adapted 2. If a starter template or existing project is mentioned: - Ask the user to provide access via one of these methods: - Link to the template documentation - Upload/attach the project files (for small projects) - Share a link to the project repository (GitHub, GitLab, etc.) - Analyze the starter/existing project to understand: - Object architecture and scene structure - Performance characteristics - Existing event patterns and conventions - Any limitations or constraints imposed by the starter - Use this analysis to inform and align your architecture decisions 3. If no starter template is mentioned but this is a greenfield project: - Suggest appropriate project structure - Explain TDD setup - Let the user decide on the approach 4. If the user confirms no starter template will be used: - Proceed with architecture design from scratch - Plan for 60+ FPS performance targets from the start Document the decision here before proceeding with the architecture design. If none, just say N/A elicit: true - id: changelog title: Change Log type: table columns: [Date, Version, Description, Author] instruction: Track document versions and changes - id: high-level-architecture title: High Level Architecture instruction: | This section contains multiple subsections that establish the foundation of the game architecture. Present all subsections together at once. elicit: true sections: - id: technical-summary title: Technical Summary instruction: | Provide a brief paragraph (3-5 sentences) overview of: - The game's overall architecture style (object-based WeChat Mini Game architecture) - Primary technology choices (WeChat Mini Game, target platforms) - Core architectural patterns (Object composition, events, JSON-driven design) - Performance targets (60+ FPS minimum) and TDD approach - Reference back to the GDD goals and how this architecture supports them - id: high-level-overview title: High Level Overview instruction: | Based on the GDD's Technical Assumptions section, describe: 1. The main architectural style (object-based WeChat Mini Game architecture with scene composition) 2. Repository structure decision from GDD 3. Game system architecture (object systems, global managers, JSON-driven design) 4. Primary player interaction flow and core game loop 5. Key architectural decisions and their rationale 6. Performance optimization strategy (object pooling, profiler usage) - id: project-diagram title: High Level Project Diagram type: mermaid mermaid_type: graph instruction: | Create a Mermaid diagram that visualizes the high-level WeChat Mini Game architecture. Consider: - Core systems (Input, Physics, Rendering, Audio) - Global managers and their responsibilities - Event flow between systems - Resource loading and management - Scene tree structure - Player interaction points - id: architectural-patterns title: Architectural and Design Patterns instruction: | List the key high-level patterns that will guide the WeChat Mini Game architecture. For each pattern: 1. Present 2-3 viable options if multiple exist 2. Provide your recommendation with clear rationale 3. Get user confirmation before finalizing 4. These patterns should align with the GDD's technical assumptions and 60+ FPS performance goals template: "- **{{pattern_name}}:** {{pattern_description}} - _Rationale:_ {{rationale}}" examples: - "**Object-Based Architecture:** Using scene composition and object inheritance - _Rationale:_ Aligns with WeChat Mini Game's design philosophy and enables reusable, testable game systems" - "**JSON Data:** Using JSON for game configuration - _Rationale:_ Enables data-driven design and hot-reload during development" - "**Event-Driven Communication:** Using events for system decoupling - _Rationale:_ Supports modular architecture and prevents tight coupling" - id: tech-stack title: Tech Stack instruction: | This is the DEFINITIVE technology selection section for the WeChat Mini Game. Work with the user to make specific choices: 1. Review GDD technical assumptions and any preferences from .bmad-wechat-mini-game-dev/data/technical-preferences.yaml or an attached technical-preferences 2. For each category, present 2-3 viable options with pros/cons 3. Make a clear recommendation based on project needs and 60+ FPS targets 4. Get explicit user approval for each selection 5. Document exact versions (avoid "latest" - pin specific versions) 6. This table is the single source of truth - all other docs must reference these choices Key decisions to finalize - before displaying the table, ensure you are aware of or ask the user about: - Target platforms and export templates - Plugins or libraries - Testing frameworks - Platform SDKs and services - Build and deployment tools Upon render of the table, ensure the user is aware of the importance of this sections choices, should also look for gaps or disagreements with anything, ask for any clarifications if something is unclear why its in the list, and also right away elicit feedback. elicit: true sections: - id: platform-infrastructure title: Platform Infrastructure template: | - **Target Platforms:** {{target_platforms}} - **Primary Platform:** {{primary_platform}} - **Platform Services:** {{platform_services_list}} - **Distribution:** {{distribution_channels}} - id: technology-stack-table title: Technology Stack Table type: table columns: [Category, Technology, Version, Purpose, Rationale] instruction: Populate the technology stack table with all relevant WeChat Mini Game technologies examples: - "| **Game Engine** | WeChat Mini Game | latest | Core game development platform | Excellent 2D support, 60+ FPS capable |" - "| **Primary Language** | JavaScript | ES6+ | Game logic and rapid iteration | Native to WeChat Mini Game |" - "| **Renderer** | Canvas 2D / WebGL | Built-in | 2D rendering | Optimized for desktop/mobile, excellent performance |" - "| **Input System** | WeChat Mini Game API | Built-in | Cross-platform input handling | Action-based system, supports all devices |" - "| **Physics** | WeChat Mini Game Physics | Built-in | 2D collision and physics | Optimized 2D physics, configurable fixed timestep |" - "| **Audio** | WeChat Mini Game Audio | Built-in | Audio playback and bus system | Built-in mixer with bus routing |" - "| **Testing** | Jest | latest | Unit testing for JavaScript | TDD framework for JavaScript code |" - id: data-models title: Game Data Models instruction: | Define the core game data models/entities using JSON: 1. Review GDD requirements and identify key game entities 2. For each model, explain its purpose and relationships 3. Include key attributes and data types appropriate for JavaScript 4. Show relationships between models using references 5. Consider preload vs load strategies for performance 6. Discuss design decisions with user Create a clear conceptual model before moving to specific implementations. elicit: true repeatable: true sections: - id: model title: "{{model_name}}" template: | **Purpose:** {{model_purpose}} **Key Attributes:** - {{attribute_1}}: {{type_1}} - {{description_1}} - {{attribute_2}}: {{type_2}} - {{description_2}} **Relationships:** - {{relationship_1}} - {{relationship_2}} **Resource Implementation:** - Create as JSON file - Store in `resources/{{model_name}}/` - Loading strategy: {{preload_or_load}} - id: components title: Game Systems & Components instruction: | Based on the architectural patterns, tech stack, and data models from above: 1. Identify major game systems and their responsibilities 2. Consider WeChat Mini Game's object-based architecture with scene composition 3. Define clear interfaces between systems using events 4. For each system, specify: - Primary responsibility and core functionality - Key object classes and custom JSON - Dependencies on other systems via events - WeChat Mini Game-specific implementation details - Object pooling requirements for spawned entities 5. Create system diagrams where helpful using WeChat Mini Game terminology elicit: true sections: - id: system-list repeatable: true title: "{{system_name}} System" template: | **Responsibility:** {{system_description}} **Key Components:** - {{component_1}} (Object) - {{component_2}} (JSON) - {{component_3}} (Global Manager) **WeChat Mini Game Implementation Details:** - Process: {{process_or_physics_process}} - Events: {{events_emitted_and_connected}} - Dependencies: {{system_dependencies}} - Object Pooling: {{pooling_requirements}} **Files to Create:** - `js/{{system_name}}/{{main_script}}.js` - `scenes/{{system_name}}/{{main_scene}}.js` - id: component-diagrams title: System Interaction Diagrams type: mermaid instruction: | Create Mermaid diagrams to visualize game system relationships. Options: - System architecture diagram for high-level view - Component interaction diagram for detailed relationships - Sequence diagrams for complex game loops Choose the most appropriate for clarity and WeChat Mini Game-specific understanding - id: gameplay-systems title: Gameplay Systems Architecture instruction: | Define the core gameplay systems that drive the player experience. Focus on game-specific logic, mechanics, and maintaining 60+ FPS performance. elicit: true sections: - id: gameplay-overview title: Gameplay Systems Overview template: | **Core Game Loop:** {{core_game_loop_description}} **Player Actions:** {{primary_player_actions}} **Game State Flow:** {{game_state_transitions}} - id: gameplay-components title: Gameplay Component Architecture template: | **Player Controller Components:** - {{player_controller_objects}} **Game Logic Components:** - {{game_logic_objects}} **Interaction Systems:** - {{interaction_system_objects}} - Event Flow: {{event_connections}} **Performance Targets:** - Frame Rate: 60+ FPS maintained - Frame Time: <16.67ms - id: object-architecture title: Object Architecture Details instruction: | Define detailed WeChat Mini Game object architecture patterns and conventions for the game. elicit: true sections: - id: object-patterns title: Object Patterns template: | **Object Composition:** {{object_composition_approach}} **Scene Inheritance:** {{scene_inheritance_patterns}} **Event Communication:** {{event_connection_patterns}} - id: resource-usage title: Resource Architecture template: | **Data Architecture:** {{json_data_patterns}} **Configuration Management:** {{config_json_usage}} **Runtime Resources:** {{runtime_resource_patterns}} **Loading Strategy:** {{preload_vs_load_strategy}} - id: physics-config title: Physics Configuration instruction: | Define WeChat Mini Game physics setup and configuration for the game. elicit: true sections: - id: physics-settings title: Physics Settings template: | **Physics Settings:** {{physics_2d_configuration}} **Fixed Timestep:** {{physics_fps_setting}} (affects performance) **Collision Layers:** {{collision_layer_matrix}} **Physics Materials:** {{physics_materials_setup}} - id: rigidbody-patterns title: Rigidbody Patterns template: | **Player Physics:** {{player_rigidbody_setup}} **Object Physics:** {{object_physics_patterns}} **Object Pooling:** {{physics_object_pooling}} **Performance Optimization:** {{physics_optimization_strategies}} **Target Performance:** Maintain 60+ FPS with physics - id: input-system title: Input System Architecture instruction: | Define input handling using the WeChat Mini Game API for cross-platform support. elicit: true sections: - id: input-actions title: Input Actions Configuration template: | **Input Actions:** {{input_action_structure}} **Action Categories:** {{input_action_categories}} **Device Support:** {{keyboard_gamepad_touch_support}} **Input Latency Target:** <50ms for responsive controls - id: input-handling title: Input Handling Patterns template: | **Player Input:** {{player_input_handling}} **UI Input:** {{ui_input_patterns}} - id: state-machines title: State Machine Architecture instruction: | Define state machine patterns for game states, player states, and AI behavior. elicit: true sections: - id: game-state-machine title: Game State Machine template: | **Game States:** {{game_state_definitions}} **State Transitions:** {{game_state_transition_rules}} **State Management:** {{game_state_manager_implementation}} - id: entity-state-machines title: Entity State Machines template: | **Player States:** {{player_state_machine_design}} **AI Behavior States:** {{ai_state_machine_patterns}} **Object States:** {{object_state_management}} **Event Integration:** {{state_change_events}} - id: ui-architecture title: UI Architecture instruction: | Define WeChat Mini Game UI system architecture. elicit: true sections: - id: ui-system-choice title: UI System Selection template: | **UI Framework:** WeChat Mini Game UI **UI Scaling:** {{anchoring_and_margin_strategy}} **Viewport Setup:** {{viewport_configuration}} - id: ui-navigation title: UI Navigation System template: | **Screen Management:** {{screen_management_system}} **Navigation Flow:** {{ui_navigation_patterns}} **Back Button Handling:** {{back_button_implementation}} - id: ui-components title: UI Component System instruction: | Define reusable UI components and their implementation patterns. elicit: true sections: - id: ui-component-library title: UI Component Library template: | **Base Components:** {{base_ui_components}} **Custom Components:** {{custom_ui_components}} **Component Prefabs:** {{ui_prefab_organization}} - id: ui-data-binding title: UI Data Binding template: | **Data Binding Patterns:** {{ui_data_binding_approach}} **UI Events:** {{ui_event_system}} **View Model Patterns:** {{ui_viewmodel_implementation}} - id: ui-state-management title: UI State Management instruction: | Define how UI state is managed across the game. elicit: true sections: - id: ui-state-patterns title: UI State Patterns template: | **State Persistence:** {{ui_state_persistence}} **Screen State:** {{screen_state_management}} **UI Configuration:** {{ui_configuration_management}} - id: scene-management title: Scene Management Architecture instruction: | Define scene loading, unloading, and transition strategies. elicit: true sections: - id: scene-structure title: Scene Structure template: | **Scene Organization:** {{scene_organization_strategy}} **Scene Hierarchy:** {{scene_hierarchy_patterns}} **Persistent Scenes:** {{persistent_scene_usage}} - id: scene-loading title: Scene Loading System template: | **Loading Strategies:** {{scene_loading_patterns}} **Async Loading:** {{async_scene_loading_implementation}} **Loading Screens:** {{loading_screen_management}} - id: data-persistence title: Data Persistence Architecture instruction: | Define save system and data persistence strategies. elicit: true sections: - id: save-data-structure title: Save Data Structure template: | **Save Data Models:** {{save_data_model_design}} **Serialization Format:** {{serialization_format_choice}} **Data Validation:** {{save_data_validation}} - id: persistence-strategy title: Persistence Strategy template: | **Save Triggers:** {{save_trigger_events}} **Auto-Save:** {{auto_save_implementation}} **Cloud Save:** {{cloud_save_integration}} - id: save-system title: Save System Implementation instruction: | Define detailed save system implementation patterns. elicit: true sections: - id: save-load-api title: Save/Load API template: | **Save Interface:** {{save_interface_design}} **Load Interface:** {{load_interface_design}} **Error Handling:** {{save_load_error_handling}} - id: save-file-management title: Save File Management template: | **File Structure:** {{save_file_structure}} **Backup Strategy:** {{save_backup_strategy}} **Migration:** {{save_data_migration_strategy}} - id: analytics-integration title: Analytics Integration instruction: | Define analytics tracking and integration patterns. condition: Game requires analytics tracking elicit: true sections: - id: analytics-events title: Analytics Event Design template: | **Event Categories:** {{analytics_event_categories}} **Custom Events:** {{custom_analytics_events}} **Player Progression:** {{progression_analytics}} - id: analytics-implementation title: Analytics Implementation template: | **Analytics SDK:** {{analytics_sdk_choice}} **Event Tracking:** {{event_tracking_patterns}} **Privacy Compliance:** {{analytics_privacy_considerations}} - id: multiplayer-architecture title: Multiplayer Architecture instruction: | Define multiplayer system architecture if applicable. condition: Game includes multiplayer features elicit: true sections: - id: networking-approach title: Networking Approach template: | **Networking Solution:** {{networking_solution_choice}} **Architecture Pattern:** {{multiplayer_architecture_pattern}} **Synchronization:** {{state_synchronization_strategy}} - id: multiplayer-systems title: Multiplayer System Components template: | **Client Components:** {{multiplayer_client_components}} **Server Components:** {{multiplayer_server_components}} **Network Messages:** {{network_message_design}} - id: rendering-pipeline title: Rendering Pipeline Configuration instruction: | Define WeChat Mini Game rendering pipeline setup and optimization. elicit: true sections: - id: render-pipeline-setup title: Render Pipeline Setup template: | **Pipeline Choice:** {{render_pipeline_choice}} **Pipeline Asset:** {{render_pipeline_asset_config}} **Quality Settings:** {{quality_settings_configuration}} - id: rendering-optimization title: Rendering Optimization template: | **Batching Strategies:** {{sprite_batching_optimization}} **Draw Call Optimization:** {{draw_call_reduction_strategies}} **Texture Optimization:** {{texture_optimization_settings}} - id: shader-guidelines title: Shader Guidelines instruction: | Define shader usage and custom shader guidelines. elicit: true sections: - id: shader-usage title: Shader Usage Patterns template: | **Built-in Shaders:** {{builtin_shader_usage}} **Custom Shaders:** {{custom_shader_requirements}} **Shader Variants:** {{shader_variant_management}} - id: shader-performance title: Shader Performance Guidelines template: | **Mobile Optimization:** {{mobile_shader_optimization}} **Performance Budgets:** {{shader_performance_budgets}} **Profiling Guidelines:** {{shader_profiling_approach}} - id: sprite-management title: Sprite Management instruction: | Define sprite asset management and optimization strategies. elicit: true sections: - id: sprite-organization title: Sprite Organization template: | **Atlas Strategy:** {{sprite_atlas_organization}} **Sprite Naming:** {{sprite_naming_conventions}} **Import Settings:** {{sprite_import_settings}} - id: sprite-optimization title: Sprite Optimization template: | **Compression Settings:** {{sprite_compression_settings}} **Resolution Strategy:** {{sprite_resolution_strategy}} **Memory Optimization:** {{sprite_memory_optimization}} - id: particle-systems title: Particle System Architecture instruction: | Define particle system usage and optimization. elicit: true sections: - id: particle-design title: Particle System Design template: | **Effect Categories:** {{particle_effect_categories}} **Scene Organization:** {{particle_scene_organization}} **Pooling Strategy:** {{particle_pooling_implementation}} - id: particle-performance title: Particle Performance template: | **Performance Budgets:** {{particle_performance_budgets}} **Mobile Optimization:** {{particle_mobile_optimization}} **LOD Strategy:** {{particle_lod_implementation}} - id: audio-architecture title: Audio Architecture instruction: | Define audio system architecture and implementation. elicit: true sections: - id: audio-system-design title: Audio System Design template: | **Audio Manager:** {{audio_manager_implementation}} **Audio Sources:** {{audio_source_management}} **3D Audio:** {{spatial_audio_implementation}} - id: audio-categories title: Audio Categories template: | **Music System:** {{music_system_architecture}} **Sound Effects:** {{sfx_system_design}} **Voice/Dialog:** {{dialog_system_implementation}} - id: audio-mixing title: Audio Mixing Configuration instruction: | Define WeChat Mini Game Audio bus setup and configuration. elicit: true sections: - id: mixer-setup title: Audio Mixer Setup template: | **Mixer Groups:** {{audio_mixer_group_structure}} **Effects Chain:** {{audio_effects_configuration}} **Snapshot System:** {{audio_snapshot_usage}} - id: dynamic-mixing title: Dynamic Audio Mixing template: | **Volume Control:** {{volume_control_implementation}} **Dynamic Range:** {{dynamic_range_management}} **Platform Optimization:** {{platform_audio_optimization}} - id: sound-banks title: Sound Bank Management instruction: | Define sound asset organization and loading strategies. elicit: true sections: - id: sound-organization title: Sound Asset Organization template: | **Bank Structure:** {{sound_bank_organization}} **Loading Strategy:** {{audio_loading_patterns}} **Memory Management:** {{audio_memory_management}} - id: sound-streaming title: Audio Streaming template: | **Streaming Strategy:** {{audio_streaming_implementation}} **Compression Settings:** {{audio_compression_settings}} **Platform Considerations:** {{platform_audio_considerations}} - id: wechat-mini-game-conventions title: WeChat Mini Game Development Conventions instruction: | Define WeChat Mini Game-specific development conventions and best practices. elicit: true sections: - id: wechat-mini-game-best-practices title: WeChat Mini Game Best Practices template: | **Object Design:** {{wechat_mini_game_object_best_practices}} **Performance Guidelines:** {{wechat_mini_game_performance_guidelines}} **Memory Management:** {{wechat_mini_game_memory_best_practices}} - id: wechat-mini-game-workflow title: WeChat Mini Game Workflow Conventions template: | **Scene Workflow:** {{scene_workflow_conventions}} **Object Workflow:** {{object_workflow_conventions}} **Resource Workflow:** {{resource_workflow_conventions}} - id: external-integrations title: External Integrations condition: Game requires external service integrations instruction: | For each external service integration required by the game: 1. Identify services needed based on GDD requirements and platform needs 2. If documentation URLs are unknown, ask user for specifics 3. Document authentication methods and WeChat Mini Game-specific integration approaches 4. List specific APIs that will be used 5. Note any platform-specific SDKs or plugins required If no external integrations are needed, state this explicitly and skip to next section. elicit: true repeatable: true sections: - id: integration title: "{{service_name}} Integration" template: | - **Purpose:** {{service_purpose}} - **Documentation:** {{service_docs_url}} - **Plugin:** {{plugin_name}} {{version}} - **Platform SDK:** {{platform_sdk_requirements}} - **Authentication:** {{auth_method}} **Key Features Used:** - {{feature_1}} - {{feature_purpose}} - {{feature_2}} - {{feature_purpose}} **WeChat Mini Game Implementation Notes:** {{wechat_mini_game_integration_details}} - id: core-workflows title: Core Game Workflows type: mermaid mermaid_type: sequence instruction: | Illustrate key game workflows using sequence diagrams: 1. Identify critical player journeys from GDD (game loop, level progression, etc.) 2. Show system interactions including WeChat Mini Game lifecycle methods 3. Include error handling paths and state transitions 4. Document async operations (scene loading, resource loading) 5. Create both high-level game flow and detailed system interaction diagrams Focus on workflows that clarify WeChat Mini Game-specific architecture decisions or complex system interactions. elicit: true - id: wechat-mini-game-project-structure title: WeChat Mini Game Project Structure type: code language: plaintext instruction: | Create a WeChat Mini Game project folder structure that reflects: 1. WeChat Mini Game best practices for game organization 2. Object and scene organization from above systems 3. Clear separation of concerns for game resources 4. Testing structure 5. Platform-specific export configurations 6. Object pooling systems Follow WeChat Mini Game naming conventions and folder organization standards. elicit: true examples: - | wechat-mini-game-project/ ├── scenes/ # Game scenes (.js) │ ├── game/ # Gameplay scenes │ │ ├── levels/ # Level scenes │ │ └── entities/ # Entity scenes │ ├── ui/ # UI scenes │ │ ├── menus/ # Menu scenes │ │ └── hud/ # HUD elements │ └── components/ # Reusable scene components ├── js/ # JavaScript files │ ├── player/ # Player scripts │ ├── enemies/ # Enemy scripts │ └── systems/ # Game systems ├── resources/ # Custom Resources (.json) │ ├── data/ # Game data resources │ └── themes/ # UI themes ├── assets/ # Raw assets │ ├── sprites/ # 2D sprites │ ├── audio/ # Audio files │ │ ├── music/ # Background music │ │ └── sfx/ # Sound effects │ └── fonts/ # Font files ├── tests/ # Test files │ ├── unit/ # Unit tests │ └── integration/ # Integration tests ├── pools/ # Object pooling systems │ └── projectiles/ # Bullet pools, etc. └── project.config.json # Project configuration - id: infrastructure-deployment title: Infrastructure and Deployment instruction: | Define the WeChat Mini Game build and deployment architecture: 1. Use WeChat Mini Game's export system with platform templates 2. Choose deployment strategy appropriate for target platforms 3. Define environments (debug, release, distribution) 4. Establish version control and build pipeline practices 5. Consider platform-specific export settings and optimizations 6. Plan for 60+ FPS validation across all platforms Get user input on build preferences and CI/CD tool choices for WeChat Mini Game projects. elicit: true sections: - id: wechat-mini-game-build-configuration title: WeChat Mini Game Build Configuration template: | - **WeChat Mini Game Version:** {{wechat_mini_game_version}} - **Export Templates:** {{export_templates_list}} - **Debug/Release:** {{build_configurations}} - **Performance Validation:** {{fps_validation_process}} - id: deployment-strategy title: Deployment Strategy template: | - **Build Automation:** {{build_automation_tool}} - **Version Control:** {{version_control_integration}} - **Distribution:** {{distribution_platforms}} - id: environments title: Build Environments repeatable: true template: "- **{{env_name}}:** {{env_purpose}} - {{platform_settings}}" - id: platform-specific-builds title: Platform-Specific Build Settings type: code language: text template: "{{platform_build_configurations}}" - id: coding-standards title: Coding Standards instruction: | These standards are MANDATORY for AI agents working on WeChat Mini Game development. Work with user to define ONLY the critical rules needed to ensure 60+ FPS and proper TDD. Explain that: 1. This section directly controls AI developer behavior 2. Keep it minimal - assume AI knows general JavaScript best practices 3. Focus on performance-critical WeChat Mini Game patterns and TDD enforcement 4. Standards will be extracted to separate file for dev agent use 5. 60+ FPS is non-negotiable - all code must maintain this For each standard, get explicit user confirmation it's necessary. elicit: true sections: - id: core-standards title: Core Standards template: | - **WeChat Mini Game Version:** {{wechat_mini_game_version}} - **Language:** JavaScript - **Code Style:** JavaScript style guide - **Testing:** TDD mandatory - **Performance:** 60+ FPS minimum, <16.67ms frame time - id: wechat-mini-game-naming-conventions title: WeChat Mini Game Naming Conventions type: table columns: [Element, Convention, Example] instruction: Only include if deviating from WeChat Mini Game defaults examples: - "| JavaScript files | snake_case | player_controller.js |" - "| Objects | PascalCase | PlayerCharacter, EnemySpawner |" - "| Events | snake_case | health_changed, level_completed |" - "| Resources | PascalCase + Data suffix | PlayerData, WeaponData |" - id: critical-rules title: Critical WeChat Mini Game Rules instruction: | List ONLY rules that ensure 60+ FPS and proper TDD. Examples: - "ALWAYS write tests FIRST (TDD Red-Green-Refactor)" - "ALWAYS pool spawned objects (bullets, particles, enemies)" - "Profile EVERY feature to ensure 60+ FPS maintained" Avoid obvious rules - focus on performance and TDD repeatable: true template: "- **{{rule_name}}:** {{rule_description}}" - id: wechat-mini-game-specifics title: WeChat Mini Game-Specific Guidelines condition: Critical WeChat Mini Game-specific rules needed instruction: Add ONLY if critical for performance and TDD sections: - id: wechat-mini-game-lifecycle title: WeChat Mini Game Lifecycle Rules repeatable: true template: "- **{{lifecycle_method}}:** {{usage_rule}}" - id: performance-rules title: Performance Rules repeatable: true template: "- **{{performance_rule}}:** {{requirement}}" - id: test-strategy title: Test Strategy and Standards instruction: | Work with user to define MANDATORY TDD strategy for WeChat Mini Game: 1. TDD is MANDATORY - tests must be written FIRST (Red-Green-Refactor) 2. Define test organization 3. Establish 80% minimum coverage goal 4. Determine performance testing approach (60+ FPS validation) 5. Plan for test doubles and event testing Note: TDD is non-negotiable. Every story must have tests written first. elicit: true sections: - id: testing-philosophy title: Testing Philosophy template: | - **Approach:** Test-Driven Development (MANDATORY) - **Coverage Goals:** 80% minimum - **Performance Tests:** Validate 60+ FPS maintained - id: wechat-mini-game-test-types title: WeChat Mini Game Test Types and Organization sections: - id: javascript-tests title: JavaScript Tests template: | - **File Convention:** test_*.js - **Location:** `tests/` - **Purpose:** Testing JavaScript game logic - **Coverage Requirement:** 80% minimum **AI Agent TDD Requirements:** - Write tests FIRST (Red phase) - Test object interactions and events - Test resource loading and data - Use test doubles for dependencies - Verify 60+ FPS in performance tests - id: test-data-management title: Test Data Management template: | - **Strategy:** {{test_data_approach}} - **Resource Fixtures:** {{test_resource_location}} - **Test Scenes:** {{test_scene_templates}} - **Event Testing:** {{event_test_patterns}} - **Performance Validation:** {{fps_test_approach}} - id: performance-security title: Performance and Security Considerations instruction: | Define performance and security requirements for WeChat Mini Game: 1. Performance is primary concern - 60+ FPS is mandatory 2. Profile every feature implementation 3. Object pooling for all spawned entities 4. Save data protection if needed 5. Platform-specific optimizations 6. These rules directly impact code generation elicit: true sections: - id: save-data-security title: Save Data Security template: | - **Encryption:** {{save_data_encryption_method}} - **Validation:** {{save_data_validation_approach}} - **Anti-Tampering:** {{anti_tampering_measures}} - id: platform-security title: Platform Security Requirements template: | - **Mobile Permissions:** {{mobile_permission_requirements}} - **Store Compliance:** {{platform_store_requirements}} - **Privacy Policy:** {{privacy_policy_requirements}} - id: multiplayer-security title: Multiplayer Security (if applicable) condition: Game includes multiplayer features template: | - **Client Validation:** {{client_validation_rules}} - **Server Authority:** {{server_authority_approach}} - **Anti-Cheat:** {{anti_cheat_measures}} - id: checklist-results title: Checklist Results Report instruction: Before running the checklist, offer to output the full game architecture document. Once user confirms, execute the architect-checklist and populate results here. - id: next-steps title: Next Steps instruction: | After completing the game architecture: 1. Review with Game Designer and technical stakeholders 2. Begin story implementation with Game Developer agent 3. Set up WeChat Mini Game project structure and initial configuration 4. Configure version control and build pipeline Include specific prompts for next agents if needed. sections: - id: developer-prompt title: Game Developer Prompt instruction: | Create a brief prompt to hand off to Game Developer for story implementation. Include: - Reference to this game architecture document - TDD requirements (tests first) - 60+ FPS performance target enforcement - Object pooling requirements - Request for adherence to established patterns ```