|
| 1 | +# FirstModule - Unreal Engine Modular Architecture Project |
| 2 | + |
| 3 | +## Changelog |
| 4 | + |
| 5 | +**2025-09-26 10:55:07** - Initial AI context generation |
| 6 | +- Created comprehensive documentation structure |
| 7 | +- Analyzed 4 runtime modules (FirstModule, Auto, Manual, Migrate) |
| 8 | +- Documented module dependencies and inter-module communication patterns |
| 9 | +- Established Blueprint-C++ integration patterns |
| 10 | + |
| 11 | +## Project Vision |
| 12 | + |
| 13 | +FirstModule is an educational Unreal Engine 5.6 project demonstrating advanced modular architecture patterns in C++. The project serves as a comprehensive handbook for understanding UE module creation, dependency management, and Blueprint-C++ integration strategies. It showcases three different approaches to module development: IDE-generated modules (Auto), manually crafted modules (Manual), and migrated modules from external projects (Migrate). |
| 14 | + |
| 15 | +## Architecture Overview |
| 16 | + |
| 17 | +This project implements a layered modular architecture with clear separation of concerns: |
| 18 | + |
| 19 | +- **Core Game Module**: `FirstModule` - Main game module providing entry point and core game logic |
| 20 | +- **Utility Modules**: `Auto` and `Manual` - Demonstration modules showing different creation methodologies |
| 21 | +- **External Integration**: `Migrate` - Example of module migration from external projects |
| 22 | +- **Blueprint Integration**: Seamless C++ to Blueprint exposure through UCLASS/UFUNCTION patterns |
| 23 | + |
| 24 | +### Module Structure Diagram |
| 25 | + |
| 26 | +```mermaid |
| 27 | +graph TD |
| 28 | + A["FirstModule (Main)"] --> B["Config"]; |
| 29 | + A --> C["Content"]; |
| 30 | + A --> D["Source"]; |
| 31 | + |
| 32 | + D --> E["FirstModule"]; |
| 33 | + D --> F["Auto"]; |
| 34 | + D --> G["Manual"]; |
| 35 | + D --> H["Migrate"]; |
| 36 | + |
| 37 | + F --> I["Auto.Build.cs"]; |
| 38 | + F --> J["Public/AutoModule.h"]; |
| 39 | + F --> K["Public/AutoExposed.h"]; |
| 40 | + F --> L["Public/AutoCppOnly.h"]; |
| 41 | + |
| 42 | + G --> M["Manual.Build.cs"]; |
| 43 | + G --> N["Public/ManualModule.h"]; |
| 44 | + G --> O["Public/ManualExposed.h"]; |
| 45 | + G --> P["Public/ManualCppOnly.h"]; |
| 46 | + |
| 47 | + H --> Q["Migrate.Build.cs"]; |
| 48 | + H --> R["Public/Migrate.h"]; |
| 49 | + H --> S["Public/MigrateActor.h"]; |
| 50 | + |
| 51 | + C --> T["Manual/BP_ManualExposed.uasset"]; |
| 52 | + C --> U["Level/LVL_FirstModule.umap"]; |
| 53 | + |
| 54 | + B --> V["DefaultEngine.ini"]; |
| 55 | + B --> W["DefaultGame.ini"]; |
| 56 | + B --> X["DefaultInput.ini"]; |
| 57 | + B --> Y["DefaultEditor.ini"]; |
| 58 | +
|
| 59 | + click F "./Source/Auto/CLAUDE.md" "View Auto module documentation" |
| 60 | + click G "./Source/Manual/CLAUDE.md" "View Manual module documentation" |
| 61 | + click H "./Source/Migrate/CLAUDE.md" "View Migrate module documentation" |
| 62 | +``` |
| 63 | + |
| 64 | +## Module Index |
| 65 | + |
| 66 | +| Module Name | Type | Purpose | Dependencies | Blueprint Support | Creation Method | |
| 67 | +|-------------|------|---------|--------------|-------------------|-----------------| |
| 68 | +| **FirstModule** | Game | Main game module and entry point | Core, CoreUObject, Engine, InputCore, EnhancedInput | Yes | Standard UE | |
| 69 | +| **Auto** | Runtime | IDE-generated module demonstrating automated creation | Core, CoreUObject, Engine | Yes | JetBrains Rider | |
| 70 | +| **Manual** | Runtime | Hand-crafted module showing manual creation process | Core, Auto, CoreUObject, Engine | Yes | Manual | |
| 71 | +| **Migrate** | Runtime | Migrated module from external project | Core, CoreUObject, Engine, Slate, SlateCore | Limited | Migration | |
| 72 | + |
| 73 | +## Running and Development |
| 74 | + |
| 75 | +### Prerequisites |
| 76 | +- Unreal Engine 5.6 or later |
| 77 | +- JetBrains Rider or Visual Studio 2022 |
| 78 | +- Windows 10/11 (primary platform) |
| 79 | + |
| 80 | +### Build Instructions |
| 81 | +1. Clone the repository |
| 82 | +2. Right-click `FirstModule.uproject` → "Generate Visual Studio Project Files" |
| 83 | +3. Open `FirstModule.sln` in your IDE |
| 84 | +4. Build the solution (Ctrl+Shift+B) |
| 85 | +5. Launch through the IDE or double-click the .uproject file |
| 86 | + |
| 87 | +### Module Loading Verification |
| 88 | +Check the Output Log for successful module initialization: |
| 89 | +``` |
| 90 | +LogAuto: Warning: FAutoModule::StartupModule() |
| 91 | +LogManual: Warning: FManualModule::StartupModule() |
| 92 | +LogTemp: Warning: MigrateActor::AMigrateActor |
| 93 | +``` |
| 94 | + |
| 95 | +## Testing Strategy |
| 96 | + |
| 97 | +### Module Integration Testing |
| 98 | +- **Inter-module Communication**: Manual module successfully calls Auto module classes |
| 99 | +- **Blueprint Exposure**: All UCLASS-marked classes appear in Blueprint editor |
| 100 | +- **Dependency Resolution**: Build system correctly resolves module dependencies |
| 101 | + |
| 102 | +### Blueprint Integration Testing |
| 103 | +- `BP_ManualExposed` inherits from `AManualExposed` C++ class |
| 104 | +- Blueprint-callable functions work correctly in editor |
| 105 | +- C++ constructors handle multiple Blueprint instantiations properly |
| 106 | + |
| 107 | +### Compilation Testing |
| 108 | +- Clean build from source compiles without errors |
| 109 | +- Module dependency changes trigger appropriate recompilation |
| 110 | +- Hot reload works for C++ changes during development |
| 111 | + |
| 112 | +## Coding Standards |
| 113 | + |
| 114 | +### Module Organization |
| 115 | +- **Public Headers**: Only expose necessary interfaces in `Public/` folder |
| 116 | +- **Private Implementation**: Keep implementation details in `Private/` folder |
| 117 | +- **API Macros**: Use module-specific API macros (`MANUAL_API`, `AUTO_API`, etc.) |
| 118 | + |
| 119 | +### Class Classification |
| 120 | +- **CppOnly Classes**: High-performance C++ classes (no Blueprint access) |
| 121 | +- **Exposed Classes**: Blueprint-compatible classes with UCLASS macro |
| 122 | +- **Internal Classes**: Module-private classes in Private folder |
| 123 | + |
| 124 | +### Naming Conventions |
| 125 | +- Module names: PascalCase (`Auto`, `Manual`) |
| 126 | +- Class prefixes: `F` (regular), `A` (Actor), `U` (UObject-derived) |
| 127 | +- API macros: UPPERCASE_MODULE_API (`MANUAL_API`) |
| 128 | + |
| 129 | +### Dependency Management |
| 130 | +- Use `PublicDependencyModuleNames` for dependencies other modules need |
| 131 | +- Use `PrivateDependencyModuleNames` for internal-only dependencies |
| 132 | +- Maintain clear dependency hierarchy to avoid circular references |
| 133 | + |
| 134 | +## AI Usage Guidelines |
| 135 | + |
| 136 | +### Claude Code Assistant Integration |
| 137 | +This project is optimized for AI-assisted development with clear module boundaries and comprehensive documentation. AI assistants can: |
| 138 | + |
| 139 | +- Analyze module structure and dependencies |
| 140 | +- Suggest improvements to modular architecture |
| 141 | +- Help debug inter-module communication issues |
| 142 | +- Assist with Blueprint-C++ integration patterns |
| 143 | + |
| 144 | +### Code Analysis Patterns |
| 145 | +- Module entry points are clearly marked with `StartupModule()`/`ShutdownModule()` |
| 146 | +- Public interfaces are documented in module headers |
| 147 | +- Dependencies are explicitly declared in Build.cs files |
| 148 | +- Blueprint integration points use standard UE reflection macros |
| 149 | + |
| 150 | +### Documentation Maintenance |
| 151 | +- Each module maintains its own `CLAUDE.md` with specific implementation details |
| 152 | +- Root documentation provides architectural overview and cross-module patterns |
| 153 | +- Index file tracks module relationships and scanning coverage |
| 154 | + |
| 155 | +## Development Workflow |
| 156 | + |
| 157 | +### Adding New Modules |
| 158 | +1. Create module directory structure in `Source/` |
| 159 | +2. Add Build.cs file with appropriate dependencies |
| 160 | +3. Create module interface class inheriting from `IModuleInterface` |
| 161 | +4. Register module in project .uproject file |
| 162 | +5. Update Target.cs files to include new module |
| 163 | +6. Generate project files and build |
| 164 | + |
| 165 | +### Module Migration Process |
| 166 | +1. Copy source module folder to target project |
| 167 | +2. Update target project .uproject configuration |
| 168 | +3. Modify Target.cs files to register migrated module |
| 169 | +4. Regenerate project files |
| 170 | +5. Verify compilation and functionality |
| 171 | + |
| 172 | +### Blueprint Integration |
| 173 | +1. Mark classes with `UCLASS(Blueprintable)` for inheritance |
| 174 | +2. Use `UFUNCTION(BlueprintCallable)` for callable methods |
| 175 | +3. Expose properties with `UPROPERTY(BlueprintReadWrite)` |
| 176 | +4. Keep constructors lightweight for Blueprint CDO creation |
0 commit comments