# BP_GameFramework — Asset Implementation

> **UE5 Asset:** `/Game/Framework/Core/BP_GameFramework`
> **Parent Class:** `GI_GameFramework` (C++) or `GameInstance` (BP-only)
> **Asset Type:** Blueprint Class (GameInstance)

---

## Create This Asset

### Step 1: Create Blueprint
1. Content Browser → `Content/Framework/Core/`
2. Right-click → **Blueprint Class**
3. Parent: `GI_GameFramework` (C++) OR `GameInstance`
4. Name: `BP_GameFramework`

### Step 2: Set as Game Instance Class
**Project Settings → Maps & Modes → Game Instance Class** → `BP_GameFramework`

### Step 3: Configure Class Defaults
| Variable | Type | Value |
|----------|------|-------|
| `TagRegistry` | `DA_GameTagRegistry` | Assign `DA_GameTagRegistry` asset |
| `bValidateTagsOnInit` | `Boolean` | `true` |
| `bLogTagsOnInit` | `Boolean` | `true` (dev) / `false` (ship) |

---

## What to Wire

### Override: Event Init
```
[Event Init]
  ├─ Parent: Event Init
  ├─ Print String: "BP_GameFramework: Init started"
  ├─ Branch: bValidateTagsOnInit?
  │   True → Call ValidateFrameworkTags (see below)
  ├─ IsValid(TagRegistry)? → Branch
  │   False → Print Error → Call OnFrameworkInitFailed("TagRegistry not assigned")
  │   True →
  │       ├─ Set bFrameworkInitialized = true
  │       ├─ Call OnFrameworkReady
  │       └─ Print String: "Framework ready"
```

### Function: ValidateFrameworkTags
```
[BlueprintCallable, Private]
  ├─ IsValid(TagRegistry)? → Branch
  │   False → Print Error → Return
  ├─ TagRegistry → GetAllRegisteredTags → AllTags
  ├─ Array Length(AllTags) → TagCount
  ├─ Branch: TagCount == 0?
  │   True → Print Warning: "No Gameplay Tags registered!"
  │   False → Print: "{TagCount} tags registered"
  ├─ Branch: bLogTagsOnInit?
  │   True → TagRegistry → LogAllTags
  └─ Return
```

### Function: IsFrameworkReady
```
[BlueprintPure, Public] → Boolean
  └─ Return bFrameworkInitialized
```

### Event Dispatchers to Create
| Dispatcher | Parameters |
|------------|-----------|
| `OnFrameworkReady` | (none) |
| `OnFrameworkInitFailed` | `ErrorReason` (String) |

---

## Test It
- [ ] PIE: output log shows "Framework ready" and tag count
- [ ] Clear TagRegistry variable → PIE → `OnFrameworkInitFailed` fires
- [ ] Set `bLogTagsOnInit = true` → all tag names printed to log
