# Game Core — GI_HorrorGame (Game Instance) **Game:** Project Void | **Asset:** `GI_HorrorGame` | **Parent:** `GI_GameFramework` **Asset Path:** `Content/Game/Core/GI_HorrorGame.uasset` **Build Phase:** 1 | **Framework System:** 04_GI_GameFramework --- ## Purpose The game-specific Game Instance. Inherits all kernel functionality from `GI_GameFramework` (game phase state machine, session flags, save slot management, service resolution, platform init). This BP child adds game-specific bootstrap configuration and horror-game startup sequences. --- ## Dependencies | System | Type | Why | |--------|------|-----| | `GI_GameFramework` (04) | Parent class | Inherits all kernel systems | | `GM_HorrorGameMode` | Referenced | Default game mode for all levels | | `DA_GameTagRegistry` (01) | Configured | Tag registry assigned in Class Defaults | | All `SS_` Subsystems | Owned | Initialized by parent on boot | | `DA_AudioSettings_Horror` (134) | Configured | Audio mix defaults for horror game | --- ## Creation Steps ### Step 1 — Create Blueprint Child ``` Content Browser → Game/Core/ Right-click → Blueprint Class Parent Class: GI_GameFramework (from Framework/Core/) Name: GI_HorrorGame ``` ### Step 2 — Configure Class Defaults Open `GI_HorrorGame` → Class Defaults: | Property | Value | Notes | |----------|-------|-------| | `TagRegistry` | `DA_GameTagRegistry` (Framework/Core/) | Critical — validates all gameplay tags on boot | | `ActiveSaveSlotIndex` | `0` | Default save slot | | `PlatformType` | `Generic` | Change to Steam/PlayStation/Xbox per build | | `bFirstLaunch` | `true` | Triggers intro flow on first-ever boot | ### Step 3 — Add Game-Specific Variables | Variable | Type | Default | Category | Purpose | |----------|------|---------|----------|---------| | `bIntroPlayed` | Boolean | `false` | `Game` | Tracks if opening cutscene has been played | | `TotalDeaths` | Integer | `0` | `Game` | Global death counter (persists across runs) | | `FearIntensityMultiplier` | Float | `1.0` | `Game` | Global scalar for scare/fear intensity | | `ActiveEndingTag` | GameplayTag | — | `Game` | Tracks which ending path player is on | ### Step 4 — Wire Event Init (Game-Specific Override) ``` [Event Init] (inherited from GI_GameFramework — call parent first) │ ├─ Parent: Event Init │ ├─ [Bootstrap Game Services] │ │ │ ├─ GetSubsystem(SS_AudioManager) → Initialize (DA_AudioSettings_Horror) │ │ └─ Sets horror-specific mix bus levels (quieter music, louder SFX) │ │ │ ├─ GetSubsystem(SS_SettingsSystem) → Apply Settings │ │ └─ Loads persisted audio/video/control settings │ │ │ └─ GetSubsystem(SS_EnhancedInputManager) → Initialize (DA_InputMapping_Horror_PC) │ └─ Load horror-specific keybindings │ ├─ [Check First Launch] │ │ │ ├─ bFirstLaunch? → Branch │ │ ├─ True: │ │ │ ├─ SetSessionFlag("HasSeenIntro", false) │ │ │ └─ (Optional) Reset achievement progress for fresh start │ │ └─ False: │ │ └─ SetSessionFlag("HasSeenIntro", true) │ │ │ └─ Set bFirstLaunch = false (won't trigger again this session) │ ├─ [Route to First Scene] │ │ │ ├─ Set Game Phase → Loading │ ├─ OpenLevel → "L_SplashScreen" │ └─ (Splash auto-advances to L_MainMenu after sequence) │ └─ Broadcast OnFrameworkReady ``` ### Step 5 — Add Game-Specific Functions #### `SetFearIntensity(Float Multiplier)` ``` Input: Multiplier (Float) Output: none Flow: ├─ FearIntensityMultiplier = Multiplier ├─ GetSubsystem(SS_AudioManager) → SetFloatParameter("FearIntensity", Multiplier) └─ Optionally notify BPC_PacingDirector of new intensity ``` #### `GetEndingAccumulator()` → BPC_EndingAccumulator ``` Output: BPC_EndingAccumulator Reference Flow: ├─ Get Player Pawn → GetComponentByClass(BPC_EndingAccumulator) └─ Return reference (null if player isn't spawned yet — only valid InGame) ``` #### `QuitToDesktop()` ``` Flow: ├─ GetSubsystem(SS_SaveManager) → QuickSave (if in-game) ├─ SetSessionFlag("CleanQuit", true) └─ UKismetSystemLibrary.QuitGame(GetWorld(), GetPlayerController(), Quit) ``` --- ## Key Differences from `GI_GameFramework` Parent | Aspect | GI_GameFramework (Framework) | GI_HorrorGame (Game) | |--------|---------------------------|---------------------| | Tag Registry | Not set (abstract) | `DA_GameTagRegistry` assigned | | Audio Settings | None | `DA_AudioSettings_Horror` | | Input Profile | None | `DA_InputMapping_Horror_PC` | | First Route | Generic | `L_SplashScreen` → `L_MainMenu` | | Game Variables | Session flags only | `TotalDeaths`, `FearIntensityMultiplier`, `ActiveEndingTag` | --- ## Blueprint Wiring Checklist - [ ] Create BP child of `GI_GameFramework` named `GI_HorrorGame` in `Game/Core/` - [ ] Set `TagRegistry` → `DA_GameTagRegistry` in Class Defaults - [ ] Add 4 game-specific variables (bIntroPlayed, TotalDeaths, FearIntensityMultiplier, ActiveEndingTag) - [ ] Override `Event Init` → call Parent → bootstrap audio, settings, input → route to splash - [ ] Add `SetFearIntensity` function - [ ] Add `GetEndingAccumulator` function - [ ] Add `QuitToDesktop` function - [ ] Set `GI_HorrorGame` as Default Game Instance in Project Settings → Maps & Modes --- ## Project Settings Configuration ``` Edit → Project Settings → Maps & Modes Default Game Instance: GI_HorrorGame (NOT GI_GameFramework) Edit → Project Settings → Gameplay Tags Add all 11 DT_Tags_*.csv Data Tables to Gameplay Tag Table List (See project-setup-migration.md section 2.2) ``` --- ## Communications With | Target System | Method | Why | |--------------|--------|-----| | `GM_HorrorGameMode` | Direct (spawned by engine) | Game rules | | `SS_AudioManager` | `GetSubsystem` | Audio bus config on boot | | `SS_SettingsSystem` | `GetSubsystem` | Load/apply settings on boot | | `SS_EnhancedInputManager` | `GetSubsystem` | Load input profile on boot | | `SS_SaveManager` | `GetSubsystem` | Auto-save on quit | | `BPC_PacingDirector` | Dispatcher | Fear intensity changes | | `BPC_EndingAccumulator` | Interface | Ending path tracking | --- ## Notes for Expansion - To add **Steam integration**: set `PlatformType = Steam`, add Steam subsystem init in `Event Init` - To add **Epic Online Services**: create a `SS_OnlineManager` subsystem, init in `Event Init` - To support **DLC chapters**: add a `LoadedChapters` map variable, query on level load - The `FearIntensityMultiplier` could drive a **global difficulty scaler** accessible to all systems - Consider adding an `OnGameBootComplete` dispatcher for systems that need to wait for full init --- *GI_HorrorGame — Core game instance for Project Void. See [GAMEINDEX.md](GAMEINDEX.md) for full game structure. See [04_GI_GameFramework.md](../blueprints/01-core/04_GI_GameFramework.md) for parent class spec.*